-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/RGGH/surrealtest
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
REMOVE table driver; | ||
REMOVE table team; | ||
REMOVE table scored; | ||
|
||
DEFINE TABLE team SCHEMALESS PERMISSIONS NONE; | ||
CREATE team SET name="Alpine"; | ||
CREATE team SET name="Aston Martin"; | ||
CREATE team SET name="Ferrari"; | ||
CREATE team SET name="Haas"; | ||
CREATE team SET name="Sauber"; | ||
CREATE team SET name="McLaren"; | ||
CREATE team SET name="Mercedes"; | ||
CREATE team SET name="RB"; | ||
CREATE team SET name="Red Bull"; | ||
CREATE team SET name="Williams"; | ||
|
||
DEFINE TABLE drivers SCHEMALESS PERMISSIONS NONE; | ||
CREATE driver SET name="Pierre Gasly",team.name=Alpine; | ||
CREATE driver SET name="Esteban Ocon",team.name=Alpine; | ||
|
||
|
||
Let $dn = SELECT VALUE id from driver where name="Pierre Gasly"; | ||
Let $tn = SELECT VALUE id FROM team where name="Alpine"; | ||
RELATE $dn->scored->$tn | ||
CONTENT { | ||
2024: { | ||
Dubai: { | ||
finished: 18 | ||
}, | ||
Saudi: { | ||
finished: 18 | ||
}, | ||
} | ||
}; | ||
|
||
Let $dn = SELECT VALUE id from driver where name="Esteban Ocon"; | ||
|
||
RELATE $dn->scored->$tn | ||
CONTENT { | ||
2024: { | ||
Dubai: { | ||
finished: 19 | ||
}, | ||
Saudi: { | ||
finished: 17 | ||
}, | ||
} | ||
}; | ||
|
||
|
||
Let $tn = SELECT VALUE id FROM team where name="Alpine"; | ||
|
||
-- race result scored by Alpine Drivers in Dubai - 2024 | ||
SELECT in.name as driver,2024.Dubai.finished FROM scored; | ||
|
||
-- race result scored by Alpine Drivers in Saudi - 2024 | ||
SELECT in.name as driver,2024.Saudi.finished FROM scored; |