7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL - データベースのテーブル数・テーブル内のカラム数を知りたい

Last updated at Posted at 2017-07-24

テーブル数を調べたい場合

information_schemaテーブルに検索をかける

mysql> select count(*) from `information_schema`.`tables` where `table_schema` = 'table';                         
+----------+
| count(*) |
+----------+
|      100 |
+----------+
1 row in set (0.01 sec)

テーブル内のカラム数が知りたい場合

同上

mysql> select count(*) from information_schema.columns where table_name = '#{テーブル名}';                            
+----------+
| count(*) |
+----------+
|      158 |
+----------+
1 row in set (0.01 sec)

以上、備忘録でした。

7
2
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
7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?