1
drop table if exists t1,t2,t3;
2
drop database if exists showtemp;
3
create database if not exists showtemp;
5
create temporary table t1(id int);
6
create temporary table t2(id int);
7
create temporary table showtemp.t3(id int);
8
insert into t1 values(10),(20),(30),(40);
9
insert into showtemp.t3 values(999);
10
show temporary tables;
14
show temporary tables from test;
18
show temporary tables in showtemp;
19
Temp_tables_in_showtemp
21
select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
22
table_schema table_name engine table_rows
26
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
27
table_schema table_name engine table_rows
31
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
32
table_schema table_name engine table_rows
34
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
35
table_schema table_name engine table_rows
36
drop table if exists showtemp.t2;
37
create temporary table t1(id int);
38
create temporary table showtemp.t2(id int);
39
show temporary tables;
42
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
43
table_schema table_name engine table_rows
49
drop table showtemp.t2;
51
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
52
table_schema table_name engine table_rows
57
drop table showtemp.t3;
58
drop database showtemp;