Professional Documents
Culture Documents
IIT2021106
NULI SUJITHA
Branch :
Customer :
Loan :
Borrower :
Account :
Depositor :
QUESTION 1:
Find the names of all customers who have a loan, an account, or both, from the bank and
who live in city Brooklyn.
QUERY :
RESULT :
QUESTION 2 :
Find the names of all customers who have a loan at the Perryridge branch of amount greater
than $2000.
QUERY :
RESULT :
QUESTION 3:
Find the names of all customers who have an account at the Perryridge branch but do not
have a loan at any branch of the bank.
QUERY :
RESULT :
QUESTION 4:
QUERY :
RESULT :
QUESTION 5:
Find all customers who have at least two accounts at the perryridge branch.
QUERY :
RESULT :
QUESTION 6;
Find all branches that have greater assets than some branch located in Brooklyn.
QUERY :
RESULT :
QUESTION 7 :
Increase all accounts with balances over $10,000 by 6%, all other accounts receive 5%.
QUERY :
RESULT :
QUESTION 8 :
Find all customers who have an account at all the branches located in Brooklyn.
QUERY :
RESULT :
CODE :
branch_city varchar(255),
assets int
);
CREATE TABLE customer(
customer_street varchar(255),
customer_city varchar(255)
);
branch_name varchar(255),
amount int,
);
customer_name varchar(255),
loan_number varchar(255),
);
branch_name varchar(255),
balance int,
);
customer_name varchar(255),
account_number int,
);
SELECT customer_name
FROM borrower
OR
-- Find the names of all customers who have a loan at the Perryridge branch of amount
-- Find the names of all customers who have an account at the Perryridge branch but do not
AND
customer_name NOT IN (SELECT customer_name FROM borrower);
-- Find all customers who have at least two accounts at the perryridge branch.
WHERE
account_number IN
-- Find all branches that have greater assets than some branch located in Brooklyn.
-- Increase all accounts with balances over $10,000 by 6%, all other accounts receive 5%.
UPDATE account
SET balance =
CASE
END;
-- Find all customers who have an account at all the branches located in Brooklyn.
SELECT d.customer_name
FROM depositor d
GROUP BY d.customer_name
SELECT COUNT(*)
FROM branch