1.

Consider the table SHOPPE given below. Write Command in MySQL for (i) to  (iv) and output for (v) to (vii).                                                       Table : SHOPPECodeItemCompanyQtyCityQty102BiscuitHide & Seek100Delhi10.00103JamKishan110Kolkata25.00101CoffeeNestle200Kolkata55.00106SauceMaggi56Mumbai55.00107CakeBritania72Delhi10.00104MaggiNestle150Mumbai10.00105ChocolateCadbury170Delhi25.00(i) To display names of the items whose name starts with 'C' in ascending order of Price.(ii) To display code, Item name and City of the products whose quantity is less than 100.(iii) To count distinct Company from the table.(iv) To insert a new row in the table Shoppe '110'; Pizza', 'Papa Jones', 120, "Kolkata", 50.0(v) SELECT Item FROM SHOPPE where Item IN (''Jam" ,"Coffee");(vi) Select COUNT(distinct(City)) from SHOPPE;(vii) Select MIN(Qty) from SHOPPE where City ="Mumba";

Answer»

(i) SELECT Item FROM SHOPPE Where Item like 'c%' order by price;

(ii) SELECT Code, Item, City from Shoppe Where Qty < 100;

(iii) SELECT Count(Distinct(Company)) from SHOPPE;

(iv) Insert Into SHOPPE Values (110, 'pizza', 'papa Jones',120,'kolkata',50.0);

(v) Item jam Coffee

(vi) 3

(vii) MIN(QTY) 56



Discussion

No Comment Found

Related InterviewSolutions