Data Definition Language

Definition & Meaning

DDL meaning

Last updated 23 month ago

What is Data Definition Language (DDL)?

What does DDL stand for?

A statistics defiNition language (DDL) is a Laptop language used to create and alter the structure of Database Objects in a Database. These Database Objects consist of perspectives, Schemas, Tables, Indexes, and many others.

This time period is also called Records description language in a few Contexts, because it describes the Fields and inFormation in a database table.

What Does Data Definition Language Mean?

The gift database enterprise contains DDL into any formal language describing records. However, it's far taken into consideration to be a subset of SQL (Structured Query Language). SQL often Makes use of vital verbs with everyday English along with sentences to implement database adjustments. Hence, DDL does no longer display up as a specific language in an SQL database, however does define cHanges in the Database Schema.

It is used to set up and adjust the shape of gadgets in a database by means of handling descriptions of the database schema. Unlike statistics manipulation language (DML) instructions that are used for records change Functions, DDL instructions are used for changing the database structure along with growing new tables or gadgets together with all their Attributes (statistics type, table name, and so on.).

Commonly used DDL in SQL Querying are CREATE, ALTER, DROP, and Truncate.

Create

This Command Builds a brand new table and has a predefined Syntax. The CREATE announcement syntax is:

CREATE TABLE [table name] ([column definitions]) [table Parameters];

For example:

CREATE TABLE Employee (Employee Id Integer Primary Key, First call CHAR (50) Null, Last call CHAR (sEventy five) NOT NULL);

The obligatory semi-colon at the quit of the assertion is used to manner each command before it. In this situation, the String CHAR is used to specify the records kind. Other statistics types may be DATE, NUMBER, or INTEGER.

Alter

An alter command modifies an Current database table. This command can Upload up extra column, drop present columns or even trade the facts form of columns concerned in a database table.

An regulate command syntax is:

ALTER object type object call parameters;

For example:

ALTER TABLE Employee ADD PRIMARY KEY (employee_pk);

In this example, we delivered a unique primary key to the desk to add a Constraint and put into effect a unique price. The constraint “employee_pk” is a primary key and is on the Employee desk.

Drop

A drop command is used to delete objects along with a desk, index or View. A DROP Statement can't be rolled lower back, so once an object is destroyed, there’s no manner to get better it.

Drop announcement syntax is:

DROP item kind object call;

For example:

DROP TABLE Employee;

In this case, we’re deleting the Employee table.

Truncate

Similar to DROP, the TRUNCATE announcement is used to fast remove all information from a table. However, in contrast to DROP that absolutely destroys a desk, TRUNCATE preserves its full shape to be reused later.

Truncate announcement syntax is:

TRUNCATE TABLE table_name;

For example:

TRUNCATE TABLE Employee;

In this situation, we’re marking all of the extents of the Employee desk for deallocation, so they’re considered empty for reuse.

Other statements

Other typically used commands include RENAME and Comment. The first one is used with the ALTER TABLE announcement to trade the name of an object (desk, column, etc.). COMMENT is used to feature single line, multi-line and in-line remarks.

Share Data Definition Language article on social networks

Your Score to Data Definition Language article

Score: 5 out of 5 (1 voters)

Be the first to comment on the Data Definition Language

2523- V4

tech-term.com© 2023 All rights reserved