This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (July 2011) |
A data definition language or data description language (DDL) is a syntax similar to a computer programming language for defining data structures, especially database schemas.
Contents |
The data definition language concept and name was first introduced in relation to the Codasyl database model, where the schema of the database was written in a language syntax describing the records, fields, and sets of the user data model.[citation needed] Later it was used to refer to a subset of Structured Query Language (SQL) for creating tables and constraints. SQL-92 introduced a schema manipulation language and schema information tables to query schemas. These information tables were specified as SQL/Schemata in SQL:2003. The term DDL is also used in a generic sense to refer to any formal language for describing data or information structures.
Unlike many data description languages, SQL uses a collection of imperative verbs whose effect is to modify the schema of the database by adding, changing, or deleting definitions of tables or other objects. These statements can be freely mixed with other SQL statements, so the DDL is not truly a separate language.
Create - To make a new database, table, index, or stored query. A CREATE
statement in SQL creates an object inside of a relational database management system (RDBMS). The types of objects that can be created depends on which RDBMS is being used, but most support the creation of tables, indexes, users, synonyms and databases. Some systems (such as PostgreSQL) allow CREATE
, and other DDL commands, inside of a transaction and thus they may be rolled back.
Perhaps the most common CREATE
command is the CREATE TABLE
command. The typical usage is:
CREATE [TEMPORARY] TABLE [table name] ( [column definitions] ) [table parameters]
.
Column Definitions: A comma-separated list consisting of any of the following
NULL
| NOT NULL
} {column options}PRIMARY KEY
( [comma separated column list] )CONSTRAINT
} [constraint definition]For example, the command to create a table named employees with a few sample columns would be: <syntaxhighlight lang="sql"> CREATE TABLE employees (
id INTEGER PRIMARY KEY, first_name VARCHAR(50) null, last_name VARCHAR(75) not null, dateofbirth DATE null
); </syntaxhighlight>
Drop - To destroy an existing database, table, index, or view.
A DROP
statement in SQL removes an object from a relational database management system (RDBMS). The types of objects that can be dropped depends on which RDBMS is being used, but most support the dropping of tables, users, and databases. Some systems (such as PostgreSQL) allow DROP
and other DDL commands to occur inside of a transaction and thus be rolled back. The typical usage is simply:
DROP objecttype objectname
.
For example, the command to drop a table named employees would be:
<syntaxhighlight lang="sql"> DROP TABLE employees; </syntaxhighlight>
The DROP
statement is distinct from the DELETE
and TRUNCATE
statements, in that they do not remove the table itself. For example, a DELETE
statement might delete some (or all) data from a table while leaving the table itself in the database, whereas a DROP
statement would remove the entire table from the database.
Alter - To modify an existing database object.
An ALTER
statement in SQL changes the properties of an object inside of a relational database management system (RDBMS). The types of objects that can be altered depends on which RDBMS is being used. The typical usage is:
ALTER objecttype objectname parameters
.
For example, the command to add (then remove) a column named bubbles for an existing table named sink would be:
<syntaxhighlight lang="sql"> ALTER TABLE sink ADD bubbles INTEGER; ALTER TABLE sink DROP COLUMN bubbles; </syntaxhighlight>
Finally, another kind of DDL sentence in SQL is one used to define referential integrity relationships, usually implemented as primary key and foreign key tags in some columns of the tables.
These two statements can be included inside a CREATE TABLE
or an ALTER TABLE
sentence.
|
|
To alter generally means to change something, and may refer to:
The Alter Motor Car Company, of Plymouth, Michigan, produced over 1,000 automobiles between 1914 and 1916.
The company was organized on January 26, 1914, by Guy Hamilton, F.M. Woodward, and other local residents. Construction of the factory started in the spring of 1914. Soon after, they started production of the Alter designed by Clarence Alter of Manitowoc, Wisconsin. The car was made from component parts shipped to Plymouth by rail and then assembled at the Farmer Street factory.
At its peak, the factory employed 100 people, and produced 25 vehicles a day. January 1917, the company went into receivership, and closed. The factory building still stands on Farmer Street near downtown Plymouth, across from the Cultural Center. In 2000 it was restored and, as of October 2007, is home to the C.D. Sparling Co., a small manufacturing company.
The 1914 model was a five passenger touring car. A roadster was later introduced. The 1916 Alter model was described as "the classy look and finish of the higher priced cars", by the Plymouth Mail (local newspaper) on March 3, 1916. The 1916 model had a 27 horsepower 4-cylinder engine, 12 US gallons (45 L; 10 imp gal) fuel tank under the cowl, with a wheelbase of 108 inches (2,700 mm). The 1916 Alter sold for $685.
Alter is a lunar impact crater that is located in the northern hemisphere on the far side of the Moon. It lies to the southwest of the larger crater Robertson, and to the east of Ohm.
The outer rim of Alter has been degraded by subsequent erosion, most notably at the northern and southern extremes. There is a small crater lying across the south-southeast rim. A cleft runs across the floor from the southern rim toward the north-northeast. Ray material cross the crater floor from the east, forming a pair of faint bands.
By convention these features are identified on lunar maps by placing the letter on the side of the crater midpoint that is closest to Alter.
SQL (i/ˈɛs kjuː ˈɛl/, or
i/ˈsiːkwəl/;Structured Query Language) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS).
Originally based upon relational algebra and tuple relational calculus, SQL consists of a data definition language, data manipulation language, and a data control language. The scope of SQL includes data insert, query, update and delete, schema creation and modification, and data access control. Although SQL is often described as, and to a great extent is, a declarative language (4GL), it also includes procedural elements.
SQL was one of the first commercial languages for Edgar F. Codd's relational model, as described in his influential 1970 paper, "A Relational Model of Data for Large Shared Data Banks." Despite not entirely adhering to the relational model as described by Codd, it became the most widely used database language.
SQL 2008 can refer to
SQL:2006 or ISO/IEC 9075:2006 standard is the fifth revision of the ISO standard for the SQL database query language.
The main changes from SQL:2003 were in the Part 14 of the standard.
ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction with XML. It defines ways of importing and storing XML data in an SQL database, manipulating it within the database and publishing both XML and conventional SQL-data in XML form. In addition, it enables applications to integrate into their SQL code the use of XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.