1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
CREATE SCHEMA data_dictionary;
use data_dictionary;
SELECT count(*) FROM columns;
count(*)
#
SELECT count(*) FROM indexes;
count(*)
#
SELECT count(*) FROM index_parts;
count(*)
#
SELECT SCHEMA_NAME FROM schemas;
SCHEMA_NAME
#
#
#
#
SELECT COLUMN_NAME FROM columns;
COLUMN_NAME
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
SELECT count(*) FROM REFERENTIAL_CONSTRAINTS;
count(*)
#
SELECT count(*) FROM TABLE_CONSTRAINTS;
count(*)
#
show create table COLUMNS ;
Table Create Table
COLUMNS CREATE TABLE `columns` (
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`COLUMN_NAME` varchar(64) NOT NULL DEFAULT '',
`ORDINAL_POSITION` bigint NOT NULL DEFAULT '0',
`COLUMN_DEFAULT` varchar(64) NOT NULL DEFAULT '',
`IS_NULLABLE` varchar(5) NOT NULL DEFAULT '',
`DATA_TYPE` varchar(64) NOT NULL DEFAULT '',
`CHARACTER_MAXIMUM_LENGTH` bigint NOT NULL DEFAULT '0',
`CHARACTER_OCTET_LENGTH` bigint NOT NULL DEFAULT '0',
`NUMERIC_PRECISION` bigint NOT NULL DEFAULT '0',
`NUMERIC_SCALE` bigint NOT NULL DEFAULT '0',
`COLLATION_NAME` varchar(64) NOT NULL DEFAULT '',
`COLUMN_KEY` varchar(5) NOT NULL DEFAULT '',
`EXTRA` varchar(20) NOT NULL DEFAULT '',
`COLUMN_COMMENT` varchar(1024) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table INDEXES ;
Table Create Table
INDEXES CREATE TABLE `indexes` (
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`INDEX_NAME` varchar(64) NOT NULL DEFAULT '',
`IS_PRIMARY` varchar(5) NOT NULL DEFAULT '',
`IS_UNIQUE` varchar(5) NOT NULL DEFAULT '',
`IS_NULLABLE` varchar(5) NOT NULL DEFAULT '',
`KEY_LENGTH` bigint NOT NULL DEFAULT '0',
`INDEX_TYPE` varchar(64) NOT NULL DEFAULT '',
`INDEX_COMMENT` varchar(1024) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table INDEX_PARTS ;
Table Create Table
INDEX_PARTS CREATE TABLE `index_parts` (
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`INDEX_NAME` varchar(64) NOT NULL DEFAULT '',
`COLUMN_NAME` varchar(64) NOT NULL DEFAULT '',
`COLUMN_NUMBER` bigint NOT NULL DEFAULT '0',
`COMPARE_LENGTH` bigint NOT NULL DEFAULT '0',
`IS_ORDER_REVERSE` varchar(5) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table LOCAL_TABLE_NAMES;
Table Create Table
LOCAL_TABLE_NAMES CREATE TABLE `local_table_names` (
`TABLE_NAME` varchar(64) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table REFERENTIAL_CONSTRAINTS ;
Table Create Table
REFERENTIAL_CONSTRAINTS CREATE TABLE `referential_constraints` (
`CONSTRAINT_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`CONSTRAINT_NAME` varchar(64) NOT NULL DEFAULT '',
`UNIQUE_CONSTRAINT_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`UNIQUE_CONSTRAINT_NAME` varchar(64) NOT NULL DEFAULT '',
`MATCH_OPTION` varchar(64) NOT NULL DEFAULT '',
`UPDATE_RULE` varchar(64) NOT NULL DEFAULT '',
`DELETE_RULE` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`REFERENCED_TABLE_NAME` varchar(64) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table SCHEMAS ;
Table Create Table
SCHEMAS CREATE TABLE `schemas` (
`SCHEMA_NAME` varchar(64) NOT NULL DEFAULT '',
`DEFAULT_COLLATION_NAME` varchar(64) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table SCHEMA_NAMES;
Table Create Table
SCHEMA_NAMES CREATE TABLE `schema_names` (
`SCHEMA_NAME` varchar(64) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table TABLES ;
Table Create Table
TABLES CREATE TABLE `tables` (
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`TABLE_TYPE` varchar(64) NOT NULL DEFAULT '',
`ENGINE` varchar(64) NOT NULL DEFAULT '',
`ROW_FORMAT` varchar(10) NOT NULL DEFAULT '',
`TABLE_COLLATION` varchar(64) NOT NULL DEFAULT '',
`TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
show create table TABLE_CONSTRAINTS ;
Table Create Table
TABLE_CONSTRAINTS CREATE TABLE `table_constraints` (
`CONSTRAINT_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`CONSTRAINT_NAME` varchar(64) NOT NULL DEFAULT '',
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`CONSTRAINT_TYPE` varchar(64) NOT NULL DEFAULT ''
) ENGINE=FunctionEngine
select * from LOCAL_TABLE_NAMES;
TABLE_NAME
CHARACTER_SETS
COLLATIONS
COLUMNS
GLOBAL_STATEMENTS
GLOBAL_STATUS
GLOBAL_VARIABLES
INDEXES
INDEX_PARTS
INNODB_STATUS
LOCAL_TABLE_NAMES
LOCAL_TABLE_STATUS
MODULES
PLUGINS
PROCESSLIST
REFERENTIAL_CONSTRAINTS
SCHEMAS
SCHEMA_NAMES
SESSION_STATEMENTS
SESSION_STATUS
SESSION_VARIABLES
TABLES
TABLE_CONSTRAINTS
CREATE SCHEMA A;
use A;
create table A (a int);
SELECT COUNT(*) FROM data_dictionary.tables WHERE TABLE_NAME = "A";
COUNT(*)
1
select * from data_dictionary.LOCAL_TABLE_NAMES;
TABLE_NAME
a
DROP SCHEMA A;
DROP SCHEMA data_dictionary;
|