A-level Computing/AQA/Paper 2/Fundamentals of databases/UPDATE





Database aren't always perfect and there may be times that we want to change the data inside our database. For example in Facebook if someone is annoying you and you limit their access to your profile, you'd update the access field from 'normal' to 'restricted'. Or if one of our crooks gets an additional scar you'd have to update the numScars field. Let's take a look at that example, where our crook Peter gains a scar on his right cheek. This was his initial state: name: Peter numScars: 7 But we have a problem here, this statement updates all records to numScars = 8. This means that every crook will now have 8 scars!

We need to specify which crooks we want to update by using a WHERE clause, you saw it earlier in the SELECT example.