MySQL databases, it consists of tables, table is made up of columns (or fields) and rows (records). They are a spider net, complicated but well organised.
This Note includes 4 most comment used command, it is all I need in operating database:
- Create and Delete
- Show All Databases
- Set Default Database
- Show Current Database
1 — Create and Delete
mysql> CREATE DATABASE southwind;Query OK, 1 row affected (0.03 sec)
mysql> DROP DATABASE southwind;Query OK, 0 rows affected (0.11 sec)
mysql> CREATE DATABASE IF NOT EXISTS southwind;Query OK, 1 row affected (0.01 sec)
mysql> DROP DATABASE IF EXISTS southwind;Query OK, 0 rows affected (0.00 sec)
2 — Show All Database
mysql> SHOW DATABASES;
3 — Set Default Database
mysql> USE southwind;
4— Show Current Database
mysql> SELECT DATABASE();
You may also like
- MySQL Handbook
- [MySQL] Note: Fast Setup and running in Node.js
- [MySQL] Note: Create Admin User
- [MySQL] Note: Database CURD
- [MySQL] Note: Row CURD
- [MySQL] Note: Relation: 1–1, 1-n, n-n, nest
Reference:
https://www.cyberciti.biz/faq/mysql-list-databases/
https://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_Beginner.html