Enter password: *********** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 Server version: 5.7.40-log MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW dtabases;
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 'dtabases' at line 1 2. mysql> SHOW databases; +--------------------+ | Database | +--------------------+ | information_schema | | classicmodels | | mysql | | performance_schema | | phpdasar | | sakila | | shop_app | | sys | | world | +--------------------+ 9 rows in set (0.00 sec)
3. mysql> drop database belajar_mysql; (menghapus database yg dipilih)
+--------------------+ | Database | +--------------------+ | information_schema | | classicmodels | | mysql | | performance_schema | | phpdasar | | sakila | | shop_app | | sys | | world | +--------------------+ 9 rows in set (0.00 sec)
7. mysql> USE phpdasar; (memilih database mana yg akan digunakan)
Database changed mysql> CREATE TABLE mahasiswa( -> id INT PRIMARY KEY auto_increment, -> nama VARCHAR(100), -> nrp CHAR(9), -> email VARCHAR(100), -> jurusan VARCHAR(100), -> gambar VARCHAR(100) -> ); Query OK, 0 rows affected (0.02 sec)
8. mysql> SHOW TABLES;
+--------------------+ | Tables_in_phpdasar | +--------------------+ | mahasiswa | +--------------------+ 1 row in set (0.00 sec)
9. mysql> DESCRIBE mahasiswa; (memunculkan data kolom/baris yg telah dibuat)
+---------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | nama | varchar(100) | YES | | NULL | | | nrp | char(9) | YES | | NULL | | | email | varchar(100) | YES | | NULL | | | jurusan | varchar(100) | YES | | NULL | | | gambar | varchar(100) | YES | | NULL | | +---------+--------------+------+-----+---------+----------------+ 6 rows in set (0.01 sec)
mysql> INSERT INTO VALUES('','Sandhika
Galih','043040023','sandhikagalih@gmail.com','Teknik Informatika','sandhika.jpeg'); 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 'VALUES('','Sandhika Galih','043040023','sandhikagalih@gmail.com','Teknik Informa' at line 1 mysql> INSERT INTO mahasiswa VALUES('','Sandhika Galih','043040023','sandhikagalih@gmail.com','Teknik Informatika','sandhika.jpeg'); ERROR 1366 (HY000): Incorrect integer value: '' for column 'id' at row 1 mysql> INSERT INTO mahasiswa VALUES('','Sandhika Galih','043040023','sandhikagalih@gmail.com','Teknik Informatika','sandhika.jpeg'); ERROR 1366 (HY000): Incorrect integer value: '' for column 'id' at row 1 mysql> INSERT INTO mahasiswa VALUES(' ', 'Sandhika Galih','043040023','sandhikagalih@gmail.com','Teknik Informatika','sandhika.jpeg'); ERROR 1366 (HY000): Incorrect integer value: ' ' for column 'id' at row 1 10. mysql> INSERT INTO mahasiswa VALUES(0,'Sandhika Galih','043040023','sandhikagalih@gmail.com','Teknik Informatika','sandhika.jpeg'); (memasukkan nilai2 pada tabel) Query OK, 1 row affected (0.01 sec)
11. mysql> SELECT* FROM mahasiswa;
+----+----------------+-----------+-------------------------+--------------------+---------------+ | id | nama | nrp | email | jurusan | gambar | +----+----------------+-----------+-------------------------+--------------------+---------------+ | 1 | Sandhika Galih | 043040023 | sandhikagalih@gmail.com | Teknik Informatika | sandhika.jpeg | +----+----------------+-----------+-------------------------+--------------------+---------------+ 1 row in set (0.00 sec)
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 'FROM mahasiswa' at line 1 13. mysql> SELECT * FROM mahasiswa; +----+----------------+-----------+-------------------------+--------------------+---------------+ | id | nama | nrp | email | jurusan | gambar | +----+----------------+-----------+-------------------------+--------------------+---------------+ | 1 | Sandhika Galih | 043040023 | sandhikagalih@gmail.com | Teknik Informatika | sandhika.jpeg | | 2 | Doddy | 133040123 | doddy@gmail.com | Teknik Informatika | doddy.jpeg | | 3 | Erik | 153030321 | erik@gmail.com | Teknik Informatika | erik.jpeg | +----+----------------+-----------+-------------------------+--------------------+---------------+ 3 rows in set (0.00 sec)