create table(テーブルの作成)
label_1("show table(テーブルのリストの表示)
データベースはいくつかのテーブルを持つことができます。テーブルを作成するには、useでデータベースを選択して、create tableの構文を使います。
create table table_name ( field_1_name field_1_type,
field_2_name field_2_type, ...);
field_n_nameはn番目のフィールドの名前、field_n_typeはn番目のフィールドの型を指定します。
データベース内にあるテーブルのリストを表示するには、useでデータベースを選択した後に、show tablesの構文を使います。
show tables;
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
24 rows in set (0.47 sec)
mysql>