WHERE country_of_production = ${productionCountry}
AND country_of_import = ${importCountry}
AND commodity = ${commodity}
GROUP BY 1 ORDER BY 2 DESC LIMIT 20`
volumeByYear=database.sql`
SELECT year::integer AS year,
SUM(volume) AS total_volume
FROM supply_chains
WHERE country_of_production = ${productionCountry}
AND country_of_import = ${importCountry}
AND commodity = ${commodity}
GROUP BY 1 ORDER BY 1 ASC`
database
SELECT "country_of_production", commodity, SUM(volume) AS total_volume FROM supply_chains GROUP BY 1, 2 ORDER BY 3 DESC;
productionCountries=database.sql`
SELECT DISTINCT(country_of_production) AS c
FROM supply_chains ORDER BY 1 ASC
`.then(
(r)=>r.map((r)=>r.c)
)
importCountries=database.sql`
SELECT DISTINCT(country_of_import)
AS c FROM supply_chains
WHERE country_of_production = ${productionCountry}
ORDER BY 1 ASC
`.then(r=>r.map(r=>r.c));
commodities=database.sql`
SELECT DISTINCT(commodity) AS c
FROM supply_chains
WHERE country_of_production = ${productionCountry}
AND country_of_import = ${importCountry}
ORDER BY 1 ASC
`.then(r=>r.map(r=>r.c))
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.