条件查询
查询月薪>5000的员工信息
select * from employees where salary > 5000;
查询月薪=12000的员工信息
select * from employees where salary = 12000;
查询月薪不等于12000的员工信息
select * from employees where salary <> 12000;
查询没有奖金的员工名
select * from employees where commission_pct<=>null;
查询月薪在5000到12000的员工工资和姓名
select * from employees where salary >= 5000 and salary <= 12000;select * from employees where salary between 5000 and 12000;
查询月薪不在5000到12000的员工工资和姓名
select last_name,first_name from employees where not (salary >= 5000 and salary <= 12000);
查询部门编号=90 或 月薪>10000并且月薪<15000的员工信息
select * from employees where department_id = 90 or( salary > 10000 and salary < 15000);
生成随机数
SELECT CEIL(RAND()*30);