Database Reference
In-Depth Information
Inserting Data into Tables
To add record(s) to a table INSERT statement is used. It can be used in several
ways:
 insert a single complete row
 insert a single partial row
 insert the results of a query
INSERT statement needs a table and the values to be inserted into the new row.
If the column names are not specified in the INSERT INTO clause, then there must be
one value for each column in the table and the values must be in the same order as they
are defined in the table.
If the column names are specified in the INSERT INTO clause, then there must be exactly
one value per specified column and those values must be in the same order in which they
are defined in the INSERT INTO clause. However, the column names and values do not
have to be in the same order as the columns in the table definition.
Each value with a character string data type must be enclosed in single quotes. You may
use the keyword NULL (or null) as the data value in the VALUES clause to assign a null
value to any column that allows nulls.
Syntax:
INSERT INTO tablename (columnname1, columnname2,……….. columnnameN,
VALUES(expression1, expression1……………. expressionN);
Example: Insert Following data into Staff Table using SQL:
StaffID Name
101 Manoj Kumar
102 Aman Kumar
103 Nigam
104 Ajay Kumar
105 Rohit
201 Sham
234 Ram
246 Arun
267 Sanjeev
Sol:
DOB Designation 23-Jun-66 HOD
Search WWH ::




Custom Search