IF
IF a > 1 Then SELECT "大于1"
END IF
IF age > 60 THEN select '老人'
ELSEIF age > 20 THEN select '青年'
ELSE select '少年'
END IF
CASE
CASE 1
WHEN 1 THEN select id from test
WHEN 2 THEN select age from test
WHEN 3 THEN select name from test
ELSE select count(*) from test
END
CASE
WHEN a > 60 THEN select 'a'
WHEN a > 40 THEN select 'b'
ELSE SELECT 'c'
END
LOOP
declare num int default 1;
my_label : loop
set num = num+1;
if num > 10 then leave my_label;
end if;
end loop;
WHILE
declare num int default 1;
while num < 10 do
set num = num + 1;
end while;
REPEAT
declare num int default 1;
repeat
set num = num + 1;
until num > 10;
end repeat;