~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/select.test

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1332
1332
# If the like starts with a certain letter key will be used.
1333
1333
#
1334
1334
 
1335
 
--sorted_result
1336
1335
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
1337
1336
select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
1338
1337
select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
1349
1348
select distinct companynr from t2;
1350
1349
select distinct companynr from t2 order by companynr;
1351
1350
select distinct companynr from t2 order by companynr desc;
1352
 
--sorted_result
1353
1351
select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
1354
1352
 
1355
1353
select distinct fld3 from t2 where companynr = 34 order by fld3;
1356
 
# PBXT: because there is no ORDER BY with a LIMIT, these
1357
 
# statements return different results to those from innodb
1358
 
--sorted_result
1359
1354
select distinct fld3 from t2 limit 10;
1360
1355
select distinct fld3 from t2 having fld3 like "A%" limit 10;
1361
1356
select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
1362
1357
select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
1363
1358
select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
1364
 
--sorted_result
1365
1359
select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
1366
1360
 
1367
1361
# make a big table.
1417
1411
 
1418
1412
# big table done
1419
1413
 
 
1414
SET SQL_BIG_TABLES=1;
1420
1415
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
 
1416
SET SQL_BIG_TABLES=0;
1421
1417
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
1422
1418
select distinct fld5 from t2 limit 10;
1423
1419
 
1426
1422
#
1427
1423
 
1428
1424
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
 
1425
SET SQL_BIG_TABLES=1; # Force use of MyISAM
1429
1426
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
 
1427
SET SQL_BIG_TABLES=0;
1430
1428
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
1431
1429
 
1432
1430
#
1476
1474
# Search with a constant table and several rows from another table
1477
1475
#
1478
1476
 
1479
 
--sorted_result
1480
1477
select fld3,period from t2,t1 where companynr*10 = 37*10;
1481
1478
 
1482
1479
#
1834
1831
select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
1835
1832
select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
1836
1833
# inner join on
1837
 
--sorted_result
1838
1834
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
1839
1835
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
1840
1836
# inner join using
2979
2975
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL;
2980
2976
SELECT COUNT(*) FROM t1 WHERE ID_better=1;
2981
2977
 
2982
 
# PBXT: does not return a consistent row count
2983
 
--replace_column 9 #
2984
2978
EXPLAIN SELECT * FROM t1
2985
2979
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
2986
 
--replace_column 9 #
2987
2980
EXPLAIN SELECT * FROM t1
2988
2981
  WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
2989
 
--replace_column 9 #
2990
2982
EXPLAIN SELECT * FROM t1
2991
2983
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
2992
2984