Question 1 DBMS Placements and SQL Practice

For Complete YouTube Video: Click Here

We will try to solve Question 1 DBMS Placements and SQL Practice, in this class.

The Database Management Systems DBMS is the prerequisite course to understand the concepts we discuss.

These kinds of questions are frequently asked in the campus placement’s written tests. All these questions are asked in service-based companies like Wipro, Infosys, CTS, TCS, Accenture, IBM, and many more service-based companies.

Question 1 DBMS Placements and SQL Practice

custnoaccountnoifsccodelocationamountaccounttype
C30110530002231BANK0001053Mysore140000Savings
C30212340004235BANK0001234Delhi225000Current
C30387900002367BANK0008790Bangalore79000Savings
C30456630003454BANK0005663Bangalore152000Current
C30578390002343BANK0007839Delhi73000Savings

A, B are given the requirements to retrieve account details and sort details according to location (alphabetically) and in decreasing order of the amount in each account of that location.

A’s Query

SELECT custno, accountno, ifsccode, location, amount, accounttype FROM account ORDER BY location ASC, amount DESC;

B’s Query

SELECT custno, accountno, ifsccode, location, amount, accounttype FROM account ORDER BY 5 DESC, 4 ASC;

Whose query will be correct to satisfy the above requirement? 

  1. Neither A nor B                   
  2. Both A and B  
  3. Only B  
  4. Only A

A detailed explanation of the above question is made in the above youtube link.