Let's say that we've made a mistake with the attendance of Olivia
in the Chemistry course. We had originally thought she attended 80
courses but she actually went to 60
.
What do we do now? Well, if you were the administrator working on a spreadsheet, you would remove 80
and write 60
instead. In other words, you would update the record. For this purpose, the UPDATE
statement is used. We can use the following query:
1UPDATE Class SET Attendance = 60 WHERE StudentName= 'Olivia';
The above query will generate the following table:

Now let's say Olivia has left the class entirely. We no longer need her attendance record. In this case, you'll have to delete her record. Let's use the DELETE statement to delete Olivia's row completely.
1DELETE FROM Class WHERE StudentName= 'Olivia';
It will return the following table:

Note that you can also remove all records from a table using the query given below:
1DELETE FROM Class;