-
Notifications
You must be signed in to change notification settings - Fork 1
/
database.sql
28 lines (25 loc) · 926 Bytes
/
database.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE TABLE user (
username VARCHAR PRIMARY KEY,
password NVARCHAR320 NOT NULL,
email VARCHAR NOT NULL,
fullname VARCHAR NOT NULL,
profile_pic varbinary(MAX),
score INTEGER NOT NULL,
);
CREATE TABLE post (
id INTEGER PRIMARY KEY,
username VARCHAR NOT NULL REFERENCES user,
title VARCHAR NOT NULL,
fulltext VARCHAR NOT NULL,
post_votes INTEGER NOT NULL,
);
CREATE TABLE comments (
id INTEGER PRIMARY KEY,
post_id INTEGER NOT NULL REFERENCES post,
username VARCHAR NOT NULL REFERENCES user,
text VARCHAR NOT NULL,
comments_votes INTEGER NOT NULL,
);
INSERT INTO user VALUES ('Maria','12345678','[email protected]', 'Maria Ribeiro', null, 0);
INSERT INTO user VALUES ('vw','12','[email protected]', 'João Pereira', null, 0);
INSERT INTO user VALUES ('tixa','1234','[email protected]', 'Patrícia Rocha', null, 0);