Introduction1. How to Retrieve Data From a Single Table1.1. The Five Clauses of the SELECT Statement1.2. Column Specifications1.3. LIKE and REGEXP Operators1.4. Arithmetic Operators1.5. Column Aliases1.6. Comparison Operators1.7. IS NULL, BETWEEN, IN Operators1.8. AND, OR, NOT Logical Operators1.9. DISTINCT Clause2. How to Retrieve Data from Multiple Tables2.1. The JOIN Clause2.2. Joining More Than Two Tables2.3. The OUTER JOIN Clause2.4. How to Code a UNION3. Using Functions3.1. Date Functions3.2. Numeric Functions3.3. String Functions4. How to Insert, Update, Delete Data in Tables4.1. The INSERT Clause With a Column List4.2. The INSERT Clause Without a Column List4.4. The UPDATE Clause With a Column List4.4. The DELETE Clause5. Summary Queries and Aggregate Functions5.1. Aggregate Functions5.2. Grouping Data5.3. Simple GROUP BY Query5.4. Improving the GROUP BY Query5.5. Using the HAVING Clause5.5. Using the HAVING and WHERE Clauses Together5.6. COUNT(column_name) and COUNT(*)5.7. Using the DISTINCT Statement6. Working With Subqueries6.1. The Subquery In a SELECT Statement6.2. The Subquery in an UPDATE statement6.3. Create a Duplicate Table From An Existing Table 6.4. The Subquery In a Delete Statement7. SQL Views7.1. SQL View Explained7.2. Benefits of Using Views7.3. Views That Allow UPDATE Statements8. SQL Indexes8.1. SQL Indexes Explained8.2. Clustered vs. Non-clustered Indexes8.3. Create an Index in Workbench Using an ERD8.4. How to Manually Add an Index to an Existing TableGlossaryIndex
4.1

The INSERT Clause With a Column List

The INSERT Clause With a Column List

  • You can INSERT single or multiple rows at a time.
  • An INSERT with a column list DOES NOT require you to provide a value for each column. If you do not want to provide a value for a specific column, you do not have to include it in the column list. For columns that allow null values, the system will automatically provide a null value for you.
  • If you want a column that provides a default value such as an auto-increment column to be populated with the default value, you do not need to list the column in the column list. The system will automatically provide the default value.
  • When coding with a column list, the columns may appear in any order as long as the VALUES list matches the order of the column list.

Below is a basic example of an INSERT statement with a column list:

1    USE world;
2    INSERT INTO city 
3        (name, countryCode, district, population) 
4    VALUES 
5        ("San Felipe", "CHL", "Valparaiso", 64126);

Results:

iud_01.png

Results of the Insert:

iud_02.png

INSERT INTO city

(name, countryCode, district, population) 

VALUES

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

End-of-Chapter Survey

: How would you rate the overall quality of this chapter?
  1. Very Low Quality
  2. Low Quality
  3. Moderate Quality
  4. High Quality
  5. Very High Quality
Comments will be automatically submitted when you navigate away from the page.