Data Definition Language DDL: Saturday, May 09, 2020 Hebansour2020
Data Definition Language DDL: Saturday, May 09, 2020 Hebansour2020
• Create – is used to create the database or its objects (like table, index,
function, views, store procedure and triggers).
• Drop – is used to delete objects from the database.
• Alter-is used to alter the structure of the database.
• Truncate–is used to remove all records from a table, including all spaces
allocated for the records are removed.
• Comment –is used to add comments to the data dictionary.
• Rename –is used to rename an object existing in the database.
Syntax:
ALTER TABLE table_name
MODIFY column_name column_type;
• Syntax
ALTER TABLE table_name
RENAME TO new_table_name;
• Columns can be also be given new name with the use of ALTER TABLE.
Examples:
DROP TABLE table_name;
table_name: Name of the table to be deleted.
• Truncate is normally ultra-fast and its ideal for deleting data from a
temporary table.
• Truncate preserves the structure of the table for future use, unlike
drop table where the table is deleted with its full structure.
• Table or Database deletion using DROP statement cannot be
rolled back, so it must be used wisely.