A gist to be used with relax for queries in the relational algebra, https://dbis-uibk.github.io/relax/
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
-- To be used with RelaX: https://dbis-uibk.github.io/relax/calc.htm | |
-- https://dbis-uibk.github.io/relax/calc/gist/02c807c63faf1d57d77f487d6a0726f4 | |
group: bank example | |
description[[ Sample data for crash course on the Relational Model. | |
* Relation _Customer_ contains identifiers and names of customers of a bank. | |
* Relation _Account_ contains identifiers, customer IDs, types and balances of bank accounts. Note that a customer can have any number of accounts, while each account is owned by exactly one customer. | |
* Relation _BadAccount_ contains information about accounts and customers in one place. | |
* Query _SampleQuery_ return names of customers with high balances. | |
]] | |
Customer = { cid, name | |
1 Miller | |
2 Miller | |
42 Smith | |
} | |
Account = { aid cid type balance | |
1 42 Checking 1000 | |
2 42 Savings 2000 | |
3 1 Checking -300 | |
42 2 Savings 10000000 | |
} | |
BadAccount = { aid date cid type balance custage | |
1 2015-01-01 42 Checking 1000 42 | |
2 2015-01-01 42 Savings 2000 42 | |
3 2015-01-01 1 Checking -300 22 | |
1 2015-01-02 42 Checking 960 43 | |
} | |
SampleQuery = | |
pi name, balance ( | |
Customer | |
join | |
sigma balance > 1000000 (Account) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment