48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | drop table if exists t1; | ||
|  | create table t1 (time time, date date, timestamp timestamp, | ||
|  | quarter int, week int, year int, timestampadd int, timestampdiff int); | ||
|  | insert into t1 values ("12:22:22","97:02:03","1997-01-02",1,2,3,4,5); | ||
|  | select * from t1; | ||
|  | time	date	timestamp	quarter	week	year	timestampadd	timestampdiff | ||
|  | 12:22:22	1997-02-03	1997-01-02 00:00:00	1	2	3	4	5 | ||
|  | select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time), | ||
|  | t1.quarter+t1.week, t1.year+timestampadd,  timestampdiff from t1; | ||
|  | t1.time+0	t1.date+0	t1.timestamp+0	concat(date," ",time)	t1.quarter+t1.week	t1.year+timestampadd	timestampdiff | ||
|  | 122222	19970203	19970102000000	1997-02-03 12:22:22	3	7	5 | ||
|  | drop table t1; | ||
|  | create table events(binlog int); | ||
|  | insert into events values(1); | ||
|  | select events.binlog from events; | ||
|  | binlog | ||
|  | 1 | ||
|  | drop table events; | ||
|  | create procedure p1() | ||
|  | begin | ||
|  | declare n int default 2; | ||
|  | authors: while n > 0 do | ||
|  | set n = n -1; | ||
|  | end while authors; | ||
|  | end| | ||
|  | create procedure p2() | ||
|  | begin | ||
|  | declare n int default 2; | ||
|  | contributors: while n > 0 do | ||
|  | set n = n -1; | ||
|  | end while contributors; | ||
|  | end| | ||
|  | drop procedure p1; | ||
|  | drop procedure p2; | ||
|  | create table t1 (connection int, b int); | ||
|  | create procedure p1() | ||
|  | begin | ||
|  | declare connection int; | ||
|  | select max(t1.connection) into connection from t1; | ||
|  | select concat("max=",connection) 'p1'; | ||
|  | end| | ||
|  | insert into t1 (connection) values (1); | ||
|  | call p1(); | ||
|  | p1 | ||
|  | max=1 | ||
|  | drop procedure p1; | ||
|  | drop table t1; |