1 00:00:00,060 --> 00:00:05,460 One rule of thumb that I like to share with students is just to be careful with what you're updating 2 00:00:05,460 --> 00:00:06,410 in general, right? 3 00:00:06,450 --> 00:00:12,030 You can do these mass updates and change everything in a table, which could be useful sometimes, but 4 00:00:12,030 --> 00:00:14,160 a lot of the time it's actually accidental. 5 00:00:14,160 --> 00:00:20,220 So to prevent any unexpected updates, I recommend that you select whatever you're trying to update 6 00:00:20,220 --> 00:00:22,980 before you actually perform the update. 7 00:00:23,160 --> 00:00:31,800 So if we go back to something like what we had right here, I updated cats to set age to be 14 where 8 00:00:31,800 --> 00:00:33,450 name is set to Misty. 9 00:00:33,930 --> 00:00:37,320 I could just trust that this is going to select what I expect. 10 00:00:37,320 --> 00:00:42,330 But maybe there's more than one cat called Misty and I don't want to have them both update to have their 11 00:00:42,330 --> 00:00:43,620 age set to 14. 12 00:00:43,620 --> 00:00:46,170 I mean, maybe they have the same birthday on the same day. 13 00:00:46,170 --> 00:00:52,980 But if that's not what I'm anticipating, it's best to try the query out and try this way or portion 14 00:00:52,980 --> 00:00:55,080 out before I update anything. 15 00:00:55,080 --> 00:01:00,000 So I could just copy that and then try doing instead of select star from cats. 16 00:01:00,000 --> 00:01:03,900 Especially if I have like thousands of cats, select star from cats. 17 00:01:03,900 --> 00:01:05,099 Add my query. 18 00:01:05,780 --> 00:01:06,950 The where portions. 19 00:01:06,950 --> 00:01:12,290 It's not actually a full query, but at this where clause at the end and make sure this is what I want 20 00:01:12,290 --> 00:01:14,140 to target with my update. 21 00:01:14,150 --> 00:01:20,750 And if it is, then I go ahead and run that query, update it to have age 14, age was already set to 22 00:01:20,750 --> 00:01:22,700 14 for that row, so it doesn't really matter. 23 00:01:22,700 --> 00:01:27,770 But the point is that instead of just diving right into an update and the same will go for a deletion 24 00:01:27,770 --> 00:01:32,930 as well when we get there, I recommend selecting testing out your WHERE clause. 25 00:01:32,930 --> 00:01:38,360 Make sure you're getting the data you're expecting to update or you're expecting to to delete before 26 00:01:38,360 --> 00:01:40,130 you perform those operations. 27 00:01:40,130 --> 00:01:43,910 You don't always have to do that, but it's just something I recommend, especially when you're learning 28 00:01:43,910 --> 00:01:44,420 SQL.