MSDN

SQL Data Definition

Overview

The Data Definition Language (DDL) in SQL is used to define and modify database schema objects such as tables, indexes, views, and procedures. DDL statements are central to establishing the structure that stores and organizes data.

On this page

Key Concepts

DDL statements are transactional in most modern relational database systems, meaning they can be rolled back if part of a larger transaction.

Primary DDL Statements

StatementDescription
CREATE TABLEDefines a new table and its columns.
ALTER TABLEModifies an existing table (add column, change datatype, etc.).
DROP TABLERemoves a table and its data.
CREATE INDEXCreates an index to improve query performance.
DROP INDEXDeletes an existing index.
CREATE VIEWDefines a virtual table based on a query.
DROP VIEWRemoves a view.
CREATE SCHEMACreates a new schema to group objects.

Security Considerations

DDL operations require elevated permissions. Grant only the necessary rights using roles such as db_ddladmin or custom permissions.

GRANT CREATE TABLE TO [UserA];
DENY DROP ANY SCHEMA TO [UserB];