SELECT * FROM employees
WHERE email LIKE '%a%' OR department_id>90;
#等价
SELECT * FROM employees
WHERE email LIKE '%a%'
UNION
SELECT * FROM employees
WHERE department_id>90;
应用场景:要查询的结果来自于多个表,且多个表没有直接的连接关系,单查询的信息是 一致时
特点:列数一致,字段和顺序一致,
2024-03-02 14:00:10
SELECT * FROM employees
WHERE email LIKE '%a%' OR department_id>90;
#等价
SELECT * FROM employees
WHERE email LIKE '%a%'
UNION
SELECT * FROM employees
WHERE department_id>90;
应用场景:要查询的结果来自于多个表,且多个表没有直接的连接关系,单查询的信息是 一致时
特点:列数一致,字段和顺序一致,