01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

40<br />

CHAPTER 2 SQL AND PL/SQL<br />

S<strong>to</strong>ring programs in the database has many advantages. Special PL/SQL programs<br />

called triggers can be executed whenever a user performs a specified action. This gives<br />

us the ability <strong>to</strong> enforce business rules, control access <strong>to</strong> data, and keep records of who<br />

accessed the data and how it changed. S<strong>to</strong>ring sequences of commands in the database<br />

greatly reduces the amount of communication between client and server and thus<br />

improves efficiency. Also, PL/SQL functions can be utilized in SQL statements; this<br />

increases the power and flexibility of SQL.<br />

Much Ado About Suppliers<br />

This section provides SQL solutions for the queries listed in the “Exercises” section of<br />

Chapter 1. Other solutions exist; remember that most SQL statements can be written<br />

in various ways. In this chapter’s “Exercises” section, you will be asked <strong>to</strong> rewrite these<br />

statements without using query fac<strong>to</strong>ring and without using the opera<strong>to</strong>r.<br />

Parts That Are Supplied by All Suppliers<br />

The answer <strong>to</strong> this problem looks similar <strong>to</strong> the answer <strong>to</strong> the problem List the suppliers<br />

who supply all parts. All we have <strong>to</strong> do is <strong>to</strong> interchange the roles of suppliers and parts,<br />

as shown in Listing 2-22.<br />

Listing 2-22. Parts That Are Supplied by All Suppliers

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!