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:
(DEFAULT "San Felipe", "CHL", "Valparaiso", 64126);
- The values order must appear in the same order they exist in the table.
- You must enclose strings in quotes.
- You must NOT enclose numbers in quotes.
- You must specify all column names and provide the keyword “DEFAULT” or a literal value for columns that provide a default option.
- If you do not want to provide a value for columns that allow null values, you must provide the keyword “null”.