Need to write Queries -- 2
Budget: $25 – $50 USD
Suppose we have a part of a Bank database schema consisting of the relations (the keys are in bold and underlined):
EMPLOYEE(E SSN, first name, last name, address, start date, phone#, manager_SSN)
BRANCH(branch name, City, Assets)
ACCOUNT(account#, branch, balance, account type,interest rate, overdraft, banker SSN)
CUSTOMER(C SSN, first name, last name, address)
TRANSACTION(transaction code, transaction_type, description, charge)
CUSTOMER¬_ACCOUNT(C SSN, account#, date)
TRANSACTION_INSTANCES(transaction_code, transaction#, account#, date, time, amount)
Note that an account can belong to more than one customer and a customer can open more than one account. The table CUSTOMER_ACCOUNT links an account to a customer. The table TRANSACTION contains the list of all possible transactions, and the attribute transaction type in transaction says if the transaction is a debit or credit transaction. The table ACCOUNT_TRANSACTION records for each account all the transactions performed.
Express the following queries in Algebra (1 to 4), Calculus (1 to 4) and SQL (all).
1. List the accounts with no transaction since October 1st, 2021.
2. List customers (C_SSN, first name, last name) of the “Broad Street”.
3. List customers (C_SSN, first name, last name) having an account in Newark (one or more accounts).
4. List customers (C_SSN, first name, last name) having no account in Newark.
5. List customers (C_CSN, first name, last name) having accounts in every branch in Newark.
6. List the name of the employee who has the maximum number of customers in charge.
EMPLOYEE(E SSN, first name, last name, address, start date, phone#, manager_SSN)
BRANCH(branch name, City, Assets)
ACCOUNT(account#, branch, balance, account type,interest rate, overdraft, banker SSN)
CUSTOMER(C SSN, first name, last name, address)
TRANSACTION(transaction code, transaction_type, description, charge)
CUSTOMER¬_ACCOUNT(C SSN, account#, date)
TRANSACTION_INSTANCES(transaction_code, transaction#, account#, date, time, amount)
Note that an account can belong to more than one customer and a customer can open more than one account. The table CUSTOMER_ACCOUNT links an account to a customer. The table TRANSACTION contains the list of all possible transactions, and the attribute transaction type in transaction says if the transaction is a debit or credit transaction. The table ACCOUNT_TRANSACTION records for each account all the transactions performed.
Express the following queries in Algebra (1 to 4), Calculus (1 to 4) and SQL (all).
1. List the accounts with no transaction since October 1st, 2021.
2. List customers (C_SSN, first name, last name) of the “Broad Street”.
3. List customers (C_SSN, first name, last name) having an account in Newark (one or more accounts).
4. List customers (C_SSN, first name, last name) having no account in Newark.
5. List customers (C_CSN, first name, last name) having accounts in every branch in Newark.
6. List the name of the employee who has the maximum number of customers in charge.