CREATE TABLE

Define a new table schema

DDL

SQL

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  email VARCHAR(255) UNIQUE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

What each clause does

CREATE TABLE defines the schema. SERIAL is an auto-incrementing integer. PRIMARY KEY and UNIQUE enforce constraints.

Related tools

Other SQL examples