Question 32a
4 March 2025 · Computer Science (083)
Suman has created a table named WORKER with a set of records to maintain the data of the construction sites, which consists of WID, WNAME, WAGE, HOURS, TYPE, and SITEID. After creating the table, she entered data in it, which is as follows:
| WID | WNAME | WAGE | HOURS | TYPE | SITEID |
|---|---|---|---|---|---|
| W01 | Ahmed J | 1500 | 200 | Unskilled | 103 |
| W11 | Naveen S | 520 | 100 | Skilled | 101 |
| W02 | Jacob B | 780 | 95 | Unskilled | 101 |
| W15 | Nihal K | 560 | 110 | Semiskilled | NULL |
| W10 | Anju S | 1200 | 130 | Skilled | 103 |
(a) Based on the data given above, answer the following questions:
(i) Write the SQL statement to display the names and wages of those workers whose wages are between 800 and 1500. (ii) Write the SQL statement to display the record of workers whose SITEID is not known (iii) Write the SQL statement to display WNAME, WAGE and HOURS of all those workers whose TYPE is 'Skilled'. (iv) Write the SQL statement to change the WAGE to 1200 of the workers where the TYPE is "Semiskilled".
Answer
(i) SELECT WNAME, WAGE FROM WORKER WHERE WAGE BETWEEN 800 AND 1500;
(ii) SELECT * FROM WORKER WHERE SITEID IS NULL;
(iii) SELECT WNAME, WAGE, HOURS FROM WORKER WHERE TYPE="Skilled";
(iv) UPDATE WORKER SET WAGE=1200 WHERE TYPE="Semiskilled";