Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Inserting and updating NULLs
Conditions in UPDATE and DELETE
Using values from another column
12. Change values between columns
Inserting data from a query


Oops… The English teacher just realized that she accidentally switched written_exam_score and oral_exam_score. The last UPDATE introduced another mistake to the exam table, again with all records for English exams. How can we correct this? Look at the query below:

  written_exam_score = oral_exam_score,
  oral_exam_score = written_exam_score
WHERE subject = 'English'

We set new values for two columns: written_exam_score and oral_exam_score. The first column took the value from oral_exam_score, and the second column took the value from written_exam_score. SQL makes this operation easy.


It's time to fix another mistake in our database. Somebody mistook the first name of the student whose ID is 6 for his last name. See if you can use the example query to correct this.