Learn From - Interactive SQL


Add Data to the Employee Table.

SQL Tutorial - Insert SQL Statement


You can write your own Insert SQL statements for this Employee Table.

Use the Text Editor below to write Insert SQL statements and have a good learning experience.

The INSERT INTO Statement


The INSERT INTO statement is used to insert a new record(s) into the database tables.

.

SQL INSERT INTO Syntax


INSERT INTO statement is done in two ways.

The first method is done by giving only the values of columns, the column names are not used.

Note: Values of the columns need to be specified in the same order as in the Database Table and must also be of the same datatype.

INSERT INTO table_name
VALUES (value1, value2...)

The second method of doing it is by giving both the column names and the values.

Note: Here the columns of the Table can be specified in any order provided the values are in the same order.

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


SQL INSERT INTO Example


The 'Employees' tables contains the following columns and their respective data type as shown below.

Table Name :

Employee79323Apr2024060444
Column Name Data Type  
EmployeeID (PK) varchar(50) Not Null
FirstName varchar(50) Not Null
LastName varchar(50) Not Null
DateOfBirth datetime Allows Null
Qualification varchar(50) Allows Null
Country varchar(50) Allows Null

Data in the Table:

EmployeeID FirstName LastName DateOfBirth Qualification Country
NULL NULL NULL NULL NULL NULL


EmployeeID is the Primary Key(PK).

Type or Copy the SQL Query shown below into the text editor and click the "View Result" button, to see the result.

Insert into Employee79323Apr2024060444 (EmployeeID, FirstName, LastName, DateOfBirth, Qualification,Country)
values ('Emp001','Smith','Jhon','2-Apr-1992','Bachelors of Engg','USA');
Insert into Employee79323Apr2024060444 (EmployeeID, FirstName, LastName, DateOfBirth, Qualification,Country)
values ('Emp002','George','Simpson','4-Mar-1984','Bachelors of science','USA');
Insert into Employee79323Apr2024060444 (EmployeeID, FirstName, LastName, DateOfBirth, Qualification,Country)
values ('Emp003','Arnold','Roger','7-Jun-1991','Bachelors of science','India');

Execute :