SQL – Insert data into table using SQL command (Syntax)

After table creation, we are required to insert data into the table. SQL is providing another command using which we can insert data into table.

Insert data into table using SQL Command:

Before inserting data into table, we must have to careful otherwise we may end up encountering bank of errors.

SQL Insert Command (Syntax):


The above syntax we are going to use to insert data into the table.


Roll_no Student_name Subject Marks
1 John Math 90
2 Rita Math 95
3 Sam Math 84
4 Jack Math 72
5 Pom Math 99

We are going to insert above values into the table.

(Start xampp server, click on the database, then click on SQL from menu panel. (Refer previous article))

Before proceeding further, we must have to know the type of data value we are going to insert into the table. And also, we are not going to insert all the rows at a time. What I mean is, we are going to insert one row after another. (Can not we insert all the rows in one go? Yes we can, but we are at learning stage, it would be wise to avoid complexity. So lets insert one row after another).

Lets insert, roll no 1, student name john, subject math, and marks 90.

  • roll no is integer value
  • student name and subject is string value
  • marks is int value

(Previously we have created the table using SQL Command, in which we have defined roll_no type is int, Student_name is varchar which is string, subject is varchar and marks is int).

Remember one simple rule:

If we are inserting string value, that would always be kept with in single quote

Therefore, our syntax to insert the a row would be as below:

insert into new_student_marks(













For understanding purpose, I have written the above command in such way, but it wont give any error. We can also write in single sentence.

Note: in the order, column names are written in the command, in the same order we need to provide respective values. 

Note: There is no single quote for 1 and 99 but there is single quote around john and math. Because john and math are string value (varchar value). 

Note: We can also provide double quote instead of single quote for string (varchar) values. No issue. 

Now copy the above code and place inside SQL as shown in below image. Then click on “Go” button

Insert data into table using SQL Command Syntax Insert data into table using SQL Command Syntax

The status result will appear. See in the picture, it says, 1 row inserted.

Insert data into table using SQL Command Syntax

If you click on your table from left column, then you would see the result.

Now insert rest of the rows similar way.