Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table users(
- id serial PRIMARY KEY,
- email text NOT NULL,
- screen_name text NOT NULL,
- first_name text,
- last_name text);
- create table post(
- id serial Primary key,
- title text NOT NULL,
- content text NOT NULL,
- users_id integer references users(id),
- timePosted timestamp default current_timestamp
- );
- create table tags(
- id serial PRIMARY KEY,
- tag_text text NOT NULL);
- create table comments(
- id serial Primary key,
- user_id integer references users(id),
- post_id integer references post(id),
- commentText text NOT NULL
- );
- Create table post_comments(
- post_id integer references post(id),
- comment_id integer references comments(id),
- Ref_comment_id integer references comments(id)
- );
- Create table post_tags(
- post_id integer references post(id),
- tags_id integer references tags(id)
- );
- INSERT INTO users (email, screen_name, first_name) VALUES ('pikachu@gmail.com', 'Pikachu', 'Bob');
- INSERT INTO users (email, screen_name, first_name) VALUES ('evie@gmail.com', 'Evie', 'Bobby');
- INSERT INTO users (email, screen_name, first_name) VALUES ('squirtle@gmail.com', 'Squirtle', 'Robert');
- insert into post (title, content, users_id) VALUES ('Crispy chicken', 'I burnt some chicken today. It was delicious.', 1);
- insert into post (title, content, users_id) VALUES ('Waterfalls', 'Saw the most beautiful waterfall yesterday. Can''t wait to go back.', 2);
- insert into post (title, content, users_id) VALUES ('Water Slides', 'OMG these are the beeeeeeeeest.', 3);
- insert into comments (user_id, post_id, commenttext) VALUES (3, 2, 'Take me with you next time.');
- insert into comments (user_id, post_id, commenttext) VALUES (1, 2, 'I don''t really like water');
- insert into comments (user_id, post_id, commenttext) VALUES (1, 3, 'No really, I don''t like water at all.');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement