-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviews.sql
31 lines (26 loc) · 811 Bytes
/
views.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
29
30
31
CREATE VIEW Place AS
(SELECT ID, name FROM CITY)
UNION
(SELECT ID, name FROM COUNTRY)
UNION
(SELECT ID, name FROM CONTINENT);
CREATE VIEW Organisation AS
(SELECT id, name FROM UNIVERSITY)
UNION
(SELECT id, name FROM COMPANY);
CREATE VIEW Message AS
(SELECT id, creationDate, browserUsed, locationIP, content, length, creator, locatedIn FROM COMMENT)
UNION
(SELECT id, creationDate, browserUsed, locationIP, content, length, creator, locatedIn FROM POST);
CREATE VIEW Messagetags AS
(SELECT post, tag FROM POSTTAG)
UNION
(SELECT comment, tag FROM COMMENTTAG);
CREATE VIEW Messagelikes AS
(SELECT post, pid AS Person FROM POSTLIKES)
UNION
(SELECT comment, pid AS Person FROM COMMENTLIKES);
CREATE VIEW pkp_symmetric (pid, friend) AS
(SELECT pid, knows FROM KNOWS)
Union
(SELECT knows, pid FROM KNOWS)