Cara Mengisi Data Base

Embed Size (px)

DESCRIPTION

lagnkah menginput data bases

Citation preview

Microsoft Windows [Version 6.1.7600]Copyright (c) 2009 Microsoft Corporation. All rights reserved.C:\Users\Ahmad>cd\C:\>cd C:\xampp\mysql\binC:\xampp\mysql\bin>mysql -u rootWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.21 MySQL Community Server (GPL)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database akademik;Query OK, 1 row affected (0.00 sec)mysql> use akademik;Database changedmysql> create table pengajar -> (kode_pengajar int(5) primary key, nama_pengajar varchar(15) not null, alamat varchar(30) null, no_telp char(12) not null, pendidikan_terakhir char(2) not null) -> ;Query OK, 0 rows affected (0.30 sec)mysql> describe pengajar;+---------------------+-------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+---------------------+-------------+------+-----+---------+-------+| kode_pengajar | int(5) | NO | PRI | NULL | || nama_pengajar | varchar(15) | NO | | NULL | || alamat | varchar(30) | YES | | NULL | || no_telp | char(12) | NO | | NULL | || pendidikan_terakhir | char(2) | NO | | NULL | |+---------------------+-------------+------+-----+---------+-------+5 rows in set (0.07 sec)mysql> insert into pengajar values ( -> 'TH01' -> 'TH01','Malik Ahmad','Mataram','087765258408',''S1') '> ; '> ') -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'S1');')' at line 3mysql> ;insert into pengajar valuesERROR:No query specified -> ;insert into pengajar values (ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near '' atline 1 -> cls -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near '' atline 2mysql> insert to pengajar values ( -> 'TH01', -> 'Malik Ahmad', -> 'Mataram', -> '087765258', -> 'S1');ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'to pengajar values ('TH01','Malik Ahmad','Mataram','087765258','S1')' at line 1mysql> insert to pengajar values ( -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'to pengajar values (' at line 1mysql> insert into pengajar values ( -> 'TH01', -> 'Malik Ahmad', -> 'Mataram', -> '087765258', -> 'S1');Query OK, 1 row affected, 1 warning (0.17 sec)mysql> SELECT * FROM PENGAJAR;+---------------+---------------+---------+-----------+---------------------+| kode_pengajar | nama_pengajar | alamat | no_telp | pendidikan_terakhir |+---------------+---------------+---------+-----------+---------------------+| 0 | Malik Ahmad | Mataram | 087765258 | S1 |+---------------+---------------+---------+-----------+---------------------+1 row in set (0.04 sec)mysql> insert into pengajar -> (kode_pengajar, nama_pengajar, no_telp, pendidikan_terakhir) -> values -> ('3', 'kiki', '00877634', 'S2); '> ; '> ;) '> ('3', 'kiki', '00877634', 'S2'); '> ('3','kiki','00877634','S2'); '> ') -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near '3', 'kiki', '00877634', 'S2');('3','kiki','00877634','S2');')' at line 4mysql> insert into pengajar -> (kode_pengajar, nama_pengajar, no_telp, pendidikan_terakhir) -> values -> ('3', 'kiki', '00877634', 'S2');Query OK, 1 row affected (0.18 sec)mysql> selec * from pengajar;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'selec * from pengajar' at line 1mysql> select * from pengajar;+---------------+---------------+---------+-----------+---------------------+| kode_pengajar | nama_pengajar | alamat | no_telp | pendidikan_terakhir |+---------------+---------------+---------+-----------+---------------------+| 0 | Malik Ahmad | Mataram | 087765258 | S1 || 3 | kiki | NULL | 00877634 | S2 |+---------------+---------------+---------+-----------+---------------------+2 rows in set (0.00 sec)mysql> select nama_pegajar, alamat from pengajar;ERROR 1054 (42S22): Unknown column 'nama_pegajar' in 'field list'mysql> select nama_pengajar, alamat from pengajar;+---------------+---------+| nama_pengajar | alamat |+---------------+---------+| Malik Ahmad | Mataram || kiki | NULL |+---------------+---------+2 rows in set (0.00 sec)mysql> select * from pengajar where pendidikan_terakhir='S2';+---------------+---------------+--------+----------+---------------------+| kode_pengajar | nama_pengajar | alamat | no_telp | pendidikan_terakhir |+---------------+---------------+--------+----------+---------------------+| 3 | kiki | NULL | 00877634 | S2 |+---------------+---------------+--------+----------+---------------------+1 row in set (0.10 sec)mysql> select nama_pengajar from pengajar where nama_pengajar= 'Malik Ahmad';+---------------+| nama_pengajar |+---------------+| Malik Ahmad |+---------------+1 row in set (0.00 sec)mysql>