KnowledgeBoat Logo
|

Informatics Practices

Consider the following table FITNESS with details about fitness products being sold in the store. Write command of SQL for (i) to (iv).

Table : FITNESS

PCODEPNAMEPRICEManufacturer
P1Treadmill21000Coscore
P2Bike20000Aone
P3Cross Trainer14000Reliable
P4Multi Gym34000Coscore
P5Massage Chair5500Regrosene
P6Belly Vibrator Belt6500Ambawya

(i) To display the names of all the products with price more than 20000.

(ii) To display the names of all products by the manufacturer "Aone".

(iii) To change the price data of all the products by applying 25% discount reduction.

(iv) To add a new row for product with the details :

"P7", "Vibro Exerciser", 28000, "Aone".

SQL Queries

13 Likes

Answer

(i)

SELECT PNAME FROM FITNESS WHERE PRICE > 20000;
Output
+-----------+
| PNAME     |
+-----------+
| Treadmill |
| Multi Gym |
+-----------+

(ii)

SELECT PNAME 
FROM FITNESS 
WHERE MANUFACTURER = "Aone";
Output
+-------+
| PNAME |
+-------+
| Bike  |
+-------+

(iii)

UPDATE FITNESS
SET PRICE = PRICE * 0.75;

(iv)

INSERT INTO FITNESS 
VALUES("P7", "Vibro Exerciser", 28000, "Aone");

Answered By

6 Likes


Related Questions