4. Selecting ROWS to display

Worksheet Overview

Usually there are far too many rows to be displayed. One way to restrict the output is to show only selected rows.

We restrict which rows are displayed with the WHERE clause. In this clause, we can put a condition to describe those rows of interest:

Contents

1. Demo: List the data for employees in department 10
2. Task: List the data for employees in department 20
3. Task: List the data for employees managed by employee number 7698;
4. Demo: String comparison
5. Task: List the data for the Analysts
6. Demo: NULL fields
7. Task: List the data for the employees who do not have a manager.
8. Demo: Complex expressions
9. Task: List the names of Analysts in Department 10.
10. Task: List the names of all Analysts and the Managers in Department 30.
11. Demo: List the names of Analysts and Managers in Department 20 and 30.
12. Task: List the employee numbers of employees called JONES, SMITH and BLAKE .
13. Task: Show the details of all Employees who have a salary greater than 2000.
14. Task: List the name and salary of Clerks who earn between 900 and 1000.
15. Task: List the names and department numbers of employees who do NOT work in department 20.
16. Demo: LIKE operator
17. Task: Find the names of all employees with an 'S' in their name.
18. Task: Find the names of all employees whose name begins with 'J'.
19. Task: Find the names of all employees whose name ends with an 'S'.
20. Demo: Duplicate and Unique rows
21. Demo: Show distinct department numbers in the emp table.
22. Task: List the (distinct) jobs that employees do
23. Task: List the employee numbers of all the managers (1).
24. Task: List the employee numbers of all the managers(2).
25. Read: Completed

Related worksheets

1. Introduction to the Emp-dept case study
2. Some simple SQL Select statements
3. Using Functions
5. Multiple tables
6. Summarising and Grouping
7. Handling Dates
8. Inner and Outer Joins