Public
Edited
May 25, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pizzeriaStaging
SELECT orderDate::date as order_date
, case when date_part('dayofweek', orderDate::date) == 0 then 'Sunday'
when date_part('dayofweek', orderDate::date) == 1 then 'Monday'
when date_part('dayofweek', orderDate::date) == 2 then 'Tuesday'
when date_part('dayofweek', orderDate::date) == 3 then 'Wednesday'
when date_part('dayofweek', orderDate::date) == 4 then 'Thursday'
when date_part('dayofweek', orderDate::date) == 5 then 'Friday'
when date_part('dayofweek', orderDate::date) == 6 then 'Saturday'
end as day_of_week
, products.Category as category
, products.Name || ' ' || products.Size as name
, max(products.Price)::int as price
, count(distinct orders.id) as orders
, sum(products.Price::int)::int as revenue
FROM orders
JOIN order_items
ON orders.id = order_items.orderID
JOIN products
ON order_items.SKU = products.SKU
GROUP BY 1, 2, 3, 4
ORDER BY 1, 3
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pizzeriaDB
SELECT c.longitude as longitude
, c.latitude as latitude
, c.id as customerId
, o.storeId as storeId
, COUNT(*) as orders
FROM orders as o
JOIN customers as c
ON o.customerId = c.id
GROUP BY 1, 2, 3, 4
Insert cell
pizzeriaDB
select * from stores
Insert cell
Insert cell
pizzeriaStaging = DuckDBClient.of({
orders: FileAttachment("orders@1.parquet"),
stores: FileAttachment("stores@1.csv"),
customers: FileAttachment("customers@1.csv"),
products: FileAttachment("products@1.csv"),
order_items: FileAttachment("orderItems@1.parquet"),
})
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more