Iit2021034 Assignment DBMS
Iit2021034 Assignment DBMS
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 :
CREATE TABLE branch( branch_name varchar(255) PRIMARY KEY, branch_city varchar(255), assets
int
);
);
CREATE TABLE loan( loan_number int PRIMARY KEY, branch_name varchar(255), amount int,
);
);
CREATE TABLE account( account_number int PRIMARY KEY, branch_name varchar(255), balance int,
);
);
('purna','hnstreet','brooklyin');
SELECT customer_name
FROM borrower
(SELECT branch_name FROM branch WHERE branch_city = 'brooklyin'))); -- Find the names of all customers
WHERE loan_number IN(SELECT loan_number FROM loan WHERE branch_name='Perryridge' AND amount>2000);
-- Find the names of all customers who have an account at the Perryridge branch but do not
AND
-- Find all customers who have at least two accounts at the perryridge branch.
SELECT customer_name FROM depositor 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