drop table if exists t1,t2,t3;
drop database if exists showtemp;
create database if not exists showtemp;
use test;
create temporary table t1(id int);
create temporary table t2(id int);
create temporary table showtemp.t3(id int);
insert into t1 values(10),(20),(30),(40);
insert into showtemp.t3 values(999);
show temporary tables;
Temp_tables_in_test
t2
t1
show temporary tables from test;
Temp_tables_in_test
t2
t1
show temporary tables in showtemp;
Temp_tables_in_showtemp
t3
select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
table_schema	table_name	engine	table_rows
showtemp	t3	MyISAM	1
test	t2	MyISAM	0
test	t1	MyISAM	4
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
table_schema	table_name	engine	table_rows
showtemp	t3	MyISAM	1
test	t2	MyISAM	0
test	t1	MyISAM	4
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
table_schema	table_name	engine	table_rows
showtemp	t3	MyISAM	1
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
table_schema	table_name	engine	table_rows
drop table if exists showtemp.t2;
create temporary table t1(id int);
create temporary table showtemp.t2(id int);
show temporary tables;
Temp_tables_in_test
t1
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
table_schema	table_name	engine	table_rows
showtemp	t2	MyISAM	0
test	t1	MyISAM	0
showtemp	t3	MyISAM	1
test	t2	MyISAM	0
test	t1	MyISAM	4
drop table showtemp.t2;
drop table t1;
select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
table_schema	table_name	engine	table_rows
showtemp	t3	MyISAM	1
test	t2	MyISAM	0
test	t1	MyISAM	4
drop table t1, t2;
drop table showtemp.t3;
drop database showtemp;
