Wednesday, 10 October 2012

Lesson : 16 DELETE Statement


Lesson : 16  DELETE Statement
 

Syntax :

   DELETE  FROM   <tablename>  WHERE condition;

DELETE statement is used to delete records/rows from  table. Note that, commit is required to make the delete permanently from database.

Examples  :

1)      To delete all records from table

SQL> delete  from emp;

SQL> Commit;

2)      To delete  employee records whose age is more than 60

SQL> delete from emp where age > 60;

SQL> COMMIT;

3)      To delete all employee records who joined before ’01-01-1950’

SQL> delete from emp where hiredate < ’01-Jan-1950’;

SQL>  COMMIT

 
 

No comments:

Post a Comment