Public
Edited
Jun 17, 2023
Insert cell
Insert cell
Insert cell
Insert cell
import { pizzeriaDB } from '@observablehq/pizza-paradise-data'
Insert cell
Insert cell
Insert cell
Insert cell
pizzeriaDB
SELECT stores.state
, count(*) as num_orders_one
, count(distinct orders.id) as num_orders
FROM stores
JOIN orders
ON stores.id = orders.storeId
GROUP BY stores.state
Insert cell
Insert cell
pizzeriaDB
SELECT stores.state
, count(*) as num_orders_one
, count(distinct orders.id) as num_orders
, count(distinct customers.id) as num_customers
FROM stores
JOIN orders
ON stores.id = orders.storeId
JOIN customers
ON orders.customerId = customers.id
GROUP BY stores.state
Insert cell
Insert cell
Insert cell
pizzeriaDB
SELECT stores.*
FROM stores
JOIN california_stores
ON stores.id = california_stores.id
Insert cell
Insert cell
pizzeriaDB
SELECT stores.*
FROM stores
JOIN california_stores
ON stores.id = california_stores.id
JOIN nevada_stores
ON stores.id = nevada_stores.id
Insert cell
Insert cell
pizzeriaDB
SELECT stores.state
, count(*) as num_orders_one
, count(distinct orders.id) as num_orders
, count(distinct orders.customerId) as num_customers
FROM stores
JOIN orders
ON stores.id = orders.storeId
GROUP BY stores.state
Insert cell
Insert cell
pizzeriaDB
SELECT stores.state
, count(*) as num_orders_one
, count(distinct orders.id) as num_orders
, count(distinct orders.customerId) as num_customers
FROM stores
JOIN orders
ON stores.id = orders.storeId
JOIN california_stores
ON stores.id = california_stores.id
GROUP BY stores.state
Insert cell
Insert cell
Insert cell
pizzeriaDB
SELECT stores.zipcode
, stores.state
, stores.city
, california_stores.state as "Is Cali?"
, nevada_stores.state as "Is Nevada?"
FROM stores
LEFT
JOIN california_stores
ON stores.id = california_stores.id
LEFT
JOIN nevada_stores
ON stores.id = nevada_stores.id
Insert cell
Insert cell
pizzeriaDB
SELECT california_stores.state
, count(*) as num_orders_one
, count(distinct orders.id) as num_orders
, count(distinct orders.customerId) as num_customers
FROM stores
JOIN orders
ON stores.id = orders.storeId
LEFT
JOIN california_stores
ON stores.id = california_stores.id
GROUP BY california_stores.state
Insert cell
Insert cell
Insert cell
pizzeriaDB
SELECT *
FROM products
WHERE Category = 'Classic'
Insert cell
Insert cell
pizzeriaDB
SELECT *
FROM stores
WHERE state = 'Utah'
Insert cell
Insert cell
pizzeriaDB
SELECT stores.state
, stores.city
, count(distinct orders.id) as num_orders
FROM stores
JOIN orders
ON stores.id = orders.storeId
WHERE stores.state = 'Nevada'
GROUP BY 1, 2
HAVING num_orders >= 100000
Insert cell
Insert cell
Insert cell
pizzeriaDB
SELECT *
FROM products
WHERE Category = 'Classic'
AND Size = 'Large'
Insert cell
Insert cell
pizzeriaDB
SELECT *
FROM products
WHERE Category = 'Classic'
AND (Size = 'Large' OR Size = 'Small')
Insert cell
Insert cell
pizzeriaDB
SELECT *
FROM orders_by_product_day
WHERE order_date BETWEEN '2021-01-01' AND '2021-02-01'
Insert cell
Insert cell
pizzeriaDB
Type SQL, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
pizzeriaDB
Type SQL, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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