SQL insert

INSERT INTO statement is used to insert new records in a table.


There are two forms in which we can use insert function in sql




SYNTAX :

The first form doesn't specify the column names where the data will be inserted, only their values:

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

The second form specifies both the column names and the values to be inserted:

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

Table 'Emp'

ID

NAME

10407ANKIT
10634ANUJ

Example 1 : Basic

INSERT INTO Emp(id,name) VALUES (10407,'ankit');

Example 2 :Insert null

INSERT INTO Emp(id) VALUES (10407);

Example 3 :Insert null

INSERT INTO Emp(id,name) VALUES (10407,'');

Example 4 :Insert null

INSERT INTO Emp(id,name) VALUES (10407,null);





Online Execute/Compile

Quantitative Aptitude
Reasoning
Programming
Interview