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.
1. Create
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];
2. Alter
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:
1. ADD
ALTER TABLE table_name ADD
(column_name datatype);
2. RENAME
ALTER TABLE
table_name
RENAME
old_column_name TO new_column_name;
3. DROP
ALTER TABLE
table_name
DROp
(column_name);
4. MODIFY
ALTER TABLE
Employee MODIFY
(column_name datatype);
3. Drop
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
4. Truncate
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;
5. Rename
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`;
Comments