- Removes all rows from a table, leaving the table empty and the table structure intact
- Is a data definition language (DDL) statement rather than a DML statement; cannot easily be undone
- Syntax : TRUNCATE TABLE table_name;
- Example : TRUNCATE TABLE copy_emp;
Sunday, November 15, 2009
TRUNCATE Statement
Saturday, November 14, 2009
DELETE Statement
You can remove existing rows from a table by using the DELETE statement :
Specific rows are deleted if you specify the WHERE clause :
- DELETE [FROM] table [WHERE condition];
Specific rows are deleted if you specify the WHERE clause :
- DELETE FROM dept WHERE dname = 'Finance';
- DELETE FROM copy_emp;
- Use subqueries in DELETE statements to remove rows from a table based on values from another table :
- DELETE FROM emp WHERE deptno = (SELECT deptno FROM dept WHERE dname =‘SALES’);
Subscribe to:
Posts (Atom)