Consider the following table named “GYM” with details about fitness items being sold in the store.

Write commands of SQL for
(i) To display the names of all the items whose name starts with “A”
(ii) To display ICODEs and INAMEs of all items, whose Brandname is Reliable or Coscore
(iii) To change the Brandname to “Fit Trend India” of the item, whose ICODE as “G101”.

(iv) Add a new row for new item in GYM with the details:
“G107”, “Vibro Exerciser”, 21000, “GTCFitness”

ICODEINAMEPRICEBRANDNAME
G101Power Fit Exerciser20000Power Gymea
G102Aquafit Hand Grip1800Reliable
G103Cycle Bike14000Ecobike
G104Protoner Extreame Gym30000Coscore
G105Message Belt5000Message Expert
G106Cross Trainer13000GTC Fitness

Ans:

(i) SELECT * FROM GYM WHERE INAME LIKE “A%”;

(ii) SELECT ICODE, INAME FROM GYM WHERE BRANDNAME IN (“Reliable”, “Coscore”);

(iii) UPDATE GYM SET BRANDNAME = “Fit Trend India” WHERE ICODE = “G101”;

(iv) INSERT GYM VALUES(“G107”, “Vibro Exerciser”, 21000, “GTCFitness”);

error: Content is protected !!