Cover by Lynn Beighley

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

O'Reilly logo

Chapter 11. Constraints, Views, and Transactions: Too many cooks spoil the database

image with no caption

Your database has grown, and other people need to use it. The problem is that some of them won’t be as skilled at SQL as you are. You need ways to keep them from entering the wrong data, techniques for allowing them to only see part of the data, and ways to stop them from stepping on each other when they try entering data at the same time. In this chapter we begin protecting our data from the mistakes of others. Welcome to Defensive Databases, Part 1.

Greg’s hired some help

Greg has hired two people to help him manage his growing business. Jim’s going to handle entering new clients into the database, while Frank’s in charge of matching people up to prospective jobs.

Greg has spent some time explaining his database to them and describing what each table does.

image with no caption
image with no caption

Jim’s first day: Inserting a new client

Jim’s sitting in his new cubicle and gets an IM from Greg:

image with no caption

Brain Power

Can you write the queries to insert this new person into the database?

Jim avoids a NULL

As he’s entering the data, Jim realizes that he doesn’t know ...

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