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.
- To DELETE rows from a table, the table must be in the USERS SCHEMA.
- DELETE any table system privilege allows to DELETE rows from any TABLE or PARTITION TABLE or from the base table of any VIEW.
Syntax:
delete [FROM] <table name>
[WHERE
Condition];
Ex:
SQL>delete from emp;
SQL>delete from emp empno;
SQL>delete from emp where empno in(7566,7900);
SQL>delete from emp where ename='SCOTT';
SQL>delete from emp where job='SALESMAN' and
hiredate<Sysdate;
SQL>var vsal number;
SQL>delete from emp where job='SALESMAN' and
hiredate<Sysdate
returning
SUM(sal) into :vsal;
SQL>print :vsal;
SQL>delete from emp where ename='SCOTT' or ename='KING';
No comments:
Post a Comment