Consider the table LOANS given below:
Table: LOANS
| AccNo |
Name |
Loan Amt |
EMI |
IntRate |
Start Date |
Interest |
| 1001 |
R.K. Gupta |
300000 |
36 |
12.00 |
19-07-2009 |
1200 |
| 1002 |
S. P. Shanna |
500000 |
48 |
10.00 |
22-03-2008 |
1800 |
| 1003 |
K.P. Jain |
300000 |
36 |
NULL |
08-03-2007 |
1600 |
| 1004 |
M.P. Yadav |
800000 |
60 |
10.00 |
06-12-2008 |
2250 |
| 1005 |
S.P. Sinlia |
200000 |
36 |
12.50 |
03-01-2010 |
4500 |
| 1006 |
P. Shanna |
700000 |
60 |
12.50 |
05-06-2008 |
3500 |
| 1007 |
K.S. Dhall |
500000 |
48 |
NULL |
05-03-2008 |
3800 |
(a)
State the command that will give the output as:
| Name |
| S. P. Shanna |
| K.S. Dhall |
| M.P. Yadav |
| P. Shanna |
| K.S. Dhall |
(i)
Select name from LOANS where Name >‘D ’;
(ii)
Select name from LOANS where AccNo >1001;
(iii)
Select name from LOANS where Loan_Amt >= 500000;
(iv)
Select name from LOANS where Loan_Amt >500000 order Loan_AmtDESC;
(b)
What will be the output of the following command:
Select name, EMI from LOANS where Loan_Amt >500000 and Int_Rate is NULL;
(c)
John has given the following command to display the count of all loan holders whose name ends with “Sharma ”:
Select count() from LOANS where Name like ‘Sharma%’;
But he is not getting the desired result. Help him by finding out the correct command fromthe followings:
(i)
Select count(*) from LOANS where name Like ‘Sharma%’;
(ii)
Select count(*) from LOANS where name Like ‘%Sharma ’;
(iii)
Select count( ) from LOANS where name like ‘%sharma ’;
(iv)
Select count(Name) from LOANS where name ‘Sharma%’;
(d)
State the command to display the maximum Loan_Amt and Cust_Name :-
(i)
Select Max(Cust_Name, Loan_Amt) from LOANS;
(ii)
Select Cust_Name, max(LoanAmt) from LOANS;
(iii)
Select Cust_Name, max(Loan_Amount) from LOANS;
(iv)
Select Cust_name, max(Loan_Amt) from LOANS;
(e)
Help Ramesh to display the count of all loan holders whose interest is NULL.
(i)
Select Count(*) from LOANS where Int_Rate is NULL.
(ii)
Select Count() from LOANS where Interest is NULL.
(iii)
Select Count(*) from LOANS where Int_rate = NULL;
(iv)
Select Count( ) from LOANS where Interest = NULL;