In this tutorial, we will explain how you can insert data in MySQL table by using the MySQL insert query and it will also contains some example of MySQL queries.
Below is the syntax of MySQL insert query:
1 2 3 |
INSERT INTO table_name ( field1, field2, field3...fieldN ) VALUES ( value1, value2, value3,...valueN ); |
In the above syntax, the field name is mandatory to insert the data in the table.
1 2 |
INSERT INTO employee(emp_id, emp_name, salary) VALUES (002, 'Amit Kumar', 30000); |
You can insert the multiple records at one time instead of inserting the multiple time. Use the below MySQL query to insert multiple records.
1 2 3 4 5 6 |
INSERT INTO employee(emp_id, emp_name, salary) VALUES (002, 'Amit Kumar', 30000), (002, 'Deepika', 25000), (002, 'Prem Tiwari', 40000), (002, 'Ramesh Sharma', 21000), (002, 'John', 32000); |