In this tutorial, we will learn how to INSERT
record into a table of a database using SQL.
SQL INSERT INTO
statement is used to insert a new record or new row in a table of the database.
There are two ways to insert or adding a new row to a table:
INSERT INTO tableName(column1, column2,...columnN)
VALUES(value1, value2,...valueN);
INSERT INTO tableName
VALUES(value1, value2,...valueN);
INSERT INTO Employee(ID,EmpName,City,Country,Gender,Salary)
VALUES (1,'Shankar','Delhi','India','male',25000);
INSERT INTO Employee(ID,EmpName,City,Country,Gender,Salary)
VALUES (2,'Sourabh','Delhi','India','male',30000);
INSERT INTO Employee(ID,EmpName,City,Country,Gender,Salary)
VALUES (3,'Ranvijay','Mumbai','India','male',15000);
INSERT INTO Employee(ID,EmpName,City,Country,Gender,Salary)
VALUES (4,'kapil','Noida','India','male',25000);
INSERT INTO Employee(ID,EmpName,City,Country,Gender,Salary)
VALUES (5,'shalini','Jaipur','India','female',18000);
INSERT INTO Employee(ID,EmpName,City,Country,Gender,Salary)
VALUES (6,'Rakesh','Faridabad','India','male',23000);
//For Selecting Records use this SELECT statement
SELECT * FROM Employee
ID | EmpName | City | Country | Gender | Salary |
1 | Shankar | Delhi | India | male | 25000 |
2 | Sourabh | Delhi | India | male | 30000 |
3 | Ranvijay | Mumbai | India | male | 15000 |
4 | Kapil | Noida | India | male | 25000 |
5 | Shalini | Jaipur | India | female | 18000 |
6 | Rakesh | Faridabad | India | male | 23000 |
INSERT INTO Employee
VALUES (7,'Akshay','Mumbai','India','male',21000);
INSERT INTO Employee
VALUES (8,'Sarah','Neywork','US','female',76000);
INSERT INTO Employee
VALUES (9,'Rocky','Noida','India','male',28000);
ID | EmpName | City | Country | Gender | Salary |
1 | Shankar | Delhi | India | male | 25000 |
2 | Sourabh | Delhi | India | male | 30000 |
3 | Ranvijay | Mumbai | India | male | 15000 |
4 | Kapil | Noida | India | male | 25000 |
5 | Shalini | Jaipur | India | female | 18000 |
6 | Rakesh | Faridabad | India | male | 23000 |
7 | Akshay | Mumbai | India | male | 21000 |
8 | Sarah | New York | US | female | 76000 |
9 | Rocky | Noida | India | male | 28000 |