Advertisements
Advertisements
Question
Compare the output produced by the query in example 8.6 and the following query and differentiate between the OR and AND operators.
SELECT *
FROM EMPLOYEE
WHERE Salary > 5000 OR
DeptId= 20;Code Writing
Advertisements
Solution
SELECT *
FROM EMPLOYEE
WHERE Salary > 5000 OR DeptId = 20;
Comparison between AND and OR
| Operator | Output |
|---|---|
| AND | Displays only those employees who satisfy both conditions: Salary > 5000 and DeptId = 20. |
| OR | Displays employees who satisfy at least one condition: Salary > 5000 or DeptId = 20, or both. |
shaalaa.com
Is there an error in this question or solution?
