SQL

 

  1. Customer segment that generates maximum profit

Select MAX (Profit), Customer Segment From ‘TABLE 1’

2. Most expensive shipping mode of 2012

Select MAX (Shipping Cost), Ship Mode from ‘Table 1’

3. Product that was sold the most in 2012

SELECT `Product Name`, count (`Product Name`) as COUNT

FROM `TABLE 1`

group by `Product Name`

order by count DESC

limit 1

4. Product sold the least in 2012

SELECT `Product Name`, count (`Product Name`) as COUNT, `Order Date`, EXTRACT(YEAR FROM `Order Date`) AS OrderYear

FROM `TABLE 1`

where Year(`Order Date`) =’2012′

group by `Product Name`, OrderYear

order by count ASC

5. Customer who bought most of the supplies over 2012

SELECT `Customer Name`,`Sales`,`Order Date`

FROM `TABLE 1`

where Year(`Order Date`)=’2012′

group by `Customer Name`

Order by sales DESC

Leave a Reply

Your email address will not be published. Required fields are marked *