250+ TOP MCQs on SQL Queries and Answers

RDBMS Questions and Answers for Campus interviews on “Sql Queries”.

1. Delete the accounts and loans of Downtown branch.

Answer: delete from depositor where account_number IN
(select account_number from account where branch_name=’Downtown’);

delete from account where branch_name=’Downtown’;

delete from borrower where loan_number IN
(select loan_number from loan where branch_name=’Downtown’);

delete from loan where branch_name=’Downtown’;

2. Add a column phoneNo to customer table.

Answer: alter table customer add phoneNo numeric(10);

3. Change the size of the branch_city to varchar(20).

Answer: aLTER TABLE branch ALTER COLUMN branch_city type varchar(20);

4. Drop the column phoneNo from customer table.

Answer: aLTER TABLE customer drop phoneNo;

5. For all customers who have a loan from the bank, find their names, loan numbers, and loan amount.

Answer: select customer_name,loan_number,amount from borrower
natural join loan;

6. Find the customer names, loan numbers, and loan amounts, for all loans at the Perryridge branch.

Answer: select customer_name,loan_number,amount from depositor
natural join loan where loan.branch_name=’Perryridge’;

7. For all customers who have a loan from the bank, find their names and loan numbers with the attribute loan_number replaced by loan_id.

Answer: select customer_name,loan_number as loan_id,amount from depositor
natural join loan;

8. Find the names of all branches that have assets greater than atleast one branch located in Brooklyn.

Answer: select branch_name from branch where assets >
(select min(assets) from branch where branch_city = ‘Brooklyn’);

9. Find the names of all customers whose street address includes the substring ‘Main’.

Answer: select customer_name from customer where customer_street
like ‘%Main%’;

10. List loan data, ordered by decreasing amounts, then increasing loan numbers.

  250+ TOP MCQs on Accessing SQL From a Programming Language

Answer: select * from loan order by amount desc, loan_number asc;

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top