<

Learn DBMS and MySQL

Our tutorial provides basic and advance concepts of database management and MySQL commands with detailed examples

DBMS Introduction
MySQL Database
MySQL Tables
MySQL Queries
MySQL Clauses
MySQL Conditions
MySQL Keys

MySQL Insert statement

MySQL INSERT statement is used to store or add data in MySQL table within the database. We can perform insertion of records in two ways using a single query in MySQL:

  1. Insert record in a single row

  2. Insert record in multiple rows

The below is generic syntax of SQL INSERT INTO command to insert a single record in MySQL table:

    INSERT INTO table_name ( field1, field2,...fieldN )    
    VALUES ( value1, value2,...valueN );  

NOTE: Field name is optional. If we want to specify partial values, the field name is mandatory. It also ensures that the column name and values should be the same. Also, the position of columns and corresponding values must be the same.

For example :

If we want to store single records for all fields :

If we want to store multiple records, refer the following

If we want to store records without giving all fields, we use the following partial field statements. In such case, it is mandatory to specify field names.

Let's move on to update record in MySQL


Share this page on :