61 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			SQL
		
	
	
	
	
	
| select count(*) from t1 where id not in (1,2);
 | |
| select count(*) from t1 where match a against ('000000');
 | |
| SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
 | |
| select count(*) from t1 where s1 < 0 or s1 is null;
 | |
| SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
 | |
| select count(*) from t1 where x < -16;
 | |
| select count(*) from t1 where x = -16;
 | |
| select count(*) from t1 where x > -16;
 | |
| select count(*) from t1 where x = 18446744073709551601;
 | |
| select truncate(5678.123451,6);
 | |
| select truncate(99999999999999999999999999999999999999,-31);
 | |
| select v/10;
 | |
| select uncompress("");
 | |
| SELECT UNHEX('G');
 | |
| select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
 | |
| select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++');
 | |
| select UpdateXML(@xml, '/a/@aa1', '');
 | |
| SELECT USER(),CURRENT_USER(),@@LOCAL.external_user;
 | |
| SELECT user(),current_user(),@@proxy_user;
 | |
| SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 | |
| select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
 | |
| select userid,count(*) from t1 group by userid desc having 3  IN (1,COUNT(*));
 | |
| select userid,count(*) from t1 group by userid desc having (count(*)+1) IN (4,3);
 | |
| SELECT user_id FROM t1 WHERE request_id=9999999999999;
 | |
| SELECT UserId FROM t1 WHERE UserId=22 group by Userid;
 | |
| select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
 | |
| select yearweek("2000-01-01",0) as '2000', yearweek("2001-01-01",0) as '2001', yearweek("2002-01-01",0) as '2002',yearweek("2003-01-01",0) as '2003', yearweek("2004-01-01",0) as '2004', yearweek("2005-01-01",0) as '2005', yearweek("2006-01-01",0) as '2006';
 | |
| select user() like "%@%";
 | |
| select user,password,plugin,authentication_string from mysql.user where user like 'foo%';
 | |
| select user, QUOTE(host) from mysql.user where user="mysqltest_8";
 | |
| SELECT UTC_DATE();
 | |
| select utext from t1 where utext like '%%';
 | |
| SELECT _utf32 0x10001=_utf32 0x10002;
 | |
| select _utf32'a' collate utf32_general_ci = 0xfffd;
 | |
| SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110';
 | |
| select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
 | |
| select _utf8'12' union select _latin1'12345';
 | |
| SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
 | |
| SELECT _utf8mb3'test';
 | |
| select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%');
 | |
| select (_utf8mb4 X'616263FF');
 | |
| SELECT _utf8'test' COLLATE utf8_5624_2;
 | |
| select (_utf8 X'616263FF');
 | |
| select uuid() into @my_uuid;
 | |
| SELECT v1.a, v2. b  FROM v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3)    GROUP BY v1.a;
 | |
| SELECT v1.f4 FROM v1  WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
 | |
| select v1.r_object_id, v2.users_names from v1, v2where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_idorder by users_names;
 | |
| SELECT v2 FROM t1 WHERE v1  IN  ('f', 'd', 'h', 'u' ) AND i  =  2;
 | |
| select "-- comment # followed by another comment" as "-- more comments";# this should be removed
 | |
| SELECT @@tx_isolation;
 | |
| select @ujis4 = CONVERT(@utf84 USING ujis);
 | |
| SELECT @user_var;
 | |
| select @v1def1, @v1def2, @v1def1=@v1def2;
 | |
| SELECT @v1, @v2;
 | |
| SELECT @v5, @v6, @v7, @v8, @v9, @v10;
 | |
| SELECT (@v:=a) <> (@v:=1) FROM t1;
 | |
| select @v, coercibility(@v);
 | |
| select @@version, @@version_comment, @@version_compile_machine,       @@version_compile_os;
 | |
| SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3;
 | |
| SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
 | 
