Skip to content

Data Definition Language

  • CREATE
  • ALTER
  • DROP

CREATE

CREATE TABLE [table name] ( [column definitions] ) [table parameters]
CREATE TABLE employees (
    id            INTEGER       PRIMARY KEY,
    first_name    VARCHAR(50)   not null,
    last_name     VARCHAR(75)   not null,
    mid_name      VARCHAR(50)   not null,
    dateofbirth   DATE          not null
);

ALTER

ALTER objecttype objectname parameters.
ALTER TABLE sink ADD bubbles INTEGER;
ALTER TABLE sink DROP COLUMN bubbles;

DROP

DROP objecttype objectname.
DROP TABLE employees;

TRUNCATE

  • The TRUNCATE statement is used to delete all data from a table. It's much faster than DELETE.
TRUNCATE TABLE table_name;