Data Definition Language

The Data Definition Language (DDL ) is a database language that is used to describe data structures and related items, to change or remove. 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 DDL ( 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 ... ").
  • In SQL it is (in addition to DML and DCL) command in the form of English clauses ( eg, " CREATE TABLE PROJECT ( PROJNO DECIMAL ( 6,0 ) NOT NULL PRIMARY KEY, ... ").
  • XML Schema is a DDL for describing the structure of XML documents.

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

A distinction is a DDL from the term " declaration ": During a DDL A., to define the structure of data used in a DBMS, how to set the format and structural information for main memory - internal data to be processed is - in the source code of a computer program, according to the syntax of a programming language - as a 'Declaration ' means ( in part as a definition or specification).


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 ]     DROP VIEW view 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 (see tables ). 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.


CREATE TABLE Student (       Legi INT NOT NULL PRIMARY KEY,       Name VARCHAR ( 50) NOT NULL) 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.

DROP TABLE Student 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.

DROP INDEX IDX_NAME Deletes the index IDX_NAME. see also

  • SQL