Skip to content
Snippets Groups Projects
Commit 432f4acc authored by Maria Hartmann's avatar Maria Hartmann
Browse files

part 1: database script

parent 14d14789
No related branches found
No related tags found
No related merge requests found
CREATE TABLE twitter_user (
id serial PRIMARY KEY
, handle text NOT NULL UNIQUE
);
CREATE TABLE hashtag (
id serial PRIMARY KEY
, hash_tag_text text NOT NULL
);
CREATE TABLE tweet (
id serial PRIMARY KEY
, retweet_count int NOT NULL DEFAULT 0
, favorite_count int NOT NULL DEFAULT 0
, tweet_text text NOT NULL
, tweet_time timestamp NOT NULL
, original_author text
, CONSTRAINT vorgaenger_ID FOREIGN KEY(id) REFERENCES tweet(id)
);
CREATE TABLE tweet_hat_hashtag (
FK_tweet integer
, FK_hashtag integer
, hashtag_text text NOT NULL
, FOREIGN KEY(FK_tweet) REFERENCES tweet(id) ON UPDATE CASCADE ON DELETE CASCADE
, FOREIGN KEY(FK_hashtag) REFERENCES hashtag (id) ON UPDATE CASCADE ON DELETE CASCADE
, PRIMARY KEY (FK_tweet, FK_hashtag)
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment