SQL Tutorial : DDL - DROP, TRUNCATE
Let's learn about next topic: DROP & TRUNCATE
- DROP TABLE STUDENTS => REMOVES THE TABLE PERMANENTLY
- TRUNCATE :
*************
1.DELETE THE DATA PERMANENTLY
2.NO ROLLBACK
3.RELEASES THE MEMORY PACES OCCUPIED BY DATA
4.NO CONDITIONAL DELETION
5.DOES NOT INITIATE A TRIGGER
6.TRUNCATE IS FASTER
- ALTER TABLE DEPS
SET UNUSED COLUMN DNAME2
- ALTER TABLE DEPS
DROP UNUSED COLUMNS
DD: USER_TABLES
- CREATE TABLE COPY_EMP
AS
SELECT EMPLOYEE_ID,LAST_NAME,SALARY
FROM EMPLOYEES
WHERE DEPARTMENT_ID=60
- CREATE TABLE COPY_EMP
AS
SELECT EMPLOYEE_ID,LAST_NAME,SALARY
FROM EMPLOYEES
WHERE DEPARTMENT_ID=6
- ONLY NOT NULL CONSTRAINTS ARE COPIED
No comments:
Post a Comment