-
-
Save LaurMo/5621616 to your computer and use it in GitHub Desktop.
| CREATE TABLE users ( | |
| id integer PRIMARY KEY, | |
| name string, | |
| email string | |
| ); | |
| CREATE TABLE questions ( | |
| id integer PRIMARY KEY, | |
| question varchar, | |
| user_id integer | |
| ); | |
| CREATE TABLE comments ( | |
| id integer PRIMARY KEY, | |
| comment varchar, | |
| user_id integer, | |
| question_id integer, | |
| comment_id integer | |
| ); | |
| CREATE TABLE votes ( | |
| id integer PRIMARY KEY, | |
| comments CHECK (boolean), | |
| comment_id integer, | |
| user_id integer | |
| ); |
INSERT INTO users (1, 'Lauren', '[email protected]')
INSERT INTO users (2, 'LMo', '[email protected]')
INSERT INTO users (3, 'Mo', '[email protected]')
CREATE TABLE users (
id integer PRIMARY KEY,
name varchar,
email varchar
);
INSERT INTO questions (1, 'why')
INSERT INTO questions (2, 'who')
INSERT INTO questions (3, 'what')
CREATE TABLE questions (
id integer PRIMARY KEY,
question varchar,
user_id integer
);
INSERT INTO comments (1, 'comment 1')
INSERT INTO comments (2, 'comment 2')
INSERT INTO comments (3, 'comment 3')
CREATE TABLE comments (
id integer PRIMARY KEY,
comment varchar,
user_id integer,
question_id integer,
comment_id integer
);
INSERT INTO votes (1, t )
INSERT INTO votes (2, f )
INSERT INTO votes (3, t )
CREATE TABLE votes (
id integer PRIMARY KEY,
sentiment boolean
comment_id integer,
user_id integer
);
CREATE TABLE users (
id integer PRIMARY KEY,
name varchar,
email varchar
);
INSERT INTO users (id, name, email) VALUES
(1, 'Lauren', '[email protected]'),
(2, 'LMo', '[email protected]'),
(3, 'Mo', '[email protected]');
CREATE TABLE questions (
id integer PRIMARY KEY,
question varchar,
user_id integer
);
INSERT INTO questions (id, questions, user_id) VALUES
(1, 'why',1),
(2, 'who',1),
(3, 'what', 2);
CREATE TABLE comments (
id integer PRIMARY KEY,
comment varchar,
user_id integer,
question_id integer,
comment_id integer
);
INSERT INTO comments (id, comment, user_id, question_id, comment_id) VALUES
(1, 'millennials comment',1,2,3),
(2, 'comment from millennial',2,3,1),
(3, 'comment comment',2,2,3);
CREATE TABLE votes (
id integer PRIMARY KEY,
sentiment boolean
comment_id integer,
user_id integer
);
INSERT INTO votes (id, sentiment, comment_id, user_id) VALUES
(1, t ,1,2),
(2, f,1,2),
(3, t,2,3);
CREATE TABLE users (
id integer PRIMARY KEY,
name varchar,
email varchar
);
INSERT INTO users (id, name, email) VALUES
(1, 'Lauren', '[email protected]'),
(2, 'LMo', '[email protected]'),
(3, 'Mo', '[email protected]');
CREATE TABLE questions (
id integer PRIMARY KEY,
question varchar,
user_id integer
);
INSERT INTO questions (id, question, user_id) VALUES
(1, 'why',1),
(2, 'who',1),
(3, 'what', 2);
CREATE TABLE comments (
id integer PRIMARY KEY,
comment varchar,
user_id integer,
question_id integer,
comment_id integer
);
INSERT INTO comments (id, comment, user_id, question_id, comment_id) VALUES
(1, 'millennials comment',1,2,3),
(2, 'comment from millennial',2,3,1),
(3, 'comment comment',2,2,3);
CREATE TABLE votes (
id integer PRIMARY KEY,
sentiment boolean
comment_id integer,
user_id integer
);
INSERT INTO votes (id, sentiment, comment_id, user_id) VALUES
(1, 't' ,1,2),
(2, 'f',1,2),
(3, 't',2,3);
Updated one:
CREATE TABLE users (
id integer PRIMARY KEY,
name varchar,
email varchar
);
CREATE TABLE questions (
id integer PRIMARY KEY,
question varchar,
user_id integer
);
CREATE TABLE comments (
id integer PRIMARY KEY,
comment varchar,
user_id integer,
question_id integer,
comment_id integer
);
CREATE TABLE votes (
id integer PRIMARY KEY,
comments boolean,
comment_id integer,
user_id integer
);