Public
Edited
Oct 25, 2023
Insert cell
Insert cell
peopleFile = FileAttachment("People.csv").csv({typed:true})
Insert cell
collegeFile = FileAttachment("CollegePlaying.csv").csv({typed:true})
Insert cell
hallFile = FileAttachment("HallOfFame.csv").csv({typed:true})
Insert cell
db = DuckDBClient.of({
people:peopleFile,
college:collegeFile,
hall:hallFile
})
Insert cell
db
SELECT DISTINCT playerID
FROM college
WHERE 250 < (
SELECT weight
FROM people
WHERE playerID = college.playerID
)
Insert cell
db
SELECT playerID
FROM people
WHERE weight > 250 AND EXISTS (
SELECT playerID
FROM college
WHERE playerID = people.playerID
)

Insert cell
db
SELECT DISTINCT playerID
FROM college
WHERE 1 = (
SELECT count(*)
FROM hall
WHERE playerID = college.playerID
) AND EXISTS (
SELECT playerID
FROM hall
WHERE playerID = college.playerID AND inducted = 'Y'
)
Insert cell
db
SELECT DISTINCT playerID
FROM hall
GROUP BY playerID
HAVING count(*) = 1 AND max(inducted) = 'Y' AND EXISTS (
SELECT playerID
FROM college
WHERE playerID = hall.playerID
)
Insert cell
db
SELECT playerID,
CASE birthCountry
WHEN 'USA' THEN 'United States'
ELSE 'International'
END origin
FROM people
WHERE birthCountry IS NULL
Insert cell
db
SELECT playerID,birthCountry,
CASE
WHEN birthCountry = 'USA' THEN 'United States'
WHEN birthCountry IS NULL THEN 'Unknown'
ELSE 'INTERNATIONAL'
END origin
FROM people
WHERE origin = 'Unknown'
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more