Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:UsersACER>cd c:/xampp/mysql/bin
c:xamppmysqlbin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 153
Server version: 5.0.67-community-nt MySQL Community Edition (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| akademik |
| cdcol |
| mysql |
| phpmyadmin |
| test |
| webauth |
+--------------------+
7 rows in set (0.01 sec)
mysql> use akademik;
Database changed
mysql> show tables;
+--------------------+
| Tables_in_akademik |
+--------------------+
| pegawai |
+--------------------+
1 row in set (0.00 sec)
mysql> drop tables pegawai;
Query OK, 0 rows affected (0.00 sec)
mysql> create table mahasiswa(kd_mtkul int (600) not null primary key,
-> nm_mtkul varchar (25),
-> sks int);
ERROR 1439 (42000): Display width out of range for column 'kd_mtkul' (max = 255)
mysql> create table mahasiswa(kd_mtkul int (600) not null primary key,
-> nm_mtkul varchar (25),
-> sks text);
ERROR 1439 (42000): Display width out of range for column 'kd_mtkul' (max = 255)
mysql> create table mahasiswa(kd_mtkul int (3) not null primary key,
-> nm_mtkul varchar (25),
-> sks text);
Query OK, 0 rows affected (0.39 sec)
mysql> desc mahasiswa;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| kd_mtkul | int(3) | NO | PRI | NULL | |
| nm_mtkul | varchar(25) | YES | | NULL | |
| sks | text | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> insert into mahasiswa values ('105','PPNI','4');
Query OK, 1 row affected (0.03 sec)
mysql> insert into mahasiswa values ('305','PEMROGRAMAN C++','4');
Query OK, 1 row affected (0.00 sec)
mysql> insert into mahasiswa values ('547','APSI','4');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM MAHASISWA;
+----------+-----------------+------+
| kd_mtkul | nm_mtkul | sks |
+----------+-----------------+------+
| 105 | PPNI | 4 |
| 305 | PEMROGRAMAN C++ | 4 |
| 547 | APSI | 4 |
+----------+-----------------+------+
3 rows in set (0.00 sec)
mysql> create table matakuliah (nim varchar (8) not null primary key,
-> nama varchar (9),
-> kelas text );
Query OK, 0 rows affected (0.41 sec)
mysql> desc matakuliah;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| nim | varchar(8) | NO | PRI | NULL | |
| nama | varchar(9) | YES | | NULL | |
| kelas | text | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> insert into matakuliah values ('11052824','novita','11.4c.11');
Query OK, 1 row affected (0.00 sec)
mysql> insert into matakuliah values ('11052827','sanesy','11.4b.13');
Query OK, 1 row affected (0.00 sec)
mysql> insert into matakuliah values ('11052830','renny wahyuni','11.4a.11');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select * from matakuliah;
+----------+-----------+----------+
| nim | nama | kelas |
+----------+-----------+----------+
| 11052824 | novita | 11.4c.11 |
| 11052827 | sanesy | 11.4b.13 |
| 11052830 | renny wah | 11.4a.11 |
+----------+-----------+----------+
3 rows in set (0.00 sec)
mysql> ceate tabel nilai(nim text (8) not null primary key,
-> create tabel nilai(nim text (8) not null primary key;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ceate
tabel nilai(nim text (8) not null primary key,
create tabel nilai(nim text' at line 1
mysql> create table nilai (nim text (8) not null primary key,
-> kd_mtkul text (3),
-> nil_absen int (5),
-> nil_tugas int (3),
-> nil_uts int (2),
-> nil_uas int );
ERROR 1170 (42000): BLOB/TEXT column 'nim' used in key specification without a k
ey length
mysql> create table nilai (nim int (8) not null primary key,
-> kd_mtkul text (3),
-> nil_absen text (2),
-> nil_tugas TEXT (3),
-> nil_absen text (2),
-> nil_uts TEXT (2),
-> nil_uas TEXT );
ERROR 1060 (42S21): Duplicate column name 'nil_absen'
mysql> DESC NILAI;
ERROR 1146 (42S02): Table 'akademik.nilai' doesn't exist
mysql> create table nilai (nim int (8) not null primary key,
-> kd_mtkul text (3),
-> nil_absen text (2),
-> nil_tugas TEXT (3),
-> nil_uts int (2),
-> nil_uas TEXT);
Query OK, 0 rows affected (0.09 sec)
mysql> DESC NILAI;
+-----------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+-------+
| nim | int(8) | NO | PRI | NULL | |
| kd_mtkul | tinytext | YES | | NULL | |
| nil_absen | tinytext | YES | | NULL | |
| nil_tugas | tinytext | YES | | NULL | |
| nil_uts | int(2) | YES | | NULL | |
| nil_uas | text | YES | | NULL | |
+-----------+----------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql> insert into nilai values ('11052834','305','70','80','90','87');
Query OK, 1 row affected (0.00 sec)
mysql> insert into nilai values ('11052827','105','80','78','87','77');
Query OK, 1 row affected (0.00 sec)
mysql> insert into nilai values ('11052830','547','75','88','90','75');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM NILAI;
+----------+----------+-----------+-----------+---------+---------+
| nim | kd_mtkul | nil_absen | nil_tugas | nil_uts | nil_uas |
+----------+----------+-----------+-----------+---------+---------+
| 11052834 | 305 | 70 | 80 | 90 | 87 |
| 11052827 | 105 | 80 | 78 | 87 | 77 |
| 11052830 | 547 | 75 | 88 | 90 | 75 |
+----------+----------+-----------+-----------+---------+---------+
3 rows in set (0.00 sec)
mysql> select nilai.nim,
-> mahasiswa.nama,
-> mahasiswa.kelas,
-> nilai.kd_mtkul,
-> matakuliah.nm_mtkul,
-> nilai.nil_absen,
-> nilai.nil_tugas,
-> nilai.nil_uts,
-> nilai.nil_uas,
-> (0.1*nil_absen)+(0.2*nil_tugas)+(0.3*nil_uts)+(0.4*nil_uas)AS rata,
-> IIf(rata>=80,'a,IIf(rata>70,'b,IIf(rata>=65,'c,IIf(rata>=55,'d','e))))AS
grade from (matakuliah INNER JOIN nilai ON matakuliah.kd_mtkul=nilai.kd_mtkul) I
NNER JOIN mahasiswa ON mahasiswa.nim=nilai.nim;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'b,IIf
(rata>=65,'c,IIf(rata>=55,'d','e))))AS grade from (matakuliah INNER JOIN ni' at
line 11
mysql> create table query(nim

Hanya contoh saja dari xampp

  • 1.
    Microsoft Windows [Version6.2.9200] (c) 2012 Microsoft Corporation. All rights reserved. C:UsersACER>cd c:/xampp/mysql/bin c:xamppmysqlbin>mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 153 Server version: 5.0.67-community-nt MySQL Community Edition (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> show tables; ERROR 1046 (3D000): No database selected mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | akademik | | cdcol | | mysql | | phpmyadmin | | test | | webauth | +--------------------+ 7 rows in set (0.01 sec) mysql> use akademik; Database changed mysql> show tables; +--------------------+ | Tables_in_akademik | +--------------------+ | pegawai | +--------------------+ 1 row in set (0.00 sec) mysql> drop tables pegawai; Query OK, 0 rows affected (0.00 sec) mysql> create table mahasiswa(kd_mtkul int (600) not null primary key, -> nm_mtkul varchar (25), -> sks int); ERROR 1439 (42000): Display width out of range for column 'kd_mtkul' (max = 255) mysql> create table mahasiswa(kd_mtkul int (600) not null primary key, -> nm_mtkul varchar (25), -> sks text); ERROR 1439 (42000): Display width out of range for column 'kd_mtkul' (max = 255) mysql> create table mahasiswa(kd_mtkul int (3) not null primary key, -> nm_mtkul varchar (25), -> sks text); Query OK, 0 rows affected (0.39 sec) mysql> desc mahasiswa; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | kd_mtkul | int(3) | NO | PRI | NULL | | | nm_mtkul | varchar(25) | YES | | NULL | | | sks | text | YES | | NULL | |
  • 2.
    +----------+-------------+------+-----+---------+-------+ 3 rows inset (0.00 sec) mysql> insert into mahasiswa values ('105','PPNI','4'); Query OK, 1 row affected (0.03 sec) mysql> insert into mahasiswa values ('305','PEMROGRAMAN C++','4'); Query OK, 1 row affected (0.00 sec) mysql> insert into mahasiswa values ('547','APSI','4'); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM MAHASISWA; +----------+-----------------+------+ | kd_mtkul | nm_mtkul | sks | +----------+-----------------+------+ | 105 | PPNI | 4 | | 305 | PEMROGRAMAN C++ | 4 | | 547 | APSI | 4 | +----------+-----------------+------+ 3 rows in set (0.00 sec) mysql> create table matakuliah (nim varchar (8) not null primary key, -> nama varchar (9), -> kelas text ); Query OK, 0 rows affected (0.41 sec) mysql> desc matakuliah; +-------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------------+------+-----+---------+-------+ | nim | varchar(8) | NO | PRI | NULL | | | nama | varchar(9) | YES | | NULL | | | kelas | text | YES | | NULL | | +-------+------------+------+-----+---------+-------+ 3 rows in set (0.00 sec) mysql> insert into matakuliah values ('11052824','novita','11.4c.11'); Query OK, 1 row affected (0.00 sec) mysql> insert into matakuliah values ('11052827','sanesy','11.4b.13'); Query OK, 1 row affected (0.00 sec) mysql> insert into matakuliah values ('11052830','renny wahyuni','11.4a.11'); Query OK, 1 row affected, 1 warning (0.00 sec) mysql> select * from matakuliah; +----------+-----------+----------+ | nim | nama | kelas | +----------+-----------+----------+ | 11052824 | novita | 11.4c.11 | | 11052827 | sanesy | 11.4b.13 | | 11052830 | renny wah | 11.4a.11 | +----------+-----------+----------+ 3 rows in set (0.00 sec) mysql> ceate tabel nilai(nim text (8) not null primary key, -> create tabel nilai(nim text (8) not null primary key; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ceate tabel nilai(nim text (8) not null primary key, create tabel nilai(nim text' at line 1 mysql> create table nilai (nim text (8) not null primary key, -> kd_mtkul text (3),
  • 3.
    -> nil_absen int(5), -> nil_tugas int (3), -> nil_uts int (2), -> nil_uas int ); ERROR 1170 (42000): BLOB/TEXT column 'nim' used in key specification without a k ey length mysql> create table nilai (nim int (8) not null primary key, -> kd_mtkul text (3), -> nil_absen text (2), -> nil_tugas TEXT (3), -> nil_absen text (2), -> nil_uts TEXT (2), -> nil_uas TEXT ); ERROR 1060 (42S21): Duplicate column name 'nil_absen' mysql> DESC NILAI; ERROR 1146 (42S02): Table 'akademik.nilai' doesn't exist mysql> create table nilai (nim int (8) not null primary key, -> kd_mtkul text (3), -> nil_absen text (2), -> nil_tugas TEXT (3), -> nil_uts int (2), -> nil_uas TEXT); Query OK, 0 rows affected (0.09 sec) mysql> DESC NILAI; +-----------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+----------+------+-----+---------+-------+ | nim | int(8) | NO | PRI | NULL | | | kd_mtkul | tinytext | YES | | NULL | | | nil_absen | tinytext | YES | | NULL | | | nil_tugas | tinytext | YES | | NULL | | | nil_uts | int(2) | YES | | NULL | | | nil_uas | text | YES | | NULL | | +-----------+----------+------+-----+---------+-------+ 6 rows in set (0.00 sec) mysql> insert into nilai values ('11052834','305','70','80','90','87'); Query OK, 1 row affected (0.00 sec) mysql> insert into nilai values ('11052827','105','80','78','87','77'); Query OK, 1 row affected (0.00 sec) mysql> insert into nilai values ('11052830','547','75','88','90','75'); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM NILAI; +----------+----------+-----------+-----------+---------+---------+ | nim | kd_mtkul | nil_absen | nil_tugas | nil_uts | nil_uas | +----------+----------+-----------+-----------+---------+---------+ | 11052834 | 305 | 70 | 80 | 90 | 87 | | 11052827 | 105 | 80 | 78 | 87 | 77 | | 11052830 | 547 | 75 | 88 | 90 | 75 | +----------+----------+-----------+-----------+---------+---------+ 3 rows in set (0.00 sec) mysql> select nilai.nim, -> mahasiswa.nama, -> mahasiswa.kelas, -> nilai.kd_mtkul, -> matakuliah.nm_mtkul, -> nilai.nil_absen, -> nilai.nil_tugas, -> nilai.nil_uts,
  • 4.
    -> nilai.nil_uas, -> (0.1*nil_absen)+(0.2*nil_tugas)+(0.3*nil_uts)+(0.4*nil_uas)ASrata, -> IIf(rata>=80,'a,IIf(rata>70,'b,IIf(rata>=65,'c,IIf(rata>=55,'d','e))))AS grade from (matakuliah INNER JOIN nilai ON matakuliah.kd_mtkul=nilai.kd_mtkul) I NNER JOIN mahasiswa ON mahasiswa.nim=nilai.nim; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'b,IIf (rata>=65,'c,IIf(rata>=55,'d','e))))AS grade from (matakuliah INNER JOIN ni' at line 11 mysql> create table query(nim