Lecture 13 - Restricting Rows and Sorting
Lecture 13 - Restricting Rows and Sorting
Systems
Subject Teacher: Zartasha Baloch
2
Disclaimer: The material used in this presentation to deliver the lecture i.e., definitions/text and pictures/graphs etc. does
not solely belong to the author/presenter. The presenter has gathered this lecture material from various sources on
web/textbooks. Following sources are especially acknowledged:
1. Connolly, Thomas M., and Carolyn E. Begg. Database systems: a practical approach to design, implementation, and management. Pearson
Education, 2005.
2. Gorman,Tim, Inger Jorgensen, Melanie Caffrey, and Lex deHaan. Beginning Oracle SQL: For Oracle Database 12c.Apress, 2014.
3. Greenberg, Nancy, and Instructor Guide PriyaNathan. "Introduction to Oracle9i: SQL." ORACLE, USA (2001).
Objectives
EMPLOYEES
“retrieve all
employees
in department 90”
Limiting the Rows Selected
Operator Meaning
= Equal to
Operator Meaning
SELECT first_name
FROM employees
WHERE first_name LIKE 'S%';
Using the LIKE Condition
SELECT last_name
FROM employees
WHERE last_name LIKE '_o%';
You can use the ESCAPE identifier to search for the actual %
and _ symbols.
Using the NULL Conditions
Operator Meaning
…
Sorting in Descending Order
…
Sorting by Column Alias
SELECT employee_id, last_name, salary*12 annsal
FROM employees
ORDER BY annsal;
…
Sorting by Multiple Columns
The order of ORDER BY list is the order of sort.
…
You can sort by a column that is not in the SELECT list.
Summary