Get the step-by-step solution for this question inside the Vidyadip app.
Get the answer in the appGenerate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.
Consider the following tables Product and Client. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)
TABLE: PRODUCT
| P_ID | Product Name | Manufacturer | Price |
| TP01 | Talcom Powder | LAK | 40 |
| FW05 | FaceWash | ABC | 45 |
| BS01 | Bath Soap | ABC | 55 |
| SH06 | Shampoo | XYZ | 120 |
| FW12 | Face Wash | XYZ | 95 |
TABLE: CLIENT
| C_ID | ClientName | City | P_ID |
| 01 | Cosmetic Shop | Delhi | FW05 |
| 06 | Total Health | Mumbai | BS01 |
| 12 | Live Life | Delhi | SH06 |
| 15 | Pretty Woman | Delhi | FW12 |
| 16 | Dreams | Bangalore | TP01 |
(i) To display the details of those Clients whose City is Delhi
(ii) To display the details of Products whose Price is in the range of 50 to 100 (Both values included)
(iii) To display the ClientName, City from Table Client, and ProductName and Price from table Product, with their corresponding matching P_ID
(iv) To increase the Price of all Products by 10
(v) SELECT DISTINCT CITY FROM Client;
(vi) SELECT Manufacturer, MAX(Price), Min(Price), Count(*) FROM Product GROUP BY Manufacturer;
(vii) SELECT ClientName, ManufacturerName FROM Product, Client WHERE Client.Prod_Id = Product.P_Id;
Table: Bank
| AccNo | Cust_name | FD_Amount | Months | Int_Rate | FD_Date |
| 1001 | Arti Gupta | 30000 | 36 | 6.00 | 2018-07-01 |
| 1002 | Dilip Lal | 50000 | 48 | 6.75 | 2018-03-22 |
| 1003 | Navin Gupta | 30000 | 36 | NULL | 2018-03-01 |
| 1004 | D.P. Yadav | 80000 | 60 | 8.25 | 2017-06-12 |
| 1005 | Jyoti Sharma | 20000 | 36 | 6.50 | 2017-01-31 |
| 1006 | Rakesh Kumar | 70000 | 60 | 8.25 | 2018-06-15 |
| 1007 | K.D. Singh | 50000 | 48 | NULL | 2018-07-05 |
| 1008 | Anjali Sharma | 60000 | 48 | 6.75 | 2017-04-02 |
| 1009 | Swati Garg | 40000 | 42 | 6.50 | 2018-06-15 |
| 1010 | Rupinder Kaur | 25000 | 36 | 6.50 | 2018-09-27 |
Write SQL commands for the statements (a) to (g) on the table BANK
(a) To create the table Bank (Primary Key: AccNo)
(b) Display the structure of the table Bank.
(c) Display the details of all the bank.
(d) Display the AccNo, Cust_Name, and FD_Amount.
(e) Display the details of all the FD’s having maturity time is less than 40 months.
(f) Display the AccNo and FD amount which started before 01-04-2018.
(g) Display details of all FD whose rate of interest are NULL.
Table: TEACHER
| TID | NAME | AGE | DEPT | DATEOFJOIN | SAL | SEX |
| T118 | Navin | 40 | Computer | 2010-01-10 | 12000 | M |
| T107 | Chetna | 37 | History | 2008-03-24 | 20000 | F |
| T105 | Sandeep | 46 | Maths | 2006-12-12 | 30000 | M |
| T110 | Sangeeta | 35 | History | 2010-07-01 | 25000 | F |
| T101 | Rudransh | 42 | Maths | 2004-09-05 | 40000 | M |
| T121 | Neeraj | 38 | Physics | 2011-04-01 | 28000 | M |
(i) To show information about the teachers of the history department.
(ii) To list the names of teachers earning a salary between 20000 and 30000.
(iii) To count the number of male teachers.
(iv) Display gender wise total number of teachers.
(v) To list the name and age of teachers of female teachers in descending order of date of join.
(vi) Increase the salary by 10% for Maths departments.
( vii) To delete the record of teacher Neeraj.