在MySQL数据库中,OR运算符用于在WHERE子句中指定多个条件,只要任一条件满足,结果集就会返回相应的记录。以下是一个查询示例:
SELECT employee_id, last_name, job_id, salary
FROM employees
WHERE salary >= 1100 OR job_id = 'CLERK';
查询结果:
| EMPLOYEE_ID | LAST_NAME | JOB_ID | SALARY |
|-------------|-----------|-----------|--------|
| 7839 | KING | PRESIDENT | 5000 |
| 7698 | BLAKE | MANAGER | 2850 |
| 7782 | CLARK | MANAGER | 2450 |
| 7566 | JONES | MANAGER | 2975 |
| 7654 | MARTIN | SALESMAN | 1250 |
...共计14条记录返回。