One rule of thumb that I like to share with students is just to be careful with what you're updating
in general, right?
You can do these mass updates and change everything in a table, which could be useful sometimes, but
a lot of the time it's actually accidental.
So to prevent any unexpected updates, I recommend that you select whatever you're trying to update
before you actually perform the update.
So if we go back to something like what we had right here, I updated cats to set age to be 14 where
name is set to Misty.
I could just trust that this is going to select what I expect.
But maybe there's more than one cat called Misty and I don't want to have them both update to have their
age set to 14.
I mean, maybe they have the same birthday on the same day.
But if that's not what I'm anticipating, it's best to try the query out and try this way or portion
out before I update anything.
So I could just copy that and then try doing instead of select star from cats.
Especially if I have like thousands of cats, select star from cats.
Add my query.
The where portions.
It's not actually a full query, but at this where clause at the end and make sure this is what I want
to target with my update.
And if it is, then I go ahead and run that query, update it to have age 14, age was already set to
14 for that row, so it doesn't really matter.
But the point is that instead of just diving right into an update and the same will go for a deletion
as well when we get there, I recommend selecting testing out your WHERE clause.
Make sure you're getting the data you're expecting to update or you're expecting to to delete before
you perform those operations.
You don't always have to do that, but it's just something I recommend, especially when you're learning
SQL.