O'Reilly logo

Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts by John Adolph Palinski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Limiting the Database Records Retrieved

A simple query retrieves all of the records in the table(s). Most queries require the developer to identify conditions that limit the records retrieved by the SELECT statement. These conditions are placed in the WHERE clause. Listing 4.6 illustrates a query of the Employee table that retrieves only the employee records for the Welfare department.

Listing 4.6. Using the WHERE Clause to Select Welfare Department Employees
 SQL> select fk_department, last_name, first_name 2 from employee 3 where fk_department = 'WEL'; FK_D LAST_NAME FIRST_NAME ---- --------------- --------------- WEL HOOVER HERBERT WEL TAFT WILLIAM WEL ANTHONY SUSANNE WEL ROOSEVELT ELEANOR WEL REAGAN RONALD WEL CARTER JIMMY 6 rows selected. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required