1
drop table if exists t1,t2;
2
CREATE TABLE t1 (c int not null, d char (10) not null);
3
insert into t1 values(1,""),(2,"a"),(3,"b");
4
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
5
insert into t1 values(4,"e"),(5,"f"),(6,"g");
6
alter table t1 rename t2;
17
CREATE TABLE t2 (x int not null, y int not null);
18
alter table t2 rename t1;
24
create TEMPORARY TABLE t2 engine=MEMORY select * from t1;
25
create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=MEMORY;
27
Note 1050 Table 't2' already exists
28
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
29
ERROR 42S01: Table 'test.#t1' already exists
30
ALTER TABLE t1 RENAME t2;
31
ERROR 42S01: Table 'test.#t2' already exists
37
alter table t2 add primary key (a,b);
45
create temporary table t1 select *,2 as "e" from t1;
53
CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
54
INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
55
SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
56
CONCAT_WS(pkCrash, strCrash)
59
create temporary table t1 select 1 as 'x';
61
CREATE TABLE t1 (x INT);
62
INSERT INTO t1 VALUES (1), (2), (3);
63
CREATE TEMPORARY TABLE tmp SELECT *, NULL FROM t1;
65
create temporary table t1 (id int not null unique);
66
create temporary table t2 (id int not null primary key, val int not null);
67
insert into t1 values (1),(2),(4);
68
insert into t2 values (1,1),(2,1),(3,1),(4,2);
69
select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
70
id val elt(two.val,'one','two')
75
create temporary table t1 (a int not null);
76
insert into t1 values (1),(1);
77
alter table t1 add primary key (a);
78
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
80
CREATE TEMPORARY TABLE t1 (
81
d datetime default NULL
83
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
85
select * from t1 group by d;
96
show status like "created_tmp%tables";
98
Created_tmp_disk_tables #
101
create table t1 (a int, b int, index(a), index(b));
102
create table t2 (c int auto_increment, d varchar(255), primary key (c));
103
insert into t1 values (3,1),(3,2);
104
insert into t2 values (NULL, 'foo'), (NULL, 'bar');
105
select d, c from t1 left join t2 on b = c where a = 3 order by d;
110
CREATE TABLE t1 (i INT);
111
CREATE TEMPORARY TABLE t2 (i INT);
112
DROP TEMPORARY TABLE t2, t1;
113
ERROR 42S02: Unknown table 't1'
115
ERROR 42S02: Unknown table 'test.t2'
120
CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
121
INSERT INTO t1 VALUES( 12139 );
122
CREATE TABLE t2 ( c FLOAT(30,18) );
123
INSERT INTO t2 VALUES( 123456 );
124
SELECT AVG( c ) FROM t1 UNION SELECT 1;
128
SELECT 1 UNION SELECT AVG( c ) FROM t1;
132
SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
136
SELECT c/1 FROM t1 UNION SELECT 1;
141
create temporary table t1 (a int);
142
insert into t1 values (4711);
147
insert into t1 values (42);
152
CREATE TEMPORARY TABLE t1(a INT, b VARCHAR(20));
153
INSERT INTO t1 VALUES(1, 'val1'), (2, 'val2'), (3, 'val3');
154
DELETE FROM t1 WHERE a=1;
155
SELECT count(*) FROM t1;