Class Xi Practical Assignment Mysql
Class Xi Practical Assignment Mysql
Class Xi Practical Assignment Mysql
1. Create the following table named "Charity" and write SQL queries for the tasks that follow:
Table: Charity
(Contribution is in Rs.)
2. Consider the table "Grocer" and write SQL queries for the tasks that follow:
Table: Grocer
4. Consider the following table named "GYM" with details about Fitness products being sold in
the store.
Table Name : GYM
PrCode stores Codes of Products
PrName stores names of Products
(UnitPrice is in Rs.)
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.
Using DISTINCT Clause
11. Display the amounts of various loans from the table Loan_Accounts. A loan amount should appear
only once.
12. Display the number of instalments of various loans from the table Loan_Accounts. An instalment
should appear only once.
Using Logical Operators (NOT, AND, OR)
13. Display the details of all the loans started after 31-12-2008 for which the number of instalments
are more than 36.
14. Display the Cust_Name and Loan_Amount for all the loans which do not have number of
instalments 36.
15. Display the Cust_Name and Loan_Amount for all the loans for which the loan amount is less than
500000 or int_rate is more than 12.
16. Display the details of all the loans which started in the year 2009.
17. Display the details of all the loans whose Loan_Amount is in the range 400000 to 500000.
18. Display the details of all the loans whose rate of interest is in the range 11% to 12%.
Using IN Operator
19. Display the Cust_Name and Loan_Amount for all the loans for which the number of instalments are
24, 36, or 48. (Using IN operator)
Using BETWEEN Operator
20. Display the details of all the loans whose Loan_Amount is in the range 400000 to 500000. (Using
BETWEEN operator)
21. Display the details of all the loans whose rate of interest is in the range 11% to 12%. (Using
BETWEEN operator)
Using LIKE Operator
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 the second last character.
Using ORDER BY clause
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 the descending order of their Start_Date.
Using UPDATE, DELETE, ALTER TABLE
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.
32. For each loan replace Interest with (Loan_Amount*Int_Rate*Instalments) 12*100.
33. Delete the records of all the loans whose start date is before 2007.
34. Delete the records of all the loans of 'K.P. Jain'
35. Add another column Category of type CHAR(1) in the Loan table.
7. Write SQL commands for the following on the basis of given table relation Teacher.
a) To show all information about the teacher of history department.
b) To list the names of female teachers who are in Hindi department.
c) To list names of all teachers with their date of joining in ascending order.
8. Consider the Empl table and write SQL command to get the following:
a) Write a query to display EName and Sal of employees whose salary are greater than or equal to
2200?
b) Write a query to display details of employs who are not getting commission?
c) Write a query to display employee name and salary of those employees who don’t have their
salary in range of 2500 to 4000?
d) Write a query to display the name, job title and salary of employees who don’t have manager?
e) Write a query to display the name of employee whose name contains “A” as third alphabet?
f) Write a query to display the name of employee whose name contains “T” as last alphabet?
g) Write a query to display the name of employee whose name contains ”M” as First and “L” as
third alphabet?
h) Write a query to display details of employees with the text “Not given”, if commission is null?