~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/select.result

Merge in Stewart's FK work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1266
1266
58      company 8
1267
1267
65      company 9
1268
1268
68      company 10
1269
 
select * from t1 CROSS JOIN t1 t12;
 
1269
select * from t1,t1 t12;
1270
1270
Period  Varor_period    Period  Varor_period
1271
1271
9410    9412    9410    9412
1272
1272
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
1273
1273
fld1    fld1
1274
1274
250501  250501
 
1275
250502  250501
 
1276
250503  250501
 
1277
250504  250501
 
1278
250505  250501
1275
1279
250501  250502
 
1280
250502  250502
 
1281
250503  250502
 
1282
250504  250502
 
1283
250505  250502
1276
1284
250501  250503
 
1285
250502  250503
 
1286
250503  250503
 
1287
250504  250503
 
1288
250505  250503
1277
1289
250501  250504
 
1290
250502  250504
 
1291
250503  250504
 
1292
250504  250504
 
1293
250505  250504
1278
1294
250501  250505
1279
 
250502  250501
1280
 
250502  250502
1281
 
250502  250503
1282
 
250502  250504
1283
1295
250502  250505
1284
 
250503  250501
1285
 
250503  250502
1286
 
250503  250503
1287
 
250503  250504
1288
1296
250503  250505
1289
 
250504  250501
1290
 
250504  250502
1291
 
250504  250503
1292
 
250504  250504
1293
1297
250504  250505
1294
 
250505  250501
1295
 
250505  250502
1296
 
250505  250503
1297
 
250505  250504
1298
1298
250505  250505
1299
1299
insert into t2 (fld1, companynr) values (999999,99);
1300
1300
select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
1903
1903
select max(t2nr) from t3 where price=983543950;
1904
1904
max(t2nr)
1905
1905
41807
 
1906
select t1.period from t3 = t1 limit 1;
 
1907
period
 
1908
1001
1906
1909
select t1.period from t1 as t1 limit 1;
1907
1910
period
1908
1911
9410
2011
2014
select * from (t1 as t2 left join t1 as t3 using (a)), t1;
2012
2015
a       a
2013
2016
1       1
 
2017
2       1
 
2018
3       1
2014
2019
1       2
 
2020
2       2
 
2021
3       2
2015
2022
1       3
2016
 
2       1
2017
 
2       2
2018
2023
2       3
2019
 
3       1
2020
 
3       2
2021
2024
3       3
2022
2025
select * from t1, (t1 as t2 left join t1 as t3 using (a));
2023
2026
a       a
2815
2818
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
2816
2819
(4,'2005-10-01'),(5,'2005-12-30');
2817
2820
select * from t1 where f2 >= 0            order by f2;
2818
 
ERROR HY000: Received an invalid DATE value '0'.
 
2821
ERROR HY000: Received an invalid datetime value '0'.
2819
2822
select * from t1 where f2 >= '0000-00-00' order by f2;
2820
2823
ERROR HY000: Received an invalid datetime value '0000-00-00'.
2821
2824
select * from t1 where f2 >= '2005-09-31' order by f2;
2929
2932
create table t1 (a int);
2930
2933
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
2931
2934
create table t2 (a int, b int, c int, e int, primary key(a,b,c));
2932
 
insert into t2 select A.a, B.a, C.a, C.a from t1 A CROSS JOIN t1 B CROSS JOIN t1 C;
 
2935
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
2933
2936
analyze table t2;
2934
2937
Table   Op      Msg_type        Msg_text
2935
2938
test.t2 analyze status  OK
2949
2952
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
2950
2953
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
2951
2954
1       SIMPLE  t1      range   PRIMARY,b       b       5       NULL    3       Using where; Using index
2952
 
1       SIMPLE  t2      ref     c       c       5       test.t1.a       1       Using where
 
2955
1       SIMPLE  t2      ref     c       c       5       test.t1.a       1       
2953
2956
EXPLAIN
2954
2957
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
2955
2958
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
2956
2959
1       SIMPLE  t1      range   PRIMARY,b       b       5       NULL    3       Using where; Using index
2957
 
1       SIMPLE  t2      ref     c       c       5       test.t1.a       1       Using where
 
2960
1       SIMPLE  t2      ref     c       c       5       test.t1.a       1       
2958
2961
DROP TABLE t1, t2;
2959
2962
create table t1 (
2960
2963
a int    not null auto_increment primary key,
2990
2993
EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1;
2991
2994
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
2992
2995
1       SIMPLE  t1      const   PRIMARY PRIMARY 4       const   1       
2993
 
1       SIMPLE  t2      ref     idx     idx     4       const   8       Using index
 
2996
1       SIMPLE  t2      ref     idx     idx     4       const   7       Using index
2994
2997
EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4;
2995
2998
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
2996
2999
1       SIMPLE  t1      const   PRIMARY PRIMARY 4       const   1       
3008
3011
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
3009
3012
1       SIMPLE  t1      const   PRIMARY PRIMARY 4       const   1       
3010
3013
1       SIMPLE  t2      const   idx1    NULL    NULL    NULL    1       
3011
 
1       SIMPLE  t3      ALL     idx1    NULL    NULL    NULL    5       Using where
 
3014
1       SIMPLE  t3      ref     idx1    idx1    5       const   2       
3012
3015
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
3013
3016
WHERE t1.id=2;
3014
3017
id      a       b       c       d       e
3222
3225
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
3223
3226
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
3224
3227
1       SIMPLE  t2      const   PRIMARY PRIMARY 4       const   1       
3225
 
1       SIMPLE  t1      range   ts      ts      9       NULL    2       Using where
 
3228
1       SIMPLE  t1      range   ts      ts      5       NULL    1       Using where
3226
3229
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
3227
3230
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
3228
3231
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
3247
3250
show create table t1;
3248
3251
Table   Create Table
3249
3252
t1      CREATE TABLE `t1` (
3250
 
  `i` DECIMAL(19,0) NOT NULL,
3251
 
  `c` DECIMAL(19,0) NOT NULL,
3252
 
  `co` DECIMAL(19,0) NOT NULL
3253
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
3253
  `i` decimal(19,0) NOT NULL,
 
3254
  `c` decimal(19,0) NOT NULL,
 
3255
  `co` decimal(19,0) NOT NULL
 
3256
) ENGINE=InnoDB
3254
3257
drop table t1;
3255
3258
select 
3256
3259
if(1, 1111111111111111111, 1) i,
3552
3555
c34 INT DEFAULT 0,
3553
3556
KEY (c33, c34, c32));
3554
3557
INSERT INTO t1 values (),(),(),(),();
3555
 
INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a CROSS JOIN t1 b;
 
3558
INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
3556
3559
INSERT INTO t3 VALUES (1, 1, 1, 0), 
3557
3560
(2, 2, 0, 0), 
3558
3561
(3, 3, 1, 0),