Skip to topics
tee / insights
LEARNING / SQL

DDL / Data Definition Language

SQL DDL: Data definition

Create, change or remove database structures. Start with tables, column types and namespaces, then define reusable views and functions.

Topics in this category

Create tables and namespaces

CREATE TABLE defines columns and types. CTAS creates a table from SELECT results, so read both the definition and the query.

Change or remove structures

ALTER TABLE changes definitions such as columns. DROP TABLE removes the table itself, unlike DELETE or TRUNCATE, which remove rows.

Define views, functions and procedures

A view defines a query; a UDF defines reusable computation. Distinguish creating a function with CREATE FUNCTION from calling it in SELECT or another statement.