Monday, 2 May 2011

SQL Insert



 Notes :

 The INSERT INTO statement is used to Insert a New row in a table.

 It is possible to write the INSERT INTO statement in Two forms.


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

Syntax

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


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

                                   
                                         Doesn't specify the column names


Syntax

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

Example :( Doesn't specify the column names )

Insert into custmast values(1,'Siva','Srivilliputtur',50,70)

Output :

custcode
custname
city
qty
rate
1
Siva
Srivilliputtur
50
70

                                       Specifies Both The Column Names     


Example :(  Specifies Both The Column Names  )

Insert into custmast (custcode,custname,rate) values(2,'Bala',56)

Output :

custcode
custname
city
qty
rate
2
Bala


56

Select * from Custmast

Output :

custcode
custname
city
qty
rate
1
Siva
Srivilliputtur
50
70
2
Bala


56

 Share This Post


Friendly Learn Translate to Tamil

Smilely

Services

© 2014