Learning MySQL By Example
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:
(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”.

CC BY-NC-ND International 4.0: This work is released under a CC BY-NC-ND International 4.0 license, which means that you are free to do with it as you please as long as you (1) properly attribute it, (2) do not use it for commercial gain, and (3) do not create derivative works.
End-of-Chapter Survey
: How would you rate the overall quality of this chapter?- Very Low Quality
- Low Quality
- Moderate Quality
- High Quality
- Very High Quality