SQL DML (Data Manipulation Language) STATEMENT

SQL DML STATEMENT

   


 

DML :- Data Manipulation Language Data manipulation language is provides commands for updating, inserting, deleting, modifying data and tuples.

DML command are:
a)  INSERT
b) UPDATE
c) DELETE


a) INSERT Statements :
 SQL INSERT command is used to add a new tuple to a relation.
The relation name and list of values of the tuple must be specified.
The values should be listed in the same order in which the corresponding attributes where specified in the CREATE TABLE commands. 

Syntax:
 INSERT INTO <table_name> 
VALUES <V1,V2, .....Vn);

Example:
 Consider EMP table having columns empno,ename, salary and we want to insert row in the table.
 
INSERT INTO EMP
VALUES(101,'AMIT', 10000);
 [Note: Character and Date values must be enclosed in the single quotation marks.]

b) UPDATE Statements :
 SQL UPDATE STATEMENTS is used to modify attribute values of  selected tuples to be modified are specified by a condition in a WHERE  clause and the new values of the columns to be update is specified by a SET  clause. 

Syntax :
UPDATE TABLE   <table _name>
SET column_name=new_values
[WHERE condition];

Examples:
i) UPDATE TABLE EMP 
   SET  SALARY = 30000;
 Command update all employees salary 30000;

ii) UPDATE TABLE EMP
SET JDATE='2-JAN-84'
WHERE  EMPNO=101;
Command update employees jdate  whose employees no is 101; 

c) DELETE Statements :
 DELETE STATEMENT is used to delete tuples row from the table.

Syntax:
 DELETE FROM <table_name>
[WHERE <condition>];

Example :
 DELETE FROM EMP;
 Delete all rows  of employees.

DELETE FROM EMP WHERE EMPNO=101;
Delete all rows  of employees where empno is 101.
 










SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Important of Database privilages

Database privileges Privileges are the right or permission to execute particular SQL statements.                           System Se...