Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Inserting and updating NULLs
Conditions in UPDATE and DELETE
Updating the list of columns in one query
Using values from another column
Return rows in INSERT, UPDATE, DELETE
Summary
20. Summary

Instruction

Amazing! Let's summarize what we've learned.

We can:

  • Insert data using NULLs for unknown values in a row:
    INSERT INTO student VALUES
    (21, 'Tom', NULL, 'Muller');
    
  • Change values using NULL and UPDATE:
    UPDATE exam 
    SET written_exam_score = NULL
    WHERE id = 5;
    
  • Change a value in a column or delete a row if the column contains a NULL:
    UPDATE student
    SET last_name = 'unknown' 
    WHERE last_name IS NULL;
    DELETE FROM student 
    WHERE last_name IS NULL;
  • Update or delete using AND and OR to meet certain conditions:
    DELETE FROM exam 
    WHERE subject = 'Spanish' 
      AND (written_exam_score IS NULL 
        OR oral_exam_score IS NULL)

Exercise

Click Next exercise to finish this part.