Enforce data rules using NOT NULL, UNIQUE, CHECK, PRIMARY KEY and FOREIGN KEY constraints.
CREATE TABLE team_members (team_id INTEGER, user_id INTEGER, PRIMARY KEY (team_id, user_id));Enforce data rules using NOT NULL, UNIQUE, CHECK, PRIMARY KEY and FOREIGN KEY constraints.
CREATE TABLE ... (column type NOT NULL, UNIQUE (...), CHECK (...), FOREIGN KEY (...) REFERENCES ...);Enforce data rules using NOT NULL, UNIQUE, CHECK, PRIMARY KEY and FOREIGN KEY constraints.
CREATE TABLE team_members (team_id INTEGER, user_id INTEGER, PRIMARY KEY (team_id, user_id));SQLite-oriented example; consult the relevant dialect manual.
CREATE TABLE team_members (team_id INTEGER, user_id INTEGER, PRIMARY KEY (team_id, user_id));| Option / clause | Description |
|---|---|
Object name | Name a table, view, index, schema or database. |
Column definition | Specify column name, data type and default value. |
Constraints | Use NOT NULL, UNIQUE, CHECK, PRIMARY KEY or FOREIGN KEY as needed. |
IF EXISTS / IF NOT EXISTS | Make create/drop operations conditional where supported. |
CASCADE / RESTRICT | Control dependent-object handling where supported; verify before destructive changes. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.