Anda di halaman 1dari 13

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 ''1224
06109','dio','1994-08-30','sd001')' at line 1
mysql> insert into data values('122406109','dio','1994-08-30','sd001');
Query OK, 1 row affected (0.09 sec)

mysql> insert into data values('122406108','dony','1994-08-10','sd001');


Query OK, 1 row affected (0.00 sec)

mysql> insert into data values('122406107','teguh','1994-07-12','sd001');


Query OK, 1 row affected (0.00 sec)

mysql> select*from data;


+-----------+-------+------------+-------------+
| nim

| nama | tgl_lahir | kode_matkul |

+-----------+-------+------------+-------------+
| 122406109 | dio | 1994-08-30 | sd001

| 122406108 | dony | 1994-08-10 | sd001

| 122406107 | teguh | 1994-07-12 | sd001

+-----------+-------+------------+-------------+
3 rows in set (0.00 sec)

mysql> create table data(kode_matkul (10) primary key, nama_matkul


varchar(350),
nama_dosen text);
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 '(10)

primary key, nama_matkul varchar(350),nama_dosen text)' at line 1


mysql> create table data(kode_matkul (10) primary key, nama_matkul
varchar(50),n
ama_dosen text);
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 '(10)
primary key, nama_matkul varchar(50),nama_dosen text)' at line 1
mysql> create table data(kode_matkul varchar(10) primary key, nama_matkul
varcha
r(50),nama_dosen text);
ERROR 1050 (42S01): Table 'data' already exists
mysql> create table matkul(kode_matkul varchar(10) primary key, nama_matkul
varc
har(50),nama_dosen text);
Query OK, 0 rows affected (0.20 sec)

mysql> insert into matkul values('sd001','jaringan_komputer','sawaludin');


Query OK, 1 row affected (0.16 sec)

mysql> insert into matkul values('jk002','jaringan komputer','sawaludin');


Query OK, 1 row affected (0.00 sec)

mysql> update table matkul set nama_matkul='sistem_database' where


kode_matkul='
sd001';
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 'table
matkul set nama_matkul='sistem_database' where kode_matkul='sd001'' at line 1

mysql> update table matkul set nama_matkul='sistem_database' where


kode_matkul='
sd001';
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 'table
matkul set nama_matkul='sistem_database' where kode_matkul='sd001'' at line 1
mysql> select*from data inner join matkul;
+-----------+-------+------------+-------------+-------------+------------------+------------+
| nim

| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul

| nama_dosen |
+-----------+-------+------------+-------------+-------------+------------------+------------+
| 122406109 | dio | 1994-08-30 | sd001

| sd001

| jaringan_komputer

| jk002

| jaringan komputer

| sawaludin |
| 122406109 | dio | 1994-08-30 | sd001
| sawaludin |
| 122406108 | dony | 1994-08-10 | sd001

| sd001

| jaringan_komputer

| jk002

| jaringan komputer

| sawaludin |
| 122406108 | dony | 1994-08-10 | sd001
| sawaludin |
| 122406107 | teguh | 1994-07-12 | sd001

| sd001

| jaringan_komputer

| jk002

| jaringan komputer

| sawaludin |
| 122406107 | teguh | 1994-07-12 | sd001
| sawaludin |
+-----------+-------+------------+-------------+-------------+------------------+------------+

6 rows in set (0.09 sec)

mysql> select*from data inner join matkul on


data.kode_matkul=matkul.kode_matkul
;
+-----------+-------+------------+-------------+-------------+------------------+------------+
| nim

| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul

| nama_dosen |
+-----------+-------+------------+-------------+-------------+------------------+------------+
| 122406109 | dio | 1994-08-30 | sd001

| sd001

| jaringan_komputer

| sawaludin |
| 122406108 | dony | 1994-08-10 | sd001

| sd001

| jaringan_komputer

| sd001

| jaringan_komputer

| sawaludin |
| 122406107 | teguh | 1994-07-12 | sd001
| sawaludin |
+-----------+-------+------------+-------------+-------------+------------------+------------+
3 rows in set (0.08 sec)

mysql> update matkul set nama_matkul='sistem_database' where


kode_matkul='sd001'
;
Query OK, 1 row affected (0.11 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> update matkul set nama_dosen='bambang irawan' where


kode_matkul='sd001';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select*from data inner join matkul on


data.kode_matkul=matkul.kode_matkul
;
+-----------+-------+------------+-------------+-------------+-----------------+
----------------+
| nim

| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul

nama_dosen

+-----------+-------+------------+-------------+-------------+-----------------+
----------------+
| 122406109 | dio | 1994-08-30 | sd001

| sd001

| sistem_database |

bambang irawan |
| 122406108 | dony | 1994-08-10 | sd001

| sd001

| sistem_database |

| sd001

| sistem_database |

bambang irawan |
| 122406107 | teguh | 1994-07-12 | sd001
bambang irawan |
+-----------+-------+------------+-------------+-------------+-----------------+
----------------+
3 rows in set (0.00 sec)

mysql> select*from data inner join matkul on


data.kode_matkul=matkul.kode_matkul;
+-----------+-------+------------+-------------+-------------+-----------------+----------------+

| nim
| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul
nama_dosen
|

+-----------+-------+------------+-------------+-------------+-----------------+----------------+
| 122406109 | dio | 1994-08-30 | sd001
bambang irawan |

| sd001

| sistem_database |

| 122406108 | dony | 1994-08-10 | sd001


bambang irawan |

| sd001

| sistem_database |

| 122406107 | teguh | 1994-07-12 | sd001


bambang irawan |

| sd001

| sistem_database |

+-----------+-------+------------+-------------+-------------+-----------------+----------------+
3 rows in set (0.00 sec)

mysql> select*from data;


+-----------+-------+------------+-------------+
| nim

| nama | tgl_lahir | kode_matkul |

+-----------+-------+------------+-------------+
| 122406109 | dio | 1994-08-30 | sd001

| 122406108 | dony | 1994-08-10 | sd001

| 122406107 | teguh | 1994-07-12 | sd001

+-----------+-------+------------+-------------+
3 rows in set (0.01 sec)

mysql> select*from matkul;


+-------------+-------------------+----------------+
| kode_matkul | nama_matkul

| nama_dosen

+-------------+-------------------+----------------+
| sd001

| sistem_database | bambang irawan |

| jk002

| jaringan komputer | sawaludin

+-------------+-------------------+----------------+
2 rows in set (0.00 sec)

mysql> update data set kode_matkul='jk002' where nim='122406108';


Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> update data set kode_matkul='jk003' where nim='122406107';


Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select*from data;


+-----------+-------+------------+-------------+
| nim

| nama | tgl_lahir | kode_matkul |

+-----------+-------+------------+-------------+
| 122406109 | dio | 1994-08-30 | sd001

| 122406108 | dony | 1994-08-10 | jk002

| 122406107 | teguh | 1994-07-12 | jk003

+-----------+-------+------------+-------------+
3 rows in set (0.00 sec)

mysql> select*from data cross join matkul on


data.kode_matkul=matkul.kode_matkul;
+-----------+------+------------+-------------+-------------+-------------------+----------------+
| nim
| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul
nama_dosen
|

+-----------+------+------------+-------------+-------------+-------------------+----------------+

| 122406109 | dio | 1994-08-30 | sd001


bambang irawan |

| sd001

| sistem_database |

| 122406108 | dony | 1994-08-10 | jk002


sawaludin
|

| jk002

| jaringan komputer |

+-----------+------+------------+-------------+-------------+-------------------+----------------+
2 rows in set (0.00 sec)

mysql> update data set kode_matkul='jk002' where nim='122406107';


Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select*from data cross join matkul on


data.kode_matkul=matkul.kode_matkul;
+-----------+-------+------------+-------------+-------------+-------------------+----------------+
| nim
| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul
nama_dosen
|

+-----------+-------+------------+-------------+-------------+-------------------+----------------+
| 122406109 | dio | 1994-08-30 | sd001
bambang irawan |

| sd001

| sistem_database |

| 122406108 | dony | 1994-08-10 | jk002


sawaludin
|

| jk002

| jaringan komputer |

| 122406107 | teguh | 1994-07-12 | jk002


sawaludin
|

| jk002

| jaringan komputer |

+-----------+-------+------------+-------------+-------------+-------------------+----------------+
3 rows in set (0.00 sec)

mysql> select*from data full join matkul on data.kode_matkul=matkul.kode_matkul;


ERROR 1054 (42S22): Unknown column 'data.kode_matkul' in 'on clause'
mysql> select*from data left join matkul on data.kode_matkul=matkul.kode_matkul;
+-----------+-------+------------+-------------+-------------+-------------------+----------------+
| nim
| nama | tgl_lahir | kode_matkul | kode_matkul | nama_matkul
nama_dosen
|

+-----------+-------+------------+-------------+-------------+-------------------+----------------+
| 122406109 | dio | 1994-08-30 | sd001
bambang irawan |

| sd001

| sistem_database |

| 122406108 | dony | 1994-08-10 | jk002


sawaludin
|

| jk002

| jaringan komputer |

| 122406107 | teguh | 1994-07-12 | jk002


sawaludin
|

| jk002

| jaringan komputer |

+-----------+-------+------------+-------------+-------------+-------------------+----------------+
3 rows in set (0.02 sec)

mysql> select*from data natural join matkul;


+-------------+-----------+-------+------------+-------------------+----------------+
| kode_matkul | nim

| nama | tgl_lahir | nama_matkul

| nama_dosen

+-------------+-----------+-------+------------+-------------------+----------------+
| sd001

| 122406109 | dio | 1994-08-30 | sistem_database | bambang irawan |

| jk002

| 122406108 | dony | 1994-08-10 | jaringan komputer | sawaludin

| jk002

| 122406107 | teguh | 1994-07-12 | jaringan komputer | sawaludin

+-------------+-----------+-------+------------+-------------------+----------------+
3 rows in set (0.00 sec)

mysql> select nim,nama,nama_matkul data natural join matkul;


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 'natural join matkul' at line 1
mysql> select data.nim,data.nama,matkul.nama_matkul;
ERROR 1109 (42S02): Unknown table 'data' in field list
mysql> select data.nim,data.nama,matkul.nama_matkul
-> from data,matkul
-> where matkul.kode_matkul=data.kode_matkul;
+-----------+-------+-------------------+
| nim

| nama | nama_matkul

+-----------+-------+-------------------+
| 122406109 | dio | sistem_database |
| 122406108 | dony | jaringan komputer |
| 122406107 | teguh | jaringan komputer |
+-----------+-------+-------------------+
3 rows in set (0.00 sec)

mysql> select*from data;


+-----------+-------+------------+-------------+
| nim

| nama | tgl_lahir | kode_matkul |

+-----------+-------+------------+-------------+
| 122406109 | dio | 1994-08-30 | sd001

| 122406108 | dony | 1994-08-10 | jk002

| 122406107 | teguh | 1994-07-12 | jk002

+-----------+-------+------------+-------------+

3 rows in set (0.00 sec)

mysql> select*from matkul;


+-------------+-------------------+----------------+
| kode_matkul | nama_matkul

| nama_dosen

+-------------+-------------------+----------------+
| sd001

| sistem_database | bambang irawan |

| jk002

| jaringan komputer | sawaludin

+-------------+-------------------+----------------+
2 rows in set (0.00 sec)

mysql> select data.nama,matkul.nama_matkul,matkul.nama_dosen


-> from data,matkul
-> where data.kode_matkul=matkul.kode_matkul;
+-------+-------------------+----------------+
| nama | nama_matkul

| nama_dosen

+-------+-------------------+----------------+
| dio | sistem_database | bambang irawan |
| dony | jaringan komputer | sawaludin

| teguh | jaringan komputer | sawaludin

+-------+-------------------+----------------+
3 rows in set (0.01 sec)

mysql> select data.nama,matkul.nama_matkul,matkul.nama_dosen


-> from data,matkul
-> where data.nama=datakode_matkul

-> where data.nim='122406108';


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 'where
data.nim='122406108'' at line 4
mysql> select data.nama,matkul.nama_matkul,matkul.nama_dosen
-> from data,matkul;
+-------+-------------------+----------------+
| nama | nama_matkul

| nama_dosen

+-------+-------------------+----------------+
| dio | sistem_database | bambang irawan |
| dio | jaringan komputer | sawaludin

| dony | sistem_database | bambang irawan |


| dony | jaringan komputer | sawaludin

| teguh | sistem_database | bambang irawan |


| teguh | jaringan komputer | sawaludin

+-------+-------------------+----------------+
6 rows in set (0.00 sec)

mysql> select data.nama,matkul.nama_matkul,matkul.nama_dosen


-> from data,matkul
-> where nama='dony' and data.kode_matkul=matkul.kode_matkul;
+------+-------------------+------------+
| nama | nama_matkul

| nama_dosen |

+------+-------------------+------------+
| dony | jaringan komputer | sawaludin |
+------+-------------------+------------+

1 row in set (0.05 sec)

mysql>