Question: consider the following relational database defined below create table branch( branch_name varchar(30) branch_city varchar(30) assets numeric(14,2) primary key(branch_name)); create table customer( customer_number char(10), customer_name varchar(30)
consider the following relational database defined below
create table branch(
branch_name varchar(30)
branch_city varchar(30)
assets numeric(14,2)
primary key(branch_name));
create table customer(
customer_number char(10),
customer_name varchar(30) not null,
customer_city varchar(30),
primary key(customer_number));
create table loan(
loan_number char(10),
branch_name varchar(30),
amount numeric(11,2),
primary key(loan_number),
foreign key(branch_name) references branch);
create table borrower(
customer_number char(10),
loan_number char(10),
primary key(customer_number,loan_number),
foreign key(customer_number) references customer
foreign key(loan_number) references loan));
Express in SQL each of the following queries:
Find the name(s) of the branch(s) that has/have the largest amount of assets (i.e., branches whose amount of assets is equal to or larger than the amount of assets of every other branch).
Find the customer number (i.e., ID) of every customer that shares all of the loans that customer 1234 has. If the customer whose customer number is 1234 has loans L1 and L2, you need to find all customers (including customer 1234) that share both L1 and L2.
Find the name of each branch that manages more than 1000 loans. (b) (10 points) For each loan whose amount is greater than $1,000,000, show the loan number (i.e., ID) and the number (i.e., count) of customers sharing that loan
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
