4.2

The INSERT Clause Without a Column List

The INSERT Clause Without a Column List

  • You can INSERT single or multiple rows at a time.
  • An INSERT without a column list requires you to provide a value for very column.
  • You must list values in the same order that they appear on the table.
  • You must explicitly use the keyword “null” for columns that allow for nulls if you do not want to provide a value.
  • You must explicitly use the keyword “DEFAULT” for columns that provide a default value if you do not want to provide one.

Code Sample:

1    USE world;
2    INSERT INTO city 
3    VALUES 
4        (DEFAULT, "San Felipe", "CHL", "Valparaiso", 64126);

Results:

iud_03.png

(DEFAULT "San Felipe", "CHL", "Valparaiso", 64126);

This content is provided to you freely by EdTech Books.

Access it online or download it at https://edtechbooks.org/learning_mysql/the_insert_clause_wiu.