Recent Posts

Sunday, 24 April 2016

Data Manipulation Language


Data Manipulation Language

     This is the second sub language in SQL which contain four commands those are INSERT, UPDATE, SELECT, DELETE and which is used for manipulate the data within database.
INSERT
     This command is used to insert the records in the table using this command we can insert the data into the table in two methods
1. Explicit method
2. Implicit method
Explicit Method
     In this method user need to enter all the values into the columns without left any column data.
Syntax
INSERT INTO <TABLE NAME> VALUES (Val1, Val2,------,Valn);
E.g
INSERT INTO EMP Values(101,’RAJU’,500);
Note
     We can use & in front of any column. By placing like this the use is – “It takes particular column values as default for remaining all values.
Syntax to insert the records into the table using insertion operation:
INSERT INTO<Table name> VALUES(&col1,&col2,--------,&coln)
E.g
INSERT INTO EMP Values(&Eid,’&Ename’,&Sal’)
Implicit method
     This method we can enter the values at required columns in the table.
E.g
INSERT INTO < Table name> (Col1,Col2,------,Coln) values(Val1, Val2,--------,Valn)
E.g
INSERT INTO EMP(EID,SAL) VALUES(115,9800)
Syntax to insert record using & Symbol:
INSERT INTO < TABLE NAME>(col1,col2,-------,coln) values(&col1,&col2------,&coln)
E.g
INSERT INTO EMP(Eid,Sal) VALUES(&Eid,&Sal) VALUES(&Eid,&Sal)
UPDATE
     This command is used to modify the data existing table. Using this command we can modify all the records in the table also we can modify specific records in the table using WHERE clause.
Syntax
UPDATE <Table name> SET COLUMN NAME = “VALUE”;
Syntax
UPDATE EMP SET ENAME = ‘RAJU’;
Syntax to modify more than one column data at a time:
UPDATE <Table name> SET COL1=VALUE,COL2=VALUE,-------,COLN=VALUE
EX: UPDATE EMP SET EID = 007, ENAME = ‘JAMES’
DELETE
     This command is used to delete the records from the existing table. Using this command we can delete all the records and also we can delete specific records from the table.
Syntax
DELETE FROM <Table Name> <Column Name>
E.g
delete from rose no;
delete from rose where name='Ashok';
delete rose name where name='Ashok' or name='Vinod';

Next Tutorial  Data Retrieval Language

Previous Tutorial  Data definition Language

No comments:

Post a Comment