逻辑运算符:
and, or, not
&&, ||, !
Copy to clipboardErrorCopied
案例1:查询工资在10000-20000之间的员工名、工资、奖金
SELECT
`last_name` AS 名字,
`salary` AS 工资,
IFNULL(commission_pct, 0) AS 奖金率
FROM
employees
WHERE
salary >= 10000 AND salary <= 20000;
案例2:查询部门编号不是在90到110之间,或者工资高于15000的员工信息
USE myemployees;
SELECT
*
FROM
employees
WHERE
department_id < 90 OR department_id > 110 OR salary > 15000