質問編集履歴

2

テーブルリストの追加

2020/03/30 06:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -61,3 +61,29 @@
61
61
  id, name, content, created_atなど、レコードの全部を表示したいのですが可能でしょうか。
62
62
 
63
63
  よろしくお願いします。
64
+
65
+
66
+
67
+ 追加:
68
+
69
+ mysql> select table_name, table_rows from information_schema.TABLES where table_schema = 'App';
70
+
71
+ +----------------------+------------+
72
+
73
+ | table_name | table_rows |
74
+
75
+ +----------------------+------------+
76
+
77
+ | ar_internal_metadata | 1 |
78
+
79
+ | comments | 0 |
80
+
81
+ | likes | 0 |
82
+
83
+ | posts | 1 |
84
+
85
+ | schema_migrations | 10 |
86
+
87
+ | users | 6 |
88
+
89
+ +----------------------+------------+

1

表示結果の追加

2020/03/30 06:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,9 +8,49 @@
8
8
 
9
9
  `mysql> show databases;`
10
10
 
11
+ +------------------------+
12
+
13
+ | Database |
14
+
15
+ +------------------------+
16
+
17
+ | information_schema |
18
+
19
+ | innodb |
20
+
21
+ | mysql |
22
+
23
+ | performance_schema |
24
+
25
+ | sys |
26
+
27
+ | App |
28
+
29
+ +------------------------+
30
+
11
31
  でデータベースの一覧は表示できますし、
12
32
 
13
33
  `mysql> select table_name, table_rows from information_schema.TABLES where table_schema = 'DB名';`
34
+
35
+ +---------------+------------------------+----------------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------------+
36
+
37
+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | TABLE_TYPE | ENGINE | VERSION | ROW_FORMAT | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | MAX_DATA_LENGTH | INDEX_LENGTH | DATA_FREE | AUTO_INCREMENT | CREATE_TIME | UPDATE_TIME | CHECK_TIME | TABLE_COLLATION | CHECKSUM | CREATE_OPTIONS | TABLE_COMMENT |
38
+
39
+ +---------------+------------------------+----------------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------------+
40
+
41
+ | def | App | ar_internal_metadata | BASE TABLE | InnoDB | 10 | Dynamic | 1 | 16384 | 16384 | 0 | 0 | 0 | NULL | 2020-03-29 18:46:02 | 2020-03-29 18:46:03 | NULL | utf8_general_ci | NULL | | |
42
+
43
+ | def | App | comments | BASE TABLE | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 16384 | 0 | 1 | 2020-03-29 18:46:03 | NULL | NULL | utf8_general_ci | NULL | | |
44
+
45
+ | def | App | likes | BASE TABLE | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 0 | 0 | 1 | 2020-03-29 18:46:03 | NULL | NULL | utf8_general_ci | NULL | | |
46
+
47
+ | def | App | posts | BASE TABLE | InnoDB | 10 | Dynamic | 1 | 16384 | 16384 | 0 | 0 | 0 | 7 | 2020-03-29 18:46:03 | 2020-03-30 04:30:49 | NULL | utf8_general_ci | NULL | | |
48
+
49
+ | def | App | schema_migrations | BASE TABLE | InnoDB | 10 | Dynamic | 10 | 1638 | 16384 | 0 | 0 | 0 | NULL | 2020-03-29 18:46:02 | 2020-03-29 18:46:03 | NULL | utf8_general_ci | NULL | | |
50
+
51
+ | def | App | users | BASE TABLE | InnoDB | 10 | Dynamic | 6 | 2730 | 16384 | 0 | 0 | 0 | 7 | 2020-03-29 18:46:03 | 2020-03-29 21:31:41 | NULL | utf8_general_ci | NULL | | |
52
+
53
+ +---------------+------------------------+----------------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------------+
14
54
 
15
55
  で各テーブルのレコード数は表示できたのですが、
16
56