Content deleted Content added
Tag: Reverted |
Mindmatrix (talk | contribs) m Reverted edits by 49.185.161.75 (talk) to last version by WalkingRadiance |
||
(20 intermediate revisions by 14 users not shown) | |||
Line 6:
{{Cleanup|reason=the article focuses almost entirely on SQL.|date=June 2020}}
}}
[[File:UY3OsG1vuT-saving-a-ddl-file-in-Oracle-Developer.png|alt=Saving a ddl file in Oracle SQL Developer|thumb|Saving a ddl file in Oracle SQL Developer]]
In the context of [[SQL]], '''data definition''' or '''data description language''' ('''DDL''') is a syntax for creating and modifying database objects such as tables, indices, and users. DDL statements are similar to a computer [[programming language]] for defining [[data structure]]s, especially [[database schema]]s. Common examples of DDL statements include <code>CREATE</code>, <code>ALTER</code>, and <code>DROP</code>. If you see a .ddl file, that means the file contains a statement to create a table. Oracle SQL Developer contains the ability to export from an ERD generated with Data Modeler to either a .sql file or a .ddl file.
==History==
Line 17 ⟶ 18:
The ''create'' command is used to establish a new database, table, index, or [[stored procedure]].
The ''CREATE'' statement in [[SQL]] creates a component in a [[relational database management system]] (RDBMS). In the SQL 1992 specification, the types of components that can be created are schemas, [[table (database)|tables]], [[View (database)|views]], domains, [[character set]]s, [[collation]]s, translations, and assertions.<ref name="SQL92" /> Many implementations extend the syntax to allow creation of additional elements, such as [[Database index|indexes]] and user profiles. Some systems, such as [[PostgreSQL]] and [[Microsoft SQL Server|SQL Server]], allow ''CREATE'', and other DDL commands, inside a [[database transaction]] and thus they may be [[rollback (data management)|rolled back]].<ref>{{cite web |last1=Laudenschlager |first1=Douglas |last2=Milener |first2=Gene |last3=Guyer |first3=Craig |last4=Byham |first4=Rick |title=Transactions (Transact-SQL) |url=https://docs.microsoft.com/en-us/sql/t-sql/language-elements/transactions-transact-sql?view=sql-server-2017 |website=Microsoft Docs |publisher=Microsoft |access-date=12 November 2018}}</ref><ref>{{cite web |title=PostgreSQL Transactions |url=https://www.postgresql.org/docs/8.3/tutorial-transactions.html |website=PostgreSQL 8.3 Documentation |date=7 February 2013 |publisher=PostgreSQL |access-date=12 November 2018}}</ref>
====CREATE TABLE statement====
Line 37 ⟶ 38:
first_name VARCHAR(50) not null,
last_name VARCHAR(75) not null,
dateofbirth DATE not null
);
Line 69 ⟶ 70:
For example, the command to drop a table named '''employees''' is:
<syntaxhighlight lang="
DROP TABLE employees;
</syntaxhighlight>
Line 92 ⟶ 93:
The ''TRUNCATE'' statement is used to delete all data from a table. It's much faster than ''DELETE''.
<syntaxhighlight lang="sql">
TRUNCATE TABLE table_name;
</syntaxhighlight>
Line 101 ⟶ 102:
==Other languages==
* [[XML Schema (W3C)|XML Schema]] is an example of a DDL for [[XML]].
* [[JSON#
* [[Data_Format_Description_Language|DFDL schema]] is an example of a DDL that can describe many text and binary formats.
==See also==
Line 117 ⟶ 119:
==External links==
* [https://oracletutorial.net/alter-table-modify-column-oracle.html Oracle ALTER TABLE MODIFY column] {{Webarchive|url=https://web.archive.org/web/20210421200756/https://oracletutorial.net/alter-table-modify-column-oracle.html |date=2021-04-21 }}
* [https://oracletutorial.net/dml-ddl-commands-in-oracle.html#ddl-commands-in-oracle DDL Commands In Oracle] {{Webarchive|url=https://web.archive.org/web/20210421203338/https://oracletutorial.net/dml-ddl-commands-in-oracle.html#ddl-commands-in-oracle |date=2021-04-21 }}
{{Database}}
[[Category:Articles with example SQL code]]
|