Data Definition Language
Learn how to define, modify, and remove database structures using DDL commands like CREATE, ALTER, and DROP.
We'll cover the following...
Imagine we’re architects, but instead of buildings, we design structures to hold information. Before we can furnish a house with sofas and tables (our data), we first need to build the foundation, walls, and rooms. In the world of databases, this is exactly what the data definition language (DDL) allows us to do. It’s the set of tools we use to build and manage the very blueprint of our database.
By the end of this lesson, we will be able to:
Understand the role of DDL in defining the database structure.
Use the
CREATEcommand to build new tables with appropriate data types and constraints.Use the
ALTERcommand to modify the structure of existing tables.Use the
DROPcommand to remove database tables.
Let’s get ready to lay the foundation for our data!
Data definition language (DDL)
Data definition language (DDL) is a subset of SQL commands used to define and manage the structure of our database and its objects, like tables. Think of it as the language we use to communicate the architectural plans of our database to the Database Management System (DBMS). The three core DDL commands are:
CREATE: Used to create new database objects, such as tables.ALTER: Used to modify the structure of an existing database object. ...