26
26
test.t1 check status OK
27
27
show index from t1;
28
28
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
29
def data_dictionary show_indexes SHOW_INDEXES Table Table 8 256 2 N 1 0 45
30
def data_dictionary show_indexes SHOW_INDEXES Unique Unique 8 20 5 N 1 0 45
31
def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 256 7 N 1 0 45
32
def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 20 1 N 32769 0 63
33
def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 256 1 N 1 0 45
29
def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
30
def data_dictionary show_indexes SHOW_INDEXES Unique Unique 8 20 3 N 4097 0 45
31
def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
32
def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 20 1 N 36865 0 63
33
def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 1 N 4097 0 45
34
34
Table Unique Key_name Seq_in_index Column_name
38
38
insert into t1 values (5,5,5);
39
39
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
40
40
-- Here we enable metadata just to check that the collation of the
48
48
-- after Bug#29394 is implemented.
49
49
show variables like "server_id%";
50
50
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
51
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 256 9 N 1 0 45
52
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 1 0 45
51
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
52
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
53
53
Variable_name Value
55
55
show variables like "SERVER_id%";
56
56
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
57
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 256 9 N 1 0 45
58
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 1 0 45
57
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
58
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
59
59
Variable_name Value
61
61
show variables like "this_doesn't_exists%";
62
62
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
63
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 256 0 N 1 0 45
64
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 1 0 45
63
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 0 N 4097 0 45
64
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 4097 0 45
65
65
Variable_name Value
66
66
show table status from test like "this_doesn't_exists%";
67
67
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
68
def data_dictionary show_table_status SHOW_TABLE_STATUS Session Session 5 20 0 N 32769 0 63
69
def data_dictionary show_table_status SHOW_TABLE_STATUS Schema Schema 8 256 0 N 1 0 45
70
def data_dictionary show_table_status SHOW_TABLE_STATUS Name Name 8 256 0 N 1 0 45
71
def data_dictionary show_table_status SHOW_TABLE_STATUS Type Type 8 256 0 N 1 0 45
72
def data_dictionary show_table_status SHOW_TABLE_STATUS Engine Engine 8 256 0 N 1 0 45
73
def data_dictionary show_table_status SHOW_TABLE_STATUS Version Version 8 256 0 N 1 0 45
74
def data_dictionary show_table_status SHOW_TABLE_STATUS Rows Rows 8 256 0 N 1 0 45
75
def data_dictionary show_table_status SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 256 0 N 1 0 45
76
def data_dictionary show_table_status SHOW_TABLE_STATUS Table_size Table_size 8 256 0 N 1 0 45
77
def data_dictionary show_table_status SHOW_TABLE_STATUS Auto_increment Auto_increment 8 256 0 N 1 0 45
68
def data_dictionary show_table_status SHOW_TABLE_STATUS Session Session 5 20 0 N 36865 0 63
69
def data_dictionary show_table_status SHOW_TABLE_STATUS Schema Schema 8 1024 0 N 4097 0 45
70
def data_dictionary show_table_status SHOW_TABLE_STATUS Name Name 8 1024 0 N 4097 0 45
71
def data_dictionary show_table_status SHOW_TABLE_STATUS Type Type 8 1024 0 N 4097 0 45
72
def data_dictionary show_table_status SHOW_TABLE_STATUS Engine Engine 8 1024 0 N 4097 0 45
73
def data_dictionary show_table_status SHOW_TABLE_STATUS Version Version 8 1024 0 N 4097 0 45
74
def data_dictionary show_table_status SHOW_TABLE_STATUS Rows Rows 8 1024 0 N 4097 0 45
75
def data_dictionary show_table_status SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 1024 0 N 4097 0 45
76
def data_dictionary show_table_status SHOW_TABLE_STATUS Table_size Table_size 8 1024 0 N 4097 0 45
77
def data_dictionary show_table_status SHOW_TABLE_STATUS Auto_increment Auto_increment 8 1024 0 N 4097 0 45
78
78
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
80
80
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
81
def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database 8 256 18 N 1 0 45
81
def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database 8 1024 18 N 4097 0 45
87
87
show databases like "test%";
88
88
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
89
def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 256 4 N 1 0 45
89
def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 1024 4 N 4097 0 45
92
92
create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
104
104
test.t1 analyze status OK
105
105
show index from t1;
106
106
Table Unique Key_name Seq_in_index Column_name
111
111
show index from t1;
112
112
Table Unique Key_name Seq_in_index Column_name
118
118
create temporary table t1 (a int not null);
119
119
show create table t1;
120
120
Table Create Table
121
121
t1 CREATE TEMPORARY TABLE `t1` (
123
) ENGINE=DEFAULT COLLATE = utf8_general_ci
124
124
alter table t1 rename t2;
125
125
show create table t2;
126
126
Table Create Table
127
127
t2 CREATE TEMPORARY TABLE `t2` (
129
) ENGINE=DEFAULT COLLATE = utf8_general_ci
131
131
create table t1 (
132
132
name char(20) default 'O''Brien' comment 'O''Brien as default',
137
137
show create table t1;
138
138
Table Create Table
139
139
t1 CREATE TABLE `t1` (
140
`name` varchar(20) DEFAULT 'O''Brien' COMMENT 'O''Brien as default',
141
`c` int NOT NULL COMMENT 'int column',
142
`c-b` int DEFAULT NULL COMMENT 'name with a minus',
143
`space 2` int DEFAULT NULL COMMENT 'name with a space'
144
) ENGINE=DEFAULT COMMENT='it''s a table'
140
`name` VARCHAR(20) COLLATE utf8_general_ci DEFAULT 'O''Brien' COMMENT 'O''Brien as default',
141
`c` INT NOT NULL COMMENT 'int column',
142
`c-b` INT DEFAULT NULL COMMENT 'name with a minus',
143
`space 2` INT DEFAULT NULL COMMENT 'name with a space'
144
) ENGINE=DEFAULT COMMENT='it''s a table' COLLATE = utf8_general_ci
145
145
show columns from t1;
146
146
Field Type Null Default Default_is_NULL On_Update
147
name VARCHAR TRUE O'Brien FALSE
148
c INTEGER FALSE FALSE
149
c-b INTEGER TRUE TRUE
150
space 2 INTEGER TRUE TRUE
147
name VARCHAR YES O'Brien NO
150
space 2 INTEGER YES YES
152
152
create table t1 (a int not null, unique aa (a));
153
153
show create table t1;
154
154
Table Create Table
155
155
t1 CREATE TABLE `t1` (
157
157
UNIQUE KEY `aa` (`a`)
158
) ENGINE=DEFAULT COLLATE = utf8_general_ci
160
160
create table t1 (a int not null, primary key (a));
161
161
show create table t1;
162
162
Table Create Table
163
163
t1 CREATE TABLE `t1` (
165
165
PRIMARY KEY (`a`)
166
) ENGINE=DEFAULT COLLATE = utf8_general_ci
168
168
create temporary table t1 (a int not null, b VARCHAR(10), INDEX (b) ) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
169
169
show create table t1;
170
170
Table Create Table
171
171
t1 CREATE TEMPORARY TABLE `t1` (
173
`b` varchar(10) DEFAULT NULL,
173
`b` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
175
) ENGINE=MyISAM ROW_FORMAT=FIXED COMMENT='test'
175
) ENGINE=MyISAM ROW_FORMAT='fixed' COMMENT='test' COLLATE = utf8_general_ci
176
176
alter table t1 ROW_FORMAT=dynamic;
177
177
show create table t1;
178
178
Table Create Table
179
179
t1 CREATE TEMPORARY TABLE `t1` (
181
`b` varchar(10) DEFAULT NULL,
181
`b` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
183
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC COMMENT='test'
184
ALTER TABLE t1 COMMENT="" ROW_FORMAT=default;
183
) ENGINE=MyISAM ROW_FORMAT='dynamic' COMMENT='test' COLLATE = utf8_general_ci
184
ALTER TABLE t1 COMMENT="", ROW_FORMAT='default';
185
185
show create table t1;
186
186
Table Create Table
187
187
t1 CREATE TEMPORARY TABLE `t1` (
189
`b` varchar(10) DEFAULT NULL,
189
`b` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
191
) ENGINE=MyISAM ROW_FORMAT='default' COLLATE = utf8_general_ci
193
193
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
194
194
show columns from t1;
195
195
Field Type Null Default Default_is_NULL On_Update
202
202
show columns from t1;
203
203
Field Type Null Default Default_is_NULL On_Update
211
211
create temporary table t1 (
227
227
show create table t1;
228
228
Table Create Table
229
229
t1 CREATE TEMPORARY TABLE `t1` (
230
`type_int` int DEFAULT NULL,
231
`type_bigint` bigint DEFAULT NULL,
232
`type_decimal` decimal(5,2) DEFAULT NULL,
233
`type_numeric` decimal(5,2) DEFAULT NULL,
234
`empty_char` varchar(0) DEFAULT NULL,
235
`type_char` varchar(2) DEFAULT NULL,
236
`type_varchar` varchar(10) DEFAULT NULL,
237
`type_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
238
`type_date` date DEFAULT NULL,
239
`type_datetime` datetime DEFAULT NULL,
240
`type_enum` enum('red','green','blue') DEFAULT NULL,
241
`type_set` enum('red','green','blue') DEFAULT NULL,
230
`type_int` INT DEFAULT NULL,
231
`type_bigint` BIGINT DEFAULT NULL,
232
`type_decimal` DECIMAL(5,2) DEFAULT NULL,
233
`type_numeric` DECIMAL(5,2) DEFAULT NULL,
234
`empty_char` VARCHAR(0) COLLATE utf8_general_ci DEFAULT NULL,
235
`type_char` VARCHAR(2) COLLATE utf8_general_ci DEFAULT NULL,
236
`type_varchar` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
237
`type_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
238
`type_date` DATE DEFAULT NULL,
239
`type_datetime` DATETIME DEFAULT NULL,
240
`type_enum` ENUM('red','green','blue') DEFAULT NULL,
241
`type_set` ENUM('red','green','blue') DEFAULT NULL,
243
243
KEY `type_int` (`type_int`)
244
) ENGINE=MyISAM ROW_FORMAT=FIXED COMMENT='test'
244
) ENGINE=MyISAM ROW_FORMAT='fixed' COMMENT='test' COLLATE = utf8_general_ci
245
245
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
246
246
select * from t1;
247
247
type_int type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_datetime type_enum type_set type_blob
251
251
create table t2 select max(a) from t1;
252
252
show columns from t2;
253
253
Field Type Null Default Default_is_NULL On_Update
254
max(a) INTEGER TRUE TRUE
254
max(a) INTEGER YES YES
255
255
drop table t1,t2;
256
256
create table t1 (c decimal, d double, f float, r real);
257
257
show columns from t1;
258
258
Field Type Null Default Default_is_NULL On_Update
264
264
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
265
265
show columns from t1;
266
266
Field Type Null Default Default_is_NULL On_Update
271
271
CREATE TABLE ```ab``cd``` (i INT);
272
272
SHOW CREATE TABLE ```ab``cd```;
273
273
Table Create Table
274
274
`ab`cd` CREATE TABLE ```ab``cd``` (
276
) ENGINE=DEFAULT COLLATE = utf8_general_ci
277
277
DROP TABLE ```ab``cd```;
278
278
CREATE TABLE ```ab````cd``` (i INT);
279
279
SHOW CREATE TABLE ```ab````cd```;
280
280
Table Create Table
281
281
`ab``cd` CREATE TABLE ```ab````cd``` (
283
) ENGINE=DEFAULT COLLATE = utf8_general_ci
284
284
DROP TABLE ```ab````cd```;
285
285
CREATE TABLE ```a` (i INT);
286
286
SHOW CREATE TABLE ```a`;
287
287
Table Create Table
288
288
`a CREATE TABLE ```a` (
290
) ENGINE=DEFAULT COLLATE = utf8_general_ci
291
291
DROP TABLE ```a`;
292
292
CREATE TABLE `a.1` (i INT);
293
293
SHOW CREATE TABLE `a.1`;
294
294
Table Create Table
295
295
a.1 CREATE TABLE `a.1` (
297
) ENGINE=DEFAULT COLLATE = utf8_general_ci
298
298
DROP TABLE `a.1`;
299
299
select @@max_heap_table_size;
300
300
@@max_heap_table_size
374
374
SHOW CREATE TABLE t1;
375
375
Table Create Table
376
376
t1 CREATE TEMPORARY TABLE `t1` (
377
`i` int DEFAULT NULL,
377
`i` INT DEFAULT NULL,
379
) ENGINE=MEMORY COLLATE = utf8_general_ci
381
381
CREATE TEMPORARY TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
382
382
SHOW CREATE TABLE t1;
383
383
Table Create Table
384
384
t1 CREATE TEMPORARY TABLE `t1` (
385
`i` int DEFAULT NULL,
385
`i` INT DEFAULT NULL,
386
386
KEY `i` (`i`) USING HASH
387
) ENGINE=MEMORY COLLATE = utf8_general_ci
389
389
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
390
390
SHOW CREATE TABLE t1;
391
391
Table Create Table
392
392
t1 CREATE TEMPORARY TABLE `t1` (
393
`i` int DEFAULT NULL,
394
KEY `i` (`i`) USING BTREE
397
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
398
SHOW CREATE TABLE t1;
400
t1 CREATE TEMPORARY TABLE `t1` (
401
`i` int DEFAULT NULL,
405
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
406
SHOW CREATE TABLE t1;
408
t1 CREATE TEMPORARY TABLE `t1` (
409
`i` int DEFAULT NULL,
410
KEY `i` (`i`) USING BTREE
413
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
414
SHOW CREATE TABLE t1;
416
t1 CREATE TEMPORARY TABLE `t1` (
417
`i` int DEFAULT NULL,
420
ALTER TABLE t1 ENGINE=MEMORY;
421
SHOW CREATE TABLE t1;
423
t1 CREATE TEMPORARY TABLE `t1` (
424
`i` int DEFAULT NULL,
428
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
429
SHOW CREATE TABLE t1;
431
t1 CREATE TEMPORARY TABLE `t1` (
432
`i` int DEFAULT NULL,
433
KEY `i` (`i`) USING BTREE
435
ALTER TABLE t1 ENGINE=MEMORY;
436
SHOW CREATE TABLE t1;
438
t1 CREATE TEMPORARY TABLE `t1` (
439
`i` int DEFAULT NULL,
440
KEY `i` (`i`) USING BTREE
393
`i` INT DEFAULT NULL,
394
KEY `i` (`i`) USING BTREE
395
) ENGINE=MEMORY COLLATE = utf8_general_ci
397
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
398
SHOW CREATE TABLE t1;
400
t1 CREATE TEMPORARY TABLE `t1` (
401
`i` INT DEFAULT NULL,
403
) ENGINE=MyISAM COLLATE = utf8_general_ci
405
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
406
SHOW CREATE TABLE t1;
408
t1 CREATE TEMPORARY TABLE `t1` (
409
`i` INT DEFAULT NULL,
410
KEY `i` (`i`) USING BTREE
411
) ENGINE=MyISAM COLLATE = utf8_general_ci
413
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
414
SHOW CREATE TABLE t1;
416
t1 CREATE TEMPORARY TABLE `t1` (
417
`i` INT DEFAULT NULL,
419
) ENGINE=MyISAM COLLATE = utf8_general_ci
420
ALTER TABLE t1 ENGINE=MEMORY;
421
SHOW CREATE TABLE t1;
423
t1 CREATE TEMPORARY TABLE `t1` (
424
`i` INT DEFAULT NULL,
426
) ENGINE=MEMORY COLLATE = utf8_general_ci
428
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
429
SHOW CREATE TABLE t1;
431
t1 CREATE TEMPORARY TABLE `t1` (
432
`i` INT DEFAULT NULL,
433
KEY `i` (`i`) USING BTREE
434
) ENGINE=MyISAM COLLATE = utf8_general_ci
435
ALTER TABLE t1 ENGINE=MEMORY;
436
SHOW CREATE TABLE t1;
438
t1 CREATE TEMPORARY TABLE `t1` (
439
`i` INT DEFAULT NULL,
440
KEY `i` (`i`) USING BTREE
441
) ENGINE=MEMORY COLLATE = utf8_general_ci
444
444
field1 text NOT NULL,
447
447
show index from t1;
448
448
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
449
def data_dictionary show_indexes SHOW_INDEXES Table Table 8 256 2 N 1 0 45
450
def data_dictionary show_indexes SHOW_INDEXES Unique Unique 8 20 4 N 1 0 45
451
def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 256 7 N 1 0 45
452
def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 20 1 N 32769 0 63
453
def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 256 6 N 1 0 45
449
def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
450
def data_dictionary show_indexes SHOW_INDEXES Unique Unique 8 20 3 N 4097 0 45
451
def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
452
def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 20 1 N 36865 0 63
453
def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 6 N 4097 0 45
454
454
Table Unique Key_name Seq_in_index Column_name
455
t1 TRUE PRIMARY 1 field1
455
t1 YES PRIMARY 1 field1
457
457
create table t1 (
463
463
SHOW CREATE TABLE t1;
464
464
Table Create Table
465
465
t1 CREATE TABLE `t1` (
468
468
PRIMARY KEY (`c1`) USING HASH,
469
469
KEY `c2` (`c2`) USING BTREE
470
) ENGINE=DEFAULT COLLATE = utf8_general_ci
472
472
SHOW TABLES FROM non_existing_database;
473
ERROR 42000: Unknown database 'non_existing_database'
473
ERROR 42000: Unknown schema 'non_existing_database'
475
475
SHOW TABLES FROM no_such_database;
476
ERROR 42000: Unknown database 'no_such_database'
476
ERROR 42000: Unknown schema 'no_such_database'
477
477
SHOW COLUMNS FROM no_such_table;
478
478
ERROR 42S02: Table 'test.no_such_table' doesn't exist
479
479
show variables like 'myisam_recover_options';