paint-brush
[MySQL] Note: Database CURDby@peterchang_82818
1,666 reads
1,666 reads

[MySQL] Note: Database CURD

by December 22nd, 2016
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<a href="https://www.cyberciti.biz/faq/mysql-list-databases/" target="_blank">https://www.cyberciti.biz/faq/mysql-list-databases/</a>
featured image - [MySQL] Note: Database CURD
 HackerNoon profile picture

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:

  1. Create and Delete
  2. Show All Databases
  3. Set Default Database
  4. 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

Reference:

https://www.cyberciti.biz/faq/mysql-list-databases/

https://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_Beginner.html