stijn leenknegt
By: a guest | Jan 19th, 2010 | Syntax:
SQL | Size: 0.50 KB | Hits: 89 | Expires: Never
CREATE TABLE gebruikers (
id integer NOT NULL PRIMARY KEY,
naam varchar(40) NOT NULL UNIQUE,
geboortedatum date NOT NULL CHECK(extract(year FROM geboortedatum) >= 1950)
);
CREATE TABLE topics(
id integer NOT NULL PRIMARY KEY,
gebruiker integer NOT NULL,
titel varchar(50) NOT NULL,
topic text NOT NULL,
geplaatstOp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(gebruiker) REFERENCES gebruikers(id)
ON UPDATE cascade
ON DELETE restrict
);