MySql Worksheet
MySql Worksheet
Write SQL commands for the tasks 1 to 35 and write the output for the SQL commands 36 to 40:
Create Database and use it
1. Create the database LOANS.
2. Use the database LOANS.
Simple Select
4. Display the details of all the loans.
5. Display the AccNo, Cust_Name, and Loan_Amount of all the loans.
Conditional Select using Where Clause
6. Display the details of all the loans with less than 40 instalments.
7. Display the AccNo and Loan_Amount of all the loans started before 01-04-2009.
8. Display the Int_Rate of all the loans started after 01-04-2009.
Using NULL
9. Display the details of all the loans whose rate of interest is NULL.
10. Display the details of all the loans whose rate of interest is not NULL.
21. Display the details of all the loans whose rate of interest is in the range 11% to 12%.
22. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name ends with
'Sharma'.
23. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name ends with 'a'.
24. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name contains 'a'
25. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name does not
contain 'P'.
26. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name contains 'a' as
27. Display the details of all the loans in the ascending order of their Loan_Amount.
28. Display the details of all the loans in the descending order of their Start_Date.
29. Display the details of all the loans in the ascending order of their Loan_Amount and within Loan_Amount in
30. Put the interest rate 11.50% for all the loans for which interest rate is NULL.
31. Increase the interest rate by 0.5% for all the loans for which the loan amount is more than 400000.
33. Delete the records of all the loans whose start date is before 2007.
35. Add another column Category of type CHAR(1) in the Loan table