Introduction to the Data Definition Language (DDL)


The Data Definition Language (DDL) is a syntax that is used to describe data structures and related items. Originally DDL related to database systems, but the term is now used in other contexts. As a database language, DDL is the data description language of a database.

There exist very different forms of Data Definition Language (depends on the application), examples:

In the historical IMS databases, the data structures and their logical views are defined in terms of a higher assembly language (eg, SEGME PROJECT NAME = , PARENT = FIRM , BYTES = 45 FIELD NAME = ( PROJNO , SEQ , U) , BYTES = 6, START = 1 … “).

Some software vendors also have authorization elements (eg GRANT) to the DDL – term, however, these are in theory to Data Control Language.

In the practically important Structured Query Language, the syntax is as follows:

CREATE TABLE relation ( ( attribute definition [PRIMARY KEY] ) +
[, FOREIGN KEY ( attribute + ) REFERENCES relation ( attribute + ) ] )
DROP TABLE relation
ALTER TABLE relation age – Definition
CREATE INDEX index – name ON relation ( attribute + )
DROP INDEX index – name
CREATE VIEW view [ (attribute +)] AS SFW block [WITH CHECK OPTION ]

PRIMARY KEY and FOREIGN KEY constraints are part of the SQL -89 or SQL -92 IDL and are not supported by some database systems.

The attribute definition includes the attribute name, data type, and optional information such as NOT NULL. In SQL -92 user-defined value ranges and default values can be specified.

In CREATE TABLE also still constraints can be specified in the attributes or for the table from SQL -92 using the CHECK clause.

The age definition is ADD attribute definition . In SQL -92 , there is ALTER or DROP attribute default value attribute. Because SQL -92 is very restrictive regarding the ALTER statement , this is one of the statements that has been extended universally by the manufacturers so that any changes are possible , such as by a sequence of DROP and ADD instructions.

When defining a new view attribute names can be assigned. SFW – block is an arbitrary SQL query WITH CHECK OPTION specifies whether certain change operations should be allowed.

An ORDER BY clause is in view definitions not permitted because views are again relations , and relations are (multi- ) sets , ie not sorted by definition.

The CREATE statement is used in modern DBMS to create all sorts of other objects except relations , indexes and views.

The SQL standard defines indexes at all, so that the corresponding CREATE INDEX and DROP INDEX statements always are product- specific extensions. However, most DBMSs use the same or a very similar syntax.

WITH CHECK OPTION defines a view with a degree of control over the data that can be processed by the view. This specification is set that changes the perspective that affect the non-visible in her part of a relation are detected and rejected in a test .



Creates the table called Student with the columns and Legi name, where Legi is the primary key and the columns in any empty fields are allowed.

ALTER TABLE ADD student first name VARCHAR ( 35)

Defines a new column called first name in the Student table .


Deletes the entire table student.

CREATE INDEX IDX_NAME ON student (name )

Specifies an index on the Name column of the table student. The index gets the name IDX_NAME and speeds up the search for records in the Student table, if the name is specified as a search criterion .


Deletes the index IDX_NAME .

About the Author