Skip to content

Commit f9a3dc7

Browse files
mirkospasicvi
authored andcommitted
SQL queries
1 parent ec11a3b commit f9a3dc7

File tree

10 files changed

+82
-46
lines changed

10 files changed

+82
-46
lines changed

ldbc_socialnet_qgen/sib/int_sql/query1.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
select top 10 p_personid, p_lastname, p_birthday, p_creationdate, p_gender, p_browserused,
1+
select top 10 cast (p_personid as varchar), p_lastname, p_birthday, p_creationdate, p_gender, p_browserused,
22
bit_shift(bit_and(p_locationip, 4278190080), -24) || '.' ||
33
bit_shift(bit_and(p_locationip, 16711680), -16) || '.' ||
44
bit_shift(bit_and(p_locationip, 65280), -8) || '.' ||
@@ -22,4 +22,4 @@ where
2222
p_personid = pc_personid and
2323
pc_organisationid = o3.o_organisationid and
2424
o3.o_placeid = p3.pl_placeid
25-
order by p_lastname, p_personid
25+
order by p_lastname, 1

ldbc_socialnet_qgen/sib/int_sql/query10.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ select top 10 p_firstname, p_lastname,
1111
ps_creatorid = p_personid and ps_postid = pst_postid and
1212
not exists (select * from person_tag where pt_personid = @Person@ and pt_tagid = pt1.pst_tagid)
1313
) as score,
14-
p_personid, p_gender, pl_name
14+
cast (p_personid as varchar), p_gender, pl_name
1515
from person, place,
1616
( select distinct k2.k_person2id
1717
from knows k1, knows k2
@@ -26,4 +26,4 @@ case month(p_birthday) when @HS0@ then (case when dayofmonth(p_birthday) > 21 th
2626
when @HS1@ then (case when dayofmonth(p_birthday) < 22 then 1 else 0 end)
2727
else 0
2828
end
29-
order by 3 desc, p_personid
29+
order by 3 desc, 4

ldbc_socialnet_qgen/sib/int_sql/query11.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
select top 10 p_firstname, p_lastname, pc_workfrom, o_name, p_personid
1+
select top 10 p_firstname, p_lastname, pc_workfrom, o_name, cast (p_personid as varchar)
22
from person, person_company, organisation, place,
33
( select k_person2id
44
from knows
@@ -17,4 +17,4 @@ where
1717
pc_workfrom < @Date0@ and
1818
o_placeid = pl_placeid and
1919
pl_url = '@Country@'
20-
order by pc_workfrom, p_personid, o_name
20+
order by pc_workfrom, p_personid, 5
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
select top 20 p_personid, p_firstname, p_lastname, t_name, count(*)
1+
select top 20 cast (p_personid as varchar), p_firstname, p_lastname, t_name, count(*)
22
from person, comment, knows, post, post_tag, tag_tagclass, tagclass, tag
33
where
4-
k_person1id = @Person@ and
5-
k_person2id = p_personid and
6-
p_personid = c_creatorid and
7-
c_replyofpost = ps_postid and
8-
ps_postid = pst_postid and
9-
pst_tagid = t_tagid and
10-
pst_tagid = ttc_tagid and
11-
ttc_tagclassid = tc_tagclassid and
12-
tc_url = '@TagType@'
13-
group by p_personid, p_firstname, p_lastname, t_name
14-
order by 5 desc, p_personid, t_name
4+
k_person1id = @Person@ and
5+
k_person2id = p_personid and
6+
p_personid = c_creatorid and
7+
c_replyofpost = ps_postid and
8+
ps_postid = pst_postid and
9+
pst_tagid = t_tagid and
10+
pst_tagid = ttc_tagid and
11+
ttc_tagclassid = tc_tagclassid and
12+
tc_url = '@TagType@'
13+
group by 1, p_firstname, p_lastname, t_name
14+
order by 5 desc, 1, t_name
1515

1616

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
select top 20 p_personid, p_firstname, p_lastname, ps_postid, ps_content || ps_imagefile, ps_creationdate
2-
from person, post, knows
3-
where
1+
select top 20 *
2+
from (
3+
select p_personid as personid, p_firstname as firstname, p_lastname as lastname,
4+
cast (ps_postid as varchar) as id, ps_content || ps_imagefile as content, ps_creationdate as creationdate
5+
from person, post, knows
6+
where
47
p_personid = ps_creatorid and
58
ps_creationdate <= stringdate('@Date0@') and
69
k_person1id = @Person@ and
710
k_person2id = p_personid
8-
order by ps_creationdate desc, ps_postid
11+
union
12+
select p_personid as personid, p_firstname as firstname, p_lastname as lastname,
13+
cast (c_commentid as varchar) as id, c_content as content, c_creationdate as creationdate
14+
from person, comment, knows
15+
where
16+
p_personid = c_creatorid and
17+
c_creationdate <= stringdate('@Date0@') and
18+
k_person1id = @Person@ and
19+
k_person2id = p_personid
20+
) tmp
21+
order by creationdate desc, id

ldbc_socialnet_qgen/sib/int_sql/query3.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
select top 20 p_personid, p_firstname, p_lastname, ct1, ct2, total
1+
select top 20 cast (p_personid as varchar), p_firstname, p_lastname, ct1, ct2, total
22
from
33
( select k_person2id
44
from knows
@@ -55,5 +55,5 @@ where
5555
f.k_person2id = p_personid and p_placeid = p1.pl_placeid and
5656
p1.pl_containerplaceid = p2.pl_placeid and p2.pl_name <> '@Country1@' and p2.pl_name <> '@Country2@' and
5757
f.k_person2id = cpc.ps_c_creatorid
58-
order by 6 desc, p_personid
58+
order by 6 desc, 1
5959

ldbc_socialnet_qgen/sib/int_sql/query7.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
select top 20 p_personid, p_firstname, p_lastname, l_creationdate,
1+
select top 20 cast (p_personid as varchar), p_firstname, p_lastname, l_creationdate,
22
(case when k_person2id is null then 1 else 0 end) as is_new,
33
ps_postid, content, lag
44
from
@@ -14,4 +14,4 @@ where
1414
left join
1515
(select * from knows where k_person1id = @Person@) k
1616
on k.k_person2id = p.p_personid
17-
order by l_creationdate desc, p_personid
17+
order by l_creationdate desc, 1

ldbc_socialnet_qgen/sib/int_sql/query8.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
select top 20 *
1+
select top 20 c_creatorid, p_firstname, p_lastname, c_creationdate, cast (c_commentid as varchar), c_content
22
from
33
(
44
select c_creatorid, c_creationdate, c_commentid, c_content
@@ -12,5 +12,7 @@ from
1212
where
1313
c1.c_replyofcomment = c2.c_commentid and
1414
c2.c_creatorid = @Person@
15-
) tmp
16-
order by c_creationdate desc, c_commentid
15+
) tmp, person
16+
where
17+
p_personid = c_creatorid
18+
order by c_creationdate desc, 3
Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1-
select top 20 p_personid, p_firstname, p_lastname, ps_postid, ps_content || ps_imagefile, ps_creationdate
2-
from person, post,
3-
( select k_person2id
4-
from knows
5-
where
6-
k_person1id = @Person@
7-
union
8-
select k2.k_person2id
9-
from knows k1, knows k2
10-
where
11-
k1.k_person1id = @Person@ and k1.k_person2id = k2.k_person1id and k2.k_person2id <> @Person@
12-
) f
13-
where
14-
p_personid = ps_creatorid and p_personid = f.k_person2id and
15-
ps_creationdate < stringdate('@Date0@')
16-
order by ps_creationdate desc, ps_postid
1+
select top 20 personid, firstname, lastname, cast (id as varchar), content, creationdate
2+
from (
3+
select p_personid as personid, p_firstname as firstname, p_lastname as lastname,
4+
ps_postid as id, ps_content || ps_imagefile as content, ps_creationdate as creationdate
5+
from person, post,
6+
( select k_person2id
7+
from knows
8+
where
9+
k_person1id = @Person@
10+
union
11+
select k2.k_person2id
12+
from knows k1, knows k2
13+
where
14+
k1.k_person1id = @Person@ and k1.k_person2id = k2.k_person1id and k2.k_person2id <> @Person@
15+
) f
16+
where
17+
p_personid = ps_creatorid and p_personid = f.k_person2id and
18+
ps_creationdate < stringdate('@Date0@')
19+
union
20+
select p_personid as personid, p_firstname as firstname, p_lastname as lastname,
21+
c_commentid as id, c_content as content, c_creationdate as creationdate
22+
from person, comment,
23+
( select k_person2id
24+
from knows
25+
where
26+
k_person1id = @Person@
27+
union
28+
select k2.k_person2id
29+
from knows k1, knows k2
30+
where
31+
k1.k_person1id = @Person@ and k1.k_person2id = k2.k_person1id and k2.k_person2id <> @Person@
32+
) f
33+
where
34+
p_personid = c_creatorid and p_personid = f.k_person2id and
35+
c_creationdate < stringdate('@Date0@')
36+
) tmp
37+
order by creationdate desc, 4
1738

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1 2 3 4 5 6 7 8 9 10 11 12
1+
1 2 3 4 5 6 7 8 9 10 11

0 commit comments

Comments
 (0)