1.

Write commands in SQL for (i) to (iv) and outPut for (v) and (vi),                                Table : Store    StoreldNameLocationCityNo Of EmployeesDateOpenedSalesAmountS101PlanetfashionKarol BaghDelhi72015-10-16300000S102TrendsNehru NagarMumbai112015-08-09400000S103VogueVikas ViharDelhi102015-06-27200000S104SuperfashionDefence ColonyDelhi82015-02-18450000S105RageBandraMumbai52015-09-22600000(i) To display name, location, city, SalesAmount of stores in descending order of SalesAmount.(ii) To display names of stores along with SalesAmount of those stores that have 'fashion' anywhere in their store names.(iii) To display Stores names, Location and Date Opened of stores that were opened before 1st March, 2015.(iv) To display total SalesAmount of each city along with city name.(v) SELECT distinct city FROM store;(vi) SELECT Name, length (name), left (name,3) From Store where NoOfEmployees<3;

Answer»

(i) Select Name, Location, City, SalesAmount From Store Order By SalesAmount desc.

(ii) select Name, salesAmount From store where Name like '% fashion%'

(iii) Select Name, Location, Date Opened From Store Where Date Opened <'2015 -03 - 01'

(iv) Select SVM (SalesAmount), City from store group by City'

(v) distinct (CitY) Delhi Mumbai

(vi) Name, length (name) left (name, 3) No. output



Discussion

No Comment Found

Related InterviewSolutions