Skip to content
MySQL

DDL API Reference

MySQL Data Definition Language for creating and altering tables, indexes and constraints.

By EZ4Code Team

DDL

Statements that define or modify the database schema.

CREATE TABLE [IF NOT EXISTS] tbl (col type [constraints], ...)

Creates a new table with the given columns and table-level constraints.

Returns: void

ALTER TABLE tbl ADD [COLUMN] col type | DROP COLUMN col | MODIFY col type

Adds, removes or modifies columns and constraints on an existing table.

Returns: void

CREATE [UNIQUE] INDEX name ON tbl (col, ...) [USING BTREE]

Creates a secondary index on one or more columns to speed up lookups; UNIQUE enforces uniqueness.

Returns: void

CONSTRAINT name PRIMARY KEY|FOREIGN KEY|UNIQUE|CHECK (cols)

Table-level constraint clause enforcing integrity rules on one or more columns.

Returns: void

More MySQL API References