Insert operation in the database

Insert operation in the database

Insert statement is used to insert the data in the table. It is an DML operation,


Insert into table_name (colname1,colname2 ) values ( value1 , value2);

Suppose table have 4 column you can directly insert value in specific sequence in which your table is created. In this case you donot need to specify the column name in insert statment.

Insert into table_name values ( value1, value2 , value3, value4);

We have table employee and have 4 column in it then if we want to entry two column value then we write the following insert value with column name specify on it.

insert into employee  (id , emp_name) values ( 1 , 'RAM');

If we want to insert all 4 values then we donot need to specify column name but sequence of column value should be same.

insert into employee values ( 1,'RAM',2000,'01-JAN-2000');

Note: It good practice always specify column name in coding because if in future any structural change happen in table then all your coding without column name is not work it will generate error.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.