Question
Part 1. Write relational algebra queries to answer questions (1) to (10). Your answer to each question should consist of a single relational algebra query.
Part 1. Write relational algebra queries to answer questions (1) to (10). Your answer to each question should consist of a single relational algebra query. You may use input relation names to differentiate between attributes with the same name in the results of a join or Cartesian product (such as referring to Employee.firstName or Customer.firstName in the results of the Cartesian product of Employee and Customer).
The database has 7 tables. The following shows their schemas.
Customer = {customerID, firstName, lastName, brithDate, income}
Account = {accNumber, type, balance, branchNumberFK-Branch}
Owns = {customerIDFK-Customer, accNumberFK-Account}
Transactions = {transNumber, accNumberFK-Account, amount, date, description}
Employee = {sin, firstName, lastName, salary, startDate, branchNumberFK-Branch}
PersonalBanker = {customerIDFK-Customer, sinFK-Employee}
Branch = {branchNumber, branchName, street, numberEmployees, managerSINFK-Employee, budget}
1. The customer IDs, first names, last names and incomes of customers who have an account at a branch with a budget no more than $1,000,000
2. The first and last names of customers who were born after 1st of January 1985 and whose income is less than $75,000.
3. The SINs, first and last names and salaries of employees who are both personal bankers and managers
4. The customer IDs of customers who own a joint account (an account that is owned by more than one customer)
5. The customer IDs of customers whose accounts have no transactions with amounts of which the absolute value is less than $5,000 (i.e. all their transactions are either greater than or equal to $5,000 or less than or equal to -$5,000).
6.The branch names of branches that employ at least one employee whose last name is "Martin", and at least one employee whose last name is "Wang"; note that branch name is not a candidate key
7. The SINs and salaries of employees who earn more than the manager of their branch
8. The first names, last names and birth dates of customers who own an account in the Vancouver branch and the first names, last names and start dates of employees who work in the Vancouver branch (i.e. one query that returns one list of first and last names and dates of these 2 groups of people)
9. The customer IDs of customers who have personal bankers in either the Vancouver or Metrotown branches (note that the personal bankers must be distinct employees as an employee only works at one branch)
10. You are to find the SINs, and first and last names of employees who own an account in the branch in which they work.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started