Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Default values
Summary
10. Summary

Instruction

Great! We've reached the final section for this part. Let's review what we've learned.

A database architect can define a default value for a column in a table. If that's the case, you can use the default value:

  • In an INSERT statement:
  • INSERT INTO author (id, first_name, last_name, photo, create_timestamp, is_active) 
    VALUES (120, 'Gary', 'Brown', 'imgs/gary.jpg', '2018-08-25', DEFAULT);
  • By omitting columns in INSERT:
  • INSERT INTO author (id, first_name, last_name) 
    VALUES (121, 'Mary', 'Taylor');
  • During an UPDATE operation:
  • UPDATE author
    photo = DEFAULT
    WHERE id = 120;

Exercise

Well done! You've completed Part 3 and learned the various ways in which SQL can automatically generate values.

Click Next exercise to finish this part.