Write commands in SQL for (i) to (iv) and outPut for (v) and (vi),
Table : Store
Storeld |
Name |
Location |
City |
No Of Employees |
DateOpened |
SalesAmount |
S101 |
Planetfashion |
Karol Bagh |
Delhi |
7 |
2015-10-16 |
300000 |
S102 |
Trends |
Nehru Nagar |
Mumbai |
11 |
2015-08-09 |
400000 |
S103 |
Vogue |
Vikas Vihar |
Delhi |
10 |
2015-06-27 |
200000 |
S104 |
Superfashion |
Defence Colony |
Delhi |
8 |
2015-02-18 |
450000 |
S105 |
Rage |
Bandra |
Mumbai |
5 |
2015-09-22 |
600000 |
(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;