• Learning MySQL By Example
  • Introduction
  • 1. How to Retrieve Data From a Single Table
  • 2. How to Retrieve Data from Multiple Tables
  • 3. Using Functions
  • 4. How to Insert, Update, Delete Data in Tables
  • 5. Summary Queries and Aggregate Functions
  • 6. Working With Subqueries
  • 7. SQL Views
  • 8. SQL Indexes
  • Glossary
  • Index
  • Download
  • Translations
  • 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.