0% found this document useful (0 votes)
177 views3 pages

Understanding Oracle DDL Commands

DDL commands are used to define and manage database schema and are automatically committed. The key DDL commands are Create, Alter, Drop, Truncate, Rename, Flashback, and Purge. Create is used to build new database objects like tables. Alter changes the structure of existing objects. Drop deletes objects, while Flashback and Purge manage objects in the recycle bin. Truncate empties all records from a table but retains the structure. Rename renames existing database objects.

Uploaded by

Avulaiah G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views3 pages

Understanding Oracle DDL Commands

DDL commands are used to define and manage database schema and are automatically committed. The key DDL commands are Create, Alter, Drop, Truncate, Rename, Flashback, and Purge. Create is used to build new database objects like tables. Alter changes the structure of existing objects. Drop deletes objects, while Flashback and Purge manage objects in the recycle bin. Truncate empties all records from a table but retains the structure. Rename renames existing database objects.

Uploaded by

Avulaiah G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DDL DRL DML TCL DCL

Create select Insert Commit Grant


Alter Update Rollback Revoke
Truncate Delete
Drop Save point
Rename Insert all
Flashback merge
Purge

DDL Commands
• DDL Stands for Data Definition Language
• It deals with meta data [Data Definitions]such as table name,
column name, data type, field size, constraint name, constraint
type ...etc.
• We have no need to use “commit” command after using a “DDL
Command”. All DDL commands are auto committed.
• DDL Commands provided by Oracle-SQL are:

▪ Create
▪ Alter
▪ Drop
▪ Truncate
▪ Rename
▪ Flashback
▪ Purge

CREATE: This command is used to create the database or its objects (like
table, index, function, views, store procedure, and triggers).

2) Alter Command:
• It is a DDL Command.
• It is used to change the structure of database objects like tables,
views, and indexes ...etc.
3) Drop Command:
• It is a DDL Command.
• It is used to drop [delete] the database objects like tables, views,
and
Indexes ...etc.
Drop Table <Table_Name> [Purge];

4) Flashback Command:

• It is a DDL Command.
• It is used to recollect the dropped database objects from recycle
bin.
Flashback Table <Table_Name> to before drop [rename to
<new_name>];

5) Purge Command:
• It is a DDL Command.
• It is used to remove a dropped database object from Recycle Bin.
Purge Table <Table_Name>;

6) Truncate Command:
• It is a DDL Command.
• It is used to remove all records from a table.
• It does not remove structure of the table.
• It cannot be used to remove one record (or) a set of records from
table.
Truncate Table <Table_Name>;

7) Rename Command:
• It is a DDL Command.
• It is used to rename the data base objects like tables.
Rename <Old_Name> to <New_Name>;

You might also like