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.
26 lines
502 B
SQL
26 lines
502 B
SQL
BEGIN TRANSACTION;
|
|
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;
|