Minggu, 08 Juli 2018

Sponsored Links

SQL : Data Definition Language - YouTube
src: i.ytimg.com

A data definition language or the data description language ( DDL ) is a syntax similar to the language computer programming to determine the data structure, especially database schema.


Video Data definition language



Histori

The concept of the data definition language and its name was first introduced in relation to the Codasyl database model, where the database schema is written in a language syntax that describes records, fields, and sets of user data models. Then it is used to refer to the section of Structured Query Language (SQL) to declare tables, columns, data types and constraints. SQL-92 introduces a scheme of language manipulation and schema information tables into a demand scheme. This information table is defined as SQL/Schemata in SQL: 2003. The term DDL is also used in a general sense to refer to any formal language to describe data or information structures.

Maps Data definition language



Structured request language

Many data description languages ​​use declarative syntax to specify columns and data types. Structured query languages ​​(eg, SQL), however, use a collection of verb imperatives whose effect is to modify database schema by adding, modifying, or deleting table definitions or other elements. These statements can be freely mixed with other SQL statements, making DDL not a separate language.

Create a CREATE statement

The create command is used to create 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 1992 SQL specification, the types of components that can be created are schema, tables, views, domains, character sets, gathering, translations, and statements. Many implementations expand the syntax to allow creation of additional elements, such as index and user profiles. Some systems, such as PostgreSQL and SQL Server, allow CREATE , and other DDL commands, in database transactions and thus they can be restored.

CREATE TABLE statement

The common CREATE command is the CREATE TABLE command. Typical uses are:

 CREATE TABLE  [table name]  ( [column definition] )  [table parameter]   

The definition of columns is:

  • A comma-separated list consisting of one of the following
  • Definition column: [column name] [data type] {NULL | NOT NULL} {column options}
  • Primary key definition: PRIMARY KEY ( [comma-separated list of columns] )
  • Restrictions: {CONSTRAINT} [constraint definition]
  • special RDBMS function

An example statement to create a table named employee with multiple columns is:

Some forms of CREATE TABLE DDL can combine constructs such as -DML (data manipulation language), such as the CREATE TABLE AS SELECT syntax (SQL) from SQL.

DROP statement

The DROP statement destroys an existing database, table, index, or view.

The DROP statement in SQL removes components from a relational database management system (RDBMS). The types of objects that can be derived depend on the RDBMS used, but most support tables, users, and database degradation. Some systems (such as PostgreSQL) allow DROP and other DDL commands to occur within transactions and thus be restored. Usage is generally just:

 DROP  objecttype   object name .  

For example, the command to put tables named employees is:

The DROP statement differs from the DELETE and TRUNCATE statements, in which case DELETE and TRUNCATE I did not delete the table itself. For example, the DELETE statement may delete some (or all) data from the table when leaving the table itself in the database, whereas the statement removes the entire table from the database.

ALTER statement

The ALTER statement modifies the existing database object.

The ALTER statement in SQL transforms the object property within the relational database management system (RDBMS). The types of objects that can be changed depend on the RDBMS used. Typical uses are:

 ALTER  objecttype   objectname   parameter .  

For example, the command to add (then delete) a column named bubble to an existing table named sink is:

TRUNCATE statement

The TRUNCATE statement is used to delete all data from the table. This is much faster than DELETE .

Reference integrity statement

Another type of DDL sentence in SQL is used to define referential integrity relationships, usually implemented as primary keys and foreign key tags in multiple table columns. Both of these statements can be included in CREATE TABLE or the sentence ALTER TABLE .

Academic Year 2014 Spring. - ppt video online download
src: slideplayer.com


Other languages ​​

  • XML Schema is an example of DDL for XML.

Data Definition Language (DDL) statements in sql - YouTube
src: i.ytimg.com


See also

  • Data control language
  • Language data manipulation
  • Language query data
  • Select (SQL)
  • Insert (SQL)
  • Update (SQL)
  • Delete (SQL)
  • Truncate (SQL)

Hadoop Component Hive, Online Hadoop Course
src: s3.amazonaws.com


References

Source of the article : Wikipedia

Comments
0 Comments