This document discusses using WHERE clauses in SQL queries to filter records based on certain conditions in one or more tables. It provides 15 examples of queries using operators like =, >, <, IN, BETWEEN and logical AND/OR to select records matching criteria on columns like department, salary, hire date, job and employee name.
This document discusses using WHERE clauses in SQL queries to filter records based on certain conditions in one or more tables. It provides 15 examples of queries using operators like =, >, <, IN, BETWEEN and logical AND/OR to select records matching criteria on columns like department, salary, hire date, job and employee name.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
This document discusses using WHERE clauses in SQL queries to filter records based on certain conditions in one or more tables. It provides 15 examples of queries using operators like =, >, <, IN, BETWEEN and logical AND/OR to select records matching criteria on columns like department, salary, hire date, job and employee name.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
From <tab1>, <tab2> … WHERE <condition> [ORDER BY <col1>[asc/desc],<col2>[asc/desc],…………];
Queries:
1. Display details of employees who are working in dept 10?
2. Display details of employees who are receiving salary more than 2000? 3. Display smith employee details? 4. Display detail of employees who joined after 1982 year? 5. Display details of employees who are working in deptno 20 as a clerk and receiving Sal more than 1000? 6. Display details of employees who joined in the year 1981? 7. Display detail of employees who are not receiving commission? 8. Display details of employees who are working under some manager? 9. Display empno, ename, job, salary, sal*12 as ann_sal, deptno of all employees whose annual salary is more than 20000? 10. Display empno, ename, hiredate, experience and deptno of all employees whose experience is more than 18 years? 11. Display details of employees who are working in deptno 20 and 30w as a salesman and joined in the year 1981 and receiving salary not less than 1000 and receiving some comm. And working under some manager in the ascending order of deptno and descending order of salary? 12. Display details of employees who are working in dept 10, 20 and 40(IN OPERATOR)? 13. Display SMITH, BLAKE, ALLEN employee details?(IN OPERATOR) 14. Display MGR, ANALYST, CLERK employee details?(IN OPERATOR) 15. Display details of employees whose salaries ranging from 2000 to 4000? (BETWEEN OPERATOR)?