SQL DDL : Data Definition Language



Data Definition Language in Structured Query Language (SQL) :

  1. Data Definition Language is also known as “Data Description Language”.
  2. Data Definition Language is used to define Data and Objects in a Database.
  3. Data Definition Language Commands are used to make entries in the Data Dictionary.
  4. Data Definition Language is used to define –
    • Data and Objects in Database
    • Tables in a Database
    • Database Structure
  5. Generally DDL Commands are used for Data Administration.

Some Commands Used in Data Definition Language [DDL Commands] :

Command Use of Command Explanation
CREATE DATABASE <database-name> ;
Creating Database To create new database we use this command.
DROP DATABASE <database-name> ;
Deleting Table Command is used to drop complete table
CREATE TABLE <table-name> (
...
);
Creating Table New table is created using this command inside a database
DROP TABLE <table-name> ;
Deleting Table Command used to delete any database table
ALTER TABLE <table-name>
ADD <field-name> <data-type>
Alter Table Command is used to Add/remove/modify table record

Summary of Data Definition Language

Command Explanation
Create Database Used to Create Database
Drop Database Delete Complete Database (including all tables) / Drop Database
Create Table Creating table inside database
Drop Table To delete any table from the database
Create Index Used to create index
Grant Used to grant access privileges to user