You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
Sample Queries
print icon

Below are some simple example queries to get you started with the Headset data model.

 

Revenue, units, and profit for each store in June 2020

select
    store_name,
    sum(revenue) as revenue,
    sum(quantity) as units,
    sum(profit) as profit
from headset.retail_share.sales
where sold_date between '2020-06-01' and '2020-07-01'
group by 1;

 

Top 10 products by unit sales on 8/2/2020

select
 product_name,
 sum(quantity)
 from headset.retail_share.sales
where sold_date between '2020-08-02' and '2020-08-03'
group by 1
order by 2 desc
limit 10;

 

Brands that have had the most cartridge returns in 2020

select
  brand,
  vendor,
  sum(quantity) as returned_units
from headset.retail_share.sales
where 
    receipt_type='REFUND'
    and category in ('Cartridge','Cartridges')
    and date_part(year,sold_date)=2020
group by 1,2
order by 3;

 

Current inventory by category

select
    category,
    sum(quantity_in_stock) as quantity_in_stock
from headset.retail_share.products
group by 1
order by 2 desc;

 

Feedback
0 out of 0 found this helpful

scroll to top icon