Skip to Content
Head First SQL
book

Head First SQL

by Lynn Beighley
August 2007
Beginner to intermediate
608 pages
13h 12m
English
O'Reilly Media, Inc.
Content preview from Head First SQL

Chapter 3. DELETE and UPDATE: A change will do you good

image with no caption

Keep changing your mind? Now it’s OK! With the commands you’re about to learn—DELETE and UPDATE—you’re no longer stuck with a decision you made six months ago, when you first inserted that data about mullets coming back into style soon. With UPDATE, you can change data, and DELETE lets you get rid of data that you don’t need anymore. But we’re not just giving you the tools; in this chapter, you’ll learn how to be selective with your new powers and avoid dumping data that you really do need.

Clowns are scary

Suppose we want to keep track of the clowns in Dataville. We could create a clown_info table to track them. And we could use a last_seen column to keep track of the clowns’ whereabouts.

image with no caption

Clown tracking

Here’s our table. We can leave out information we don’t know and fill it in later. Every time we have a new clown sighting, we can add a new row. We’ll have to change this table frequently to keep it up to date.

image with no caption
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Head First SQL, 2nd Edition

Head First SQL, 2nd Edition

Kimberly Fessel
Learning SQL

Learning SQL

Ben Forta
Practical SQL

Practical SQL

Anthony DeBarros

Publisher Resources

ISBN: 9780596526849Supplemental ContentErrata Page