Overview

Basics

Data Definition

CREATE TABLE

CREATE TABLE <table name> (
  <attribute1> <domain>,
  <attribute2> <domain>,
  <attribute3> <domain>,
  [Table Constraints]
);

Example:

CREATE TABLE Employee (
  empID INT(9) NOT NULL,
  name VARCHAR(100) NOT NULL,
  salary DOUBLE(10,2),
  age INT(3),
  department CHAR(4),
  PRIMARY KEY (empID),
  FOREIGN KEY (department) REFERENCES Department(code)
);

Constraints

SQL Domains