Skip to content

Commit 5cce95c

Browse files
authored
Create experimental.surql
used for creating demo to understand use of Let and use of Graph edge
1 parent 0264f5e commit 5cce95c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

experimental.surql

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
REMOVE table driver;
2+
REMOVE table team;
3+
REMOVE table scored;
4+
5+
DEFINE TABLE team SCHEMALESS PERMISSIONS NONE;
6+
CREATE team SET name="Alpine";
7+
CREATE team SET name="Aston Martin";
8+
CREATE team SET name="Ferrari";
9+
CREATE team SET name="Haas";
10+
CREATE team SET name="Sauber";
11+
CREATE team SET name="McLaren";
12+
CREATE team SET name="Mercedes";
13+
CREATE team SET name="RB";
14+
CREATE team SET name="Red Bull";
15+
CREATE team SET name="Williams";
16+
17+
DEFINE TABLE drivers SCHEMALESS PERMISSIONS NONE;
18+
CREATE driver SET name="Pierre Gasly",team.name=Alpine;
19+
CREATE driver SET name="Esteban Ocon",team.name=Alpine;
20+
21+
22+
Let $dn = SELECT VALUE id from driver where name="Pierre Gasly";
23+
Let $tn = SELECT VALUE id FROM team where name="Alpine";
24+
RELATE $dn->scored->$tn
25+
CONTENT {
26+
2024: {
27+
Dubai: {
28+
finished: 18
29+
},
30+
Saudi: {
31+
finished: 18
32+
},
33+
}
34+
};
35+
36+
Let $dn = SELECT VALUE id from driver where name="Esteban Ocon";
37+
38+
RELATE $dn->scored->$tn
39+
CONTENT {
40+
2024: {
41+
Dubai: {
42+
finished: 19
43+
},
44+
Saudi: {
45+
finished: 17
46+
},
47+
}
48+
};
49+
50+
51+
Let $tn = SELECT VALUE id FROM team where name="Alpine";
52+
53+
-- race result scored by Alpine Drivers in Dubai - 2024
54+
SELECT in.name as driver,2024.Dubai.finished FROM scored;
55+
56+
-- race result scored by Alpine Drivers in Saudi - 2024
57+
SELECT in.name as driver,2024.Saudi.finished FROM scored;

0 commit comments

Comments
 (0)