SQL语句,当WHERE条件需要搜索工号为16或工号为2的雇员姓名时,需用到OR关键词如:
SELECT [EmployeeName] FROM [Employee] WHERE [WorkNumber] = 16 OR [WorkNumber] = 2
但是,上面SQL语句会涉及效率与性能问题,因为重写上面SQL语句:
SELECT [EmployeeName] FROM [Employee] WHERE [WorkNumber] = 16
UNION ALL
SELECT [EmployeeName] FROM [Employee] WHERE [WorkNumber] = 2