MySQL Insert Query (Single Row and Multiple Row)

MySQL Insert Query:

(1) In the previous blog, we learn about how to create a table in MySQL and insert data into the table manually. In this blog, we learn about how to insert data into the table using MySQL Insert Query. There are two ways to insert data into the table i.e. you can add either a single row at a time or multiple rows. In order to add a single row in a table we use the following command as shown below i.e.

INSERT INTO table_name
(column1, column2, column3, column4, ………..)
VALUES
(value1, value2, value3, value4, ………..)

(2) Now open the MySQL Workbench and log in to it. Now go to the table and write the single-row query as shown.

mysql query to insert single row data in table

(3) Now the single data is added to the student_table.

single row added in mysql table

(4) In order to add multiple rows in a table we use the following command as shown below i.e.

INSERT INTO table_name
(column1, column2, column3, column4, ………..)
VALUES
(value1, value2, value3, value4, ………..),
(value1, value2, value3, value4, ………..),
(value1, value2, value3, value4, ………..)

(5) Now open the MySQL Workbench and log in to it. Now go to the table and write the multiple-row query as shown.

mysql mutiple row query to insert data in table

(6) Now the multiple data is added to the student_table.

multiple data added in mysql table

(7) If you have added the values in the table in the same number as the rows, then in that case you do need to mention the column name in the query as shown below.

use value statement in mysql

Email (Electronic Mail)
FTP (File Transfer Protocol)
Internet and Its Uses
Operating System (OS)
Information Security in E-Commerce
Computer Software and Hardware
MySQL– Wikipedia

Comments (No)

Leave a Reply