To insert new records into a table, use the INSERT INTO statement. You can write the INSERT INTO sentence in one of two ways.

  • You will need to specify both column names and values that you wish to insert:
    INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
  • You don't need to include the column names in your SQL query if you are adding values to all columns in the table. But, ensure that the order of your values matches the order of the columns in the table. The INSERT INTO syntax is as follows:
    INSERT INTO table_name VALUES (value1, value2, value3, ...);

Example

INSERT INTO Customers (name, email, salary) VALUES ('MySQL Query Interview Questions', '[email protected]', 15000);

BY Best Interview Question ON 21 Sep 2022