home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / mysql-test / t / binary.test < prev    next >
Encoding:
Text File  |  2003-01-21  |  1.3 KB  |  44 lines  |  [TEXT/ttxt]

  1. #
  2. # test sort,min and max on binary fields
  3. #
  4.  
  5. create table t1 (name char(20) not null, primary key (name));
  6. create table t2 (name char(20) binary not null, primary key (name));
  7. insert into t1 values ("Â");
  8. insert into t1 values ("‰");
  9. insert into t1 values ("ˆ");
  10. insert into t2 select * from t1;
  11.  
  12. select * from t1 order by name;
  13. select concat("*",name,"*") from t1 order by 1;
  14. select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
  15. select * from t2 order by name;
  16. select concat("*",name,"*") from t2 order by 1;
  17. select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
  18. select name from t1 where name between 'ƒ' and '÷';
  19. select name from t2 where name between '‰' and 'ˆ';
  20. select name from t2 where name between 'ƒ' and '÷';
  21.  
  22. drop table t1,t2;
  23.  
  24. #
  25. # Test of binary and normal strings
  26. #
  27.  
  28. create table t1 (a char(10) not null, b char(10) binary not null,index (a));
  29. insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
  30. select * from t1 where a="hello ";
  31. select * from t1 where b="hello ";
  32. select * from t1 where b="hello";
  33. drop table t1;
  34.  
  35. #
  36. # Test of binary and NULL
  37. #
  38. create table t1 (b char(8));
  39. insert into t1 values(NULL);
  40. select b from t1 where binary b like '';
  41. select b from t1 group by binary b like '';
  42. select b from t1 having binary b like '';
  43. drop table t1;
  44.