You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
666 B
SQL
30 lines
666 B
SQL
BEGIN TRANSACTION;
|
|
DROP TABLE IF EXISTS "quotecategory" CASCADE;
|
|
DROP TABLE IF EXISTS "author" CASCADE;
|
|
DROP TABLE IF EXISTS "quote" CASCADE;
|
|
DROP TABLE IF EXISTS "category" CASCADE;
|
|
CREATE TABLE author(
|
|
aid SERIAL PRIMARY KEY,
|
|
fname TEXT,
|
|
lname TEXT
|
|
);
|
|
CREATE TABLE quote(
|
|
qid SERIAL PRIMARY KEY,
|
|
qtext TEXT,
|
|
aid INTEGER,
|
|
source TEXT,
|
|
qdate DATE,
|
|
FOREIGN KEY (aid) REFERENCES Author(aid)
|
|
);
|
|
CREATE TABLE category(
|
|
cid SERIAL PRIMARY KEY,
|
|
description TEXT
|
|
);
|
|
CREATE TABLE quotecategory(
|
|
qid INTEGER,
|
|
cid INTEGER,
|
|
FOREIGN KEY(qid) REFERENCES Quote(qid),
|
|
FOREIGN KEY(cid) REFERENCES Category(cid)
|
|
);
|
|
COMMIT;
|