Chapter 3. DELETE and UPDATE: A change will do you good
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.
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.
Get Head First SQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.