In previous SQL post we had discussed about Basic SQL Concept and what is SQL Database and SQL Table.
DDL – Data Definition Language
DDL – Data Definition Language contains the commands used to create and destroy database and database objects like tables and columns.
The DDL statement is used to define the structure of database and database object.
After define the structure of Database the administrator use the DML Data Manipulation Language to insert, retrieve and modify the information or data.
DDL Statements used to create and modify the structure of tables and other objects in database.
When we execute the DDL Statement, it takes effect immediately.
Here are the list of DDL Commands :
The CREATE command is used to create new database in DBMS, and create new table in database. In other word we can say CREATE command used to create new database and table.
CREATE Command Syntax for Database:
database name = School
CREATE Command Syntax for Table :
CREATE TABLE Tablename
CREATE TABLE Student
The USE command allows you to specify the database you wish to work with within your DBMS.
The USE Command Syntax:
The ALTER command used to modify the structure of table without deleting.
We can use ADD and MODIFY command with ALTER command.
The DROP command used to remove the database object from DBMS, and delete the table from database.
The DROP Command Syntax:
DROP TABLE Tablename
DROP TABLE Student
5. TRUNCATE TABLE
The TRUNCATE TABLE command used to delete all the rows/records from entire table.
The TRUNCATE command also remove the index from columns.
The TRUNCATE TABLE Command Syntax:
TRUNCATE TABLE Tablename
TRUNCATE TABLE Student
We will learn all DDL Command in detail with our next article.