数据库课当中,有一个重要的节点是讲述关系代数(Relational Algebra)的查询(query),感觉挺重要也挺有意思的,现来道例题仔细分析:
Schema: branch (branch_name, branch_city, assets) customer
(customer_name, customer_street, customer_city) account
(account_number, branch_name, balance) loan (loan_number, branch_name,
amount) depositor (customer_name, account_number) borrower
(customer_name, loan_number)
Q1: Find all loans of over $120
Q2: Find the loan number for each loan of an amount greater than $1200
Q3: Find the names of all customers who have a loan, an account, or both, from the bank
Q4: Find the names of all customers who have a loan at the Perryridge branch but do not have an account at any branch of the bank.
Q5: Find the names of all customers who have a loan at the Perryridge branch (multi-solution).
Q6: Find the largest account balance
Q7: Find the names of all customers who have a loan an