LoginSignup
0
0

More than 3 years have passed since last update.

メモ⑤-データベースへのDDL処理-

Posted at

DDLとは
データベースや、テーブルそのものに処理を加える指示。
生成(=CREATE)・削除(=DROP)・変更(=ALTER)などがある。

~データベースへの処理
【CREATE】
「sample」というデータベースを新しく生成する。

書き方は以下の通り。↓
MariaDB [world]> create database sample;
Query OK, 1 row affected (0.003 sec)

確認すると…
MariaDB [world]> show databases;
+--------------------+
| Database |
+--------------------+
| company |
| information_schema |
| mysql |
| performance_schema |
| sample |←「sample」データベースが追加されている。
| test |
| world |
+--------------------+
7 rows in set (0.001 sec)

【DROP】
データベースを削除するコマンド。

上で生成したsampleデータベースを削除してみる。↓
MariaDB [world]> DROP DATABASE sample;
Query OK, 0 rows affected (0.002 sec)

確認すると…
MariaDB [world]> show databases;
+--------------------+
| Database |
+--------------------+
| company |
| information_schema |
| mysql |
| performance_schema |
| test |←「sample」データベースが消えている。
| world |
+--------------------+
6 rows in set (0.001 sec)

・・・⑥へ続く

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0