GATE CSE IT » DDL Full form

DDL Full form

Read this article to know about the full form of DDL, and its most used commands.

A data definition language (DDL) is a programming language used to create and modify the structure of database items. Database objects include views, schemas, tables, and indexes. This phrase is also called data description language in some cases because it specifies the fields and records inside a database table. DDL is now integrated into every precise manner used in the DBMS industry to describe data. It is, however, a subset of SQL. To execute database changes, SQL frequently manages to combine imperative verbs with conventional English phrases. As a result, the Data dictionary does not appear in a SQL database as a separate language but rather defines changes in the database structure.

Table of Contents

DDL Commands

  • Create

This command generates a new desk with the specified syntax. The CREATE statement has the following syntax:CREATE TABLE [table name] ([column definitions]) [table parameters];

Example:

Worker (Worker Id INTEGER PRIMARY KEY, First name Ashuu (40) NULL, Last name AShuu (65) NOT NULL);

After the statement is processed, every instruction before the required semicolon is executed. In this case, the data structure is specified by string CHAR. Other types of data include DATE, NUMBER, and INTEGER.

2. Alter

An alter command modifies an existing data table. This command can add new columns, delete existing columns, or even change the data type of columns in a database table. The following command syntax is an example: ALTER entity type object moniker parameters;

CHANGE the object type as well as object name arguments;

ADD Given As input (employee pk) TO TABLE Worker as an example

In this example, we used a unique identifier to introduce a constraint and enforce a unique value. Employee pk is a key constraint that only applies to the Employee table.

3. DROP

The Drop command deletes objects such as tables and indexes but also views. A DROP statement could be reversed; thus, an item cannot be recovered once deleted. The syntax for a drop statement is as follows:

DROP object name; DROP object type

Employee DROP TABLE, for example.

In this example, we’re removing this same Employee table.

4. Truncate

Like DROP, TRUNCATE is employed to remove all table entries quickly. Unlike DROP, which devastates a table, TRUNCATE will save its entire structure for later use. The syntax for a truncate statement is as follows:

TRUNCATE; TABLE table name

As an example, consider the TRUNCATE TABLE employee.

In this example, we’ve labelled each employee table’s extent at least for deallocation, indicating that they’re available for reuse.

5. Rename

The rename command is used to change the name of the existing database item, such as a table or column, to something new. You won’t have to worry about data loss while renaming the files since they will be safe. The rename command language statement is as follows:

Change the table name ‘current table name’ TO ‘new table name’;