KnowledgeBoat Logo
|

Informatics Practices

Write SQL commands for (a) to (d) and write the output for (e) on the basis of the following table:

Table: FURNITURE

S NOITEMTYPEDATEOFSTOCKPRICEDISCOUNT
1WhiteLotusDoubleBed2002-02-23300025
2PinkfeathersBabyCot2002-01-29700020
3DolphinBabyCot2002-02-19950020
4DecentOfficeTable2002-02-012500030
5ComfortzoneDoubleBed2002-02-122500030
6DonaldBabyCot2002-02-24650015

(a) To list the details of furniture whose price is more than 10000.

(b) To list the Item name and Price of furniture whose discount is between 10 and 20.

(c) To delete the record of all items where discount is 30.

(d) To display the price of 'Babycot'.

(e) Select Distinct Type from Furniture;

Relational Database

4 Likes

Answer

(a)

SELECT * FROM FURNITURE
WHERE PRICE > 10000;
Output
+----+-------------+-------------+-------------+-------+----------+
| NO | ITEM        | TYPE        | DATEOFSTOCK | PRICE | DISCOUNT |
+----+-------------+-------------+-------------+-------+----------+
|  4 | Decent      | OfficeTable | 2002-02-01  | 25000 |       30 |
|  5 | Comfortzone | DoubleBed   | 2002-02-12  | 25000 |       30 |
+----+-------------+-------------+-------------+-------+----------+

(b)

SELECT ITEM, PRICE
FROM FURNITURE
WHERE DISCOUNT BETWEEN 10 AND 20;
Output
+--------------+-------+
| ITEM         | PRICE |
+--------------+-------+
| Pinkfeathers |  7000 |
| Dolphin      |  9500 |
| Donald       |  6500 |
+--------------+-------+

(c)

DELETE FROM FURNITURE WHERE DISCOUNT = 30;

(d)

SELECT PRICE
FROM FURNITURE
WHERE TYPE = 'BabyCot';
Output
+-------+
| PRICE |
+-------+
|  7000 |
|  9500 |
|  6500 |
+-------+

(e)

SELECT DISTINCT Type FROM Furniture;
Output
+-------------+
| Type        |
+-------------+
| DoubleBed   |
| BabyCot     |
| OfficeTable |
+-------------+

Answered By

3 Likes


Related Questions