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] :

CommandUse of CommandExplanation
CREATE DATABASE <database-name> ;
Creating DatabaseTo create new database we use this command.
DROP DATABASE <database-name> ;
Deleting TableCommand is used to drop complete table
CREATE TABLE <table-name> (
Creating TableNew table is created using this command inside a database
DROP TABLE <table-name> ;
Deleting TableCommand used to delete any database table
ALTER TABLE <table-name>
ADD <field-name> <data-type>
Alter TableCommand is used to Add/remove/modify table record

Summary of Data Definition Language

Create DatabaseUsed to Create Database
Drop DatabaseDelete Complete Database (including all tables) / Drop Database
Create TableCreating table inside database
Drop TableTo delete any table from the database
Create IndexUsed to create index
GrantUsed to grant access privileges to user