In this tutorial, we will Learn how to add a single row / multiple rows into a table in SQL server. To add the rows, we will be using the Insert Statement.
Table of Contents
Insert row syntax
The simplified syntax of adding a new row into sql server is as follows.
INSERT INTO table_name (column_list)
VALUES (value_list);The statement starts with INSERT INTO.
table_name : The table in which the we are going to insert a row. We can use the Fully Qualified table name here.
column_list: The list of columns separated by comma.
If we skip a column then the SQL server inserts the default value ( or null if default value is not specified). If the column does not allow null value and default value is also not specified, then the Server will throw an error
VALUES clause follows the column_list
value_list The values to insert. Each value is separated by a comma and must match the order of the fields in the column_list.
Add Row Example
Create database HRSelect the HR database
Use HRCreate a new table Employee
CREATE TABLE Employee (
EmployeeID int NOT NULL PRIMARY KEY,
FirstName varchar(50) NOT NULL,
LastName varchar(50) NOT NULL,
Department varchar(20) NOT NULL,
Designation varchar(15) NOT NULL,
Salary decimal(10, 0) NOT NULL,
Email varchar(50) NULL,
)Insert a new row to employee table. Enclose the string in single quotes.
Insert into Employee (
EmployeeID,
FirstName,
LastName,
Department,
Designation,
Salary,
Email
)
Values (1,
'Sachin',
'Tendulkar',
'Administration',
'CEO',
500000,
'[email protected]'
)Use select query to view the inserted data
Select * from Employee
Add Multiple Rows
To add multiple rows, use the following syntax.
INSERT INTO table_name (column_list)
VALUES (value_list_1),
(value_list_2),
(value_list_3);
Insert into Employee (
EmployeeID,
FirstName,
LastName,
Department,
Designation,
Salary,
Email
)
Values (2,
'Saurav',
'Ganguly',
'Administration',
'CEO',
500000,
'[email protected]'
),
(3,
'Rahul',
'Dravid',
'Administration',
'CEO',
500000,
'[email protected]'
)Reference
Read More


