RDBMS Questions and Answers – SQL Queries – I

This set of RDBMS Multiple Choice Questions & Answers (MCQs) focuses on “SQL Queries – I”.

1. List all branch names and their assests
View Answer

Answer: select branch_name, assets from branch;

2. List all accounts of Brooklyn branch
View Answer

Answer: select account_number from account natural join branch where branch_city=’Brooklyn’;

3. List all loans with amount > 1000.
View Answer

Answer: select * from loan where amount>1000;
advertisement

4. List all accounts of Perryridge branch with balance < 1000.
View Answer

Answer: select account_number from account where branch_name=’Perryridge’ and balance < 1000;

5. List Numbers of accounts with balances between 700 and 900
View Answer

Answer: select count(account_number) from account where balance > 700 and balance < 900;
Free 30-Day Python Certification Bootcamp is Live. Join Now!

6. Change the assests of Perryridge branch to 340000000.
View Answer

Answer: update branch set assets = 340000000 where branch_name=’Perryridge’;

7. Transfer the accounts and loans of Perryridge branch to Downtown branch.
View Answer

Answer: update account set branch_name=’Downtown’ where branch_name=’Perryridge’;
update loan set branch_name=’Downtown’ where branch_name = ‘Perryridge’;

8. Transfer Rs. 100 from account A-101 to A-215.
View Answer

Answer: update account
set balance = case
when account_number=’A-101′ then balance-100
when account_number=’A-215′ then balance+100
else balance
end;

9. Delete the branch Perryridge.
View Answer

Answer: delete from account where branch_name=’Perryridge’;
delete from branch where branch_name=’Perryridge’;
delete from loan where branch_name=’Perryridge’;
advertisement

10. Waive off all the loans with amount < 1000.
View Answer

Answer: delete from borrower where loan_number in
(select loan_number from loan where amount<1000);
delete from loan where amount<1000;

Sanfoundry Global Education & Learning Series – RDBMS.

To practice all areas of RDBMS, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
I’m Manish - Founder and CTO at Sanfoundry. I’ve been working in tech for over 25 years, with deep focus on Linux kernel, SAN technologies, Advanced C, Full Stack and Scalable website designs.

You can connect with me on LinkedIn, watch my Youtube Masterclasses, or join my Telegram tech discussions.

If you’re in your 40s–60s and exploring new directions in your career, I also offer mentoring. Learn more here.