What Is The Full Form Of DDL?
The Full Form Of DDL is a Data Definition Language
DDL is a computer language used to build and transform the arrangement of database objects in a database. These database objects comprise various elements like views, tables, indexes, schemas, etc. In some situations, this is known as a data description language because it determines the fields and records in the database table.
There are different types of DDL commands which can be used to add, delete, or modify tables within a database. DDL commands comprise CREATE, ALTER, DROP, TRUNCATE, and RENAME. Let’s analyze each of these commands.
Create commands have a predefined syntax and are often used to create a new table. The CREATE language statement is:
CREATE TABLE [table name] ([column definitions]) [table parameters];
An ALTER command has the authority to make changes in an existing database table. In short, this command will modify the table.
Alter command is used for modifying the table:
ALTER TABLE table_name ADD
old_column_name TO new_column_name;
The DROP command has the authority to delete any objects such as a table, index, or view. If we delete any object with the DROP command, then there is no other way to retrieve it. DROP Command language statement is:
DROP TABLE table_name
The TRUNCATE command is also similar to the DROP. It is generally used if you want to immediately remove all the data from a table. However, there is one difference: In the DROP command, we cannot retrieve data, whereas in the case of TRUNCATE, we can save the structure to be reused later. TRUNCATE command language statement is:
TRUNCATE TABLE table_name;
The rename command is used to modify or edit the name of an existing database object such as table and column to a new name. While renaming the data, you don’t have to fret about any data loss as it will be secure. The rename command language statement is:
RENAME TABLE `current_table_name` TO `new_table_name`;