Search⌘ K

DDL vs. DML

Explore the distinctions between Data Definition Language (DDL) and Data Manipulation Language (DML) in SQL. Understand how to create and modify database objects with DDL and manipulate data with DML commands, including advanced operations like MERGE. Gain insights into how these commands function within systems like BigQuery to maintain data consistency and optimize data workflows.

SQL statements are broadly categorized into two groups: Data Definition Language (DDL) and Data Manipulation Language (DML).

DDL

DDL is a set of commands used to create, modify, and delete database objects such as tables, views, indexes, and constraints. Here are a few DDL commands:

  • CREATE: Create new database objects such as tables.

  • ALTER: Modify existing database objects such as adding or removing columns from the table.

  • DROP: Delete a database object such as a table or index.

  • TRUNCATE: Delete all data from a table without deleting the table itself.

  • RENAME: Rename an existing database object, ...