1
drop table if exists t1,t2;
2
drop view if exists v1;
3
CREATE TABLE t1 (c int not null, d char (10) not null);
4
insert into t1 values(1,""),(2,"a"),(3,"b");
5
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
6
insert into t1 values(4,"e"),(5,"f"),(6,"g");
7
alter table t1 rename t2;
18
CREATE TABLE t2 (x int not null, y int not null);
19
alter table t2 rename t1;
25
create TEMPORARY TABLE t2 engine=heap select * from t1;
26
create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
28
Note 1050 Table 't2' already exists
29
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
30
ERROR 42S01: Table 't1' already exists
31
ALTER TABLE t1 RENAME t2;
32
ERROR 42S01: Table 't2' already exists
38
alter table t2 add primary key (a,b);
46
create temporary table t1 select *,2 as "e" from t1;
54
CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
55
INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
56
SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
57
CONCAT_WS(pkCrash, strCrash)
60
create temporary table t1 select 1 as 'x';
62
CREATE TABLE t1 (x INT);
63
INSERT INTO t1 VALUES (1), (2), (3);
64
CREATE TEMPORARY TABLE tmp SELECT *, NULL FROM t1;
66
create temporary table t1 (id int(10) not null unique);
67
create temporary table t2 (id int(10) not null primary key,
68
val int(10) not null);
69
insert into t1 values (1),(2),(4);
70
insert into t2 values (1,1),(2,1),(3,1),(4,2);
71
select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
72
id val elt(two.val,'one','two')
77
create temporary table t1 (a int not null);
78
insert into t1 values (1),(1);
79
alter table t1 add primary key (a);
80
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
83
d datetime default NULL
85
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');
87
select * from t1 group by d;
98
show status like "created_tmp%tables";
100
Created_tmp_disk_tables 0
103
create temporary table v1 as select 'This is temp. table' A;
104
create view v1 as select 'This is view' A;
108
show create table v1;
110
v1 CREATE TEMPORARY TABLE `v1` (
111
`A` varchar(19) NOT NULL DEFAULT ''
112
) ENGINE=MyISAM DEFAULT CHARSET=latin1
114
View Create View character_set_client collation_connection
115
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'This is view' AS `A` latin1 latin1_swedish_ci
120
create view v1 as select 'This is view again' A;
129
create table t1 (a int, b int, index(a), index(b));
130
create table t2 (c int auto_increment, d varchar(255), primary key (c));
131
insert into t1 values (3,1),(3,2);
132
insert into t2 values (NULL, 'foo'), (NULL, 'bar');
133
select d, c from t1 left join t2 on b = c where a = 3 order by d;
138
DROP TABLE IF EXISTS t1;
139
CREATE TABLE t1 (i INT);
141
CREATE TEMPORARY TABLE t1 (i INT);
142
The following command should not block
143
DROP TEMPORARY TABLE t1;
145
CREATE TABLE t1 (i INT);
146
CREATE TEMPORARY TABLE t2 (i INT);
147
DROP TEMPORARY TABLE t2, t1;
148
ERROR 42S02: Unknown table 't1'
150
ERROR 42S02: Table 'test.t2' doesn't exist
155
CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
156
INSERT INTO t1 VALUES( 12139 );
157
CREATE TABLE t2 ( c FLOAT(30,18) );
158
INSERT INTO t2 VALUES( 123456 );
159
SELECT AVG( c ) FROM t1 UNION SELECT 1;
163
SELECT 1 UNION SELECT AVG( c ) FROM t1;
167
SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
171
SELECT c/1 FROM t1 UNION SELECT 1;
176
create temporary table t1 (a int);
177
insert into t1 values (4711);
182
insert into t1 values (42);
187
CREATE TEMPORARY TABLE t1(a INT, b VARCHAR(20));
188
INSERT INTO t1 VALUES(1, 'val1'), (2, 'val2'), (3, 'val3');
189
DELETE FROM t1 WHERE a=1;
190
SELECT count(*) FROM t1;