Data Definition Language (DDL)


Data Definition Language (DDL) is SQL commands that are used to create, alter, and remove database objects.

  • defines database structure
  • database itself is an object
    •  inside the database are other objects:
      • tables and views
  • MySQL documentation: Data Definition Statements
  • e.g.,
CREATE TABLE City (
   ID INTEGER,
   Name VARCHAR(15),
   Population INTEGER
);
  • Common DDL commands:
    • CREATE
      • create objects
    • ALTER
      • modify objects
    • RENAME
      • rename objects
    • DROP
      • remove objects
    • TRUNCATE
      • remove all records from a table