Skip to main content
World Nomads Logo

How to INSERT data into table in MYSQL?




MySQL INSERT

MySQL INSERT statement is used to insert data in MySQL table within the database. We can insert single or multiple records using a single query in MySQL.
Syntax:
The SQL INSERT INTO command is used to insert data in MySQL table. Following is a generic syntax:
  1. INSERT INTO table_name ( field1, field2,...fieldN )  
  2. VALUES  
  3. ( value1, value2,...valueN );  

Field name is optional. If you want to specify partial values, field name is mandatory.

Syntax for all fields:
  1. INSERT INTO table_name VALUES ( value1, value2,...valueN );  
Example 1: for all fields

If you have to store all the field values, either specify all field name or don't specify any field.
Example:
  1. INSERT INTO emp VALUES (7, 'Sonoo', 40000);  
Or,
INSERT INTO emp(id,name,salary) VALUES (7, 'Sonoo', 40000);  

Subscribe channel on YouTube
Read this post on Blogger
Like page on Facebook
Tweet about video on twitter
Let's chat on whatsapp
See you at Instagram
Google+

Comments

Contact Us

Name

Email *

Message *