Sunday, October 14, 2012

Data Manipulation Language(DML) Overview



Data Manipulation Language(DML):

                          This is the second sub language in SQL which is used to manipulate the data within the database.This language contains four commands.
                                 1) INSERT
                                 2) UPDATE
                                 3) DELETE

  INSERT: 
            This command is used to insert the records in the table, using this command we can insert the records in two methods.

  • Explicit Method 
  • Implicit Method 

Explicit Method:
             In this method we need to enter all the values into all the columns without left or without omitting any column data.

Syntax: insert into table_name values(val1,val2,……..,valn); 
Example:

Using Insrtion Operator:
Syntax : insert into table_name  values(&col1,&col2,………,&coln); 
Example:
                   

Implicit Method: 
                    In this method we can enter the values at required columns in a table. So that we can omits some column data. If we don’t insert any value in particular column in a table then it automatically takes NULL.

Syntax: insert into table_name(col1,col2,…coln) values(val1,val2,….valn); 
Example:

Using Insrtion Operator:
Syntax:insert into table_name(col1,col2,…coln) values(&col1,&col2,...,&coln); 
Example:


UPDATE: 
            This command is used to modify the data in the existing table. Using this command we can modify all the records in a table and also we can modify specific records in the table (Using where clause-Discussed in the later sessions). 

Syntax: update table_name set column_name=value; 
Example:


Syntax: update table_name set col1=value,col2=value,…coln=value; 
Example: update emp set sal=8888,ename=javanib;

DELETE:
               This command is used to delete the data in the existing table. Using this command we can delete all the records in a table and also we can delete specific records in the table (Using where clause-Discussed in the later sessions).

Syntax: Delete from  table_name
Example:



No comments:

Post a Comment

back to top