运算符
算术运算符
SELECT 1+1,2*4,3/8;
SELECT 3/0;
SELECT 1+'3MAIZI';
SELECT 4 DIV 2;
SELECT 3%8;
SELECT 3 MOD 8;
比较运算符
SELECT 1=1,1='1',1=2;
SELECT username,username='hj' FROM student;
SELECT id,username,sex,age,age<=>NULL FROM user;
SELECT id,username,score,score>=70 FROM student;
SELECT id,username,sex,age,age IS NULL FROM user;
SELECT id,username,age,age BETWEEN 10 AND 30 FROM user;
SELECT id,username,age,age IN(21,31,11);
SELECT id,username,username LIKE '____' FROM user;
SELECT id,username,username REGEXP '^T' FROM user;
逻辑运算符
SELECT 2&&2,2&&0,2&&NULL,1||1,1||0,1||NULL,0||NULL;
SELECT NULL||1;
SELECT !1,!0,!NULL;
SELECT 1 XOR 0,0 XOR 1,1 XOR 1,0 XOR 0;
优先级运算符
函数
数学函数
SELECT CEIL(1.2);
SELECT num1,CEIL(num2),CEIL(num3) FROM test4;
SELECT FLOOR(3.14 );
SELECT MOD(3,8);
SELECT POWER(2,3);
SELECT ROUND(3.1234,2);
SELECT TRUNCATE(3.14567,2);