Fantastic! You already know how to insert data with
NULLs. You can also use
Suppose the teacher made a mistake. Tom Muller wrote the written exam but the teacher hasn't checked this exam (exam ID of
17). Nevertheless, Tom has the score of the written exam (
WrittenExamScore) and the date (
WrittenScoreDate), but he shouldn't. In this case, the only known value is the actual date of the written exam. The other two values you must move. How would you do this?
It's simple! Look at the command below:
SET WrittenExamScore = NULL, WrittenScoreDate = NULL
WHERE Id = 17;
SET, we used two comma-separated column names to update
WrittenScoreDate. Each column was assigned
NULL. In the
WHERE condition, we update only the exam with
Id = 17. In this way, we correct our mistake.