
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
What are the DDL commands in DBMS?
Data definition language (DDL) is a language that allows the user to define the data and their relationship to other types of data.
Data Definition language statements work with the structure of the database table.
Various data types used in defining columns in a database table
Integrity and value constraints
Viewing, modifying and removing a table structure
DDL Commands
The Data Definition Languages (DDL) Commands are as follows −
Create − It is used to create a new table or a new database.
Alter − It is used to alter or change the structure of the database table.
Drop − It is used to delete a table, index, or views from the database.
Truncate − It is used to delete the records or data from the table, but its structure remains as it is.
Rename − It is used to rename an object from the database.
When you create a table, you have to specify the following −
Table name.
Name of each column.
Data type of each column.
Size of each column.
Data types
When a table is created, each column in the table is assigned a data type.
Some of the important data types are as follows −
Varchar2
Char
Number
DDL Commands with example
Let’s see each DDL command with an example.
Create
It is used to create a new table or a new database.
An example of the create command is as follows −
create table student(stdname varchar(20) , branch varchar(20),college varchar(20), age number, telephone number, address varchar(20));
A student table is created with the fields given below −
Stdname | Branch | College | Age | Telephone | Address |
---|---|---|---|---|---|
Alter
It is used to alter or change the structure of the database table
An example of the alter command is as follows −
ALTER TABLE student ADD birthdate DATETIME
Drop
It is used to delete a table, index, or views from the database.
An example of the drop command is as follows −
DROP TABLE student
- Related Articles
- What are the DML commands in DBMS?
- What are the DCL commands in DBMS?
- What are the TCL commands in DBMS?
- Difference between DDL and DML in DBMS.
- Data Definition Commands in DBMS
- Data Manipulation Commands in DBMS
- What are Shell Commands?
- What are the different commands used in MySQL?
- What are the Pre-processor Commands in C language?
- What are the useful commands in JShell in Java 9?
- What are the different "/edit" commands in JShell in Java 9?
- What are the different "/types" commands in JShell in Java 9?
- What are the different "/vars" commands in JShell in Java 9?
- What are the components of DBMS?
- What are the applications of DBMS?
