20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

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

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

Chapter 12<br />

Summary<br />

Database security is a subject that simply cannot be ignored. The <strong>SQL</strong> standard contains statements<br />

designed to enforce privileges to use objects in the database, primarily tables and views but also other<br />

objects. This chapter covered the following topics:<br />

❑ <strong>SQL</strong> security centers around users (or user IDs) that can grant privileges on database objects<br />

such as tables and views.<br />

❑ Data in specific tables and views, and even columns of specific tables and views, should be<br />

available to some users but not available to others.<br />

❑ Views may be required to restrict access to specific columns in some DBMSs where an extension<br />

to the SELECT syntax is not available.<br />

❑ The GRANT statement grants SELECT, UPDATE, INSERT, and DELETE privileges to specific users.<br />

❑ The GRANT OPTION allows a user to extend the privileges she has been granted down the line to<br />

other users.<br />

❑ The REVOKE statement is used to revoke privileges granted to a user as well as revoke the GRANT<br />

OPTION itself.<br />

In the next chapter, you learn about optimizing your database and how to write efficient <strong>SQL</strong> queries to<br />

speed up data retrieval.<br />

Exercises<br />

1. Create DataEntry, Supervisor, and Management groups.<br />

2. Create users John, Joe, Fred, Lynn, Amy, and Beth.<br />

3. Add John, Joe, and Lynn to the DataEntry group, add Fred to the Supervisor group, and add<br />

Amy and Beth to the Management group.<br />

4. Give the DataEntry group SELECT, INSERT, and UPDATE privileges on the Attendance table.<br />

5. Give the Supervisor group SELECT and DELETE privileges on the Attendance table.<br />

6. Give the Management group SELECT privileges on the Attendance table.<br />

348

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

Saved successfully!

Ooh no, something went wrong!