Platform
Resources
Pricing
Sign in
Get started
Ross Stewart
Workspace
Fork
Public
By
Ross Stewart
Edited
Mar 15, 2023
2
Insert cell
Insert cell
viewof
year
=
Inputs
.
range
(
[
1900
,
2022
]
,
{
step
:
1
}
)
Insert cell
db
=
DuckDBClient
.
of
(
{
batting
:
FileAttachment
(
"Batting.csv"
)
,
people
:
FileAttachment
(
"People.csv"
)
}
)
Insert cell
db
SELECT playerID,yearID,teamID,HR
FROM batting
WHERE teamID == 'PHI'
ORDER BY HR DESC
LIMIT 10
Insert cell
PHI
Insert cell
db
SELECT max(CONCAT(nameFirst,' ',nameLast)) AS name
FROM batting,people
WHERE batting.playerID == people.playerID AND teamID == 'PHI' AND ${year}
GROUP BY batting.playerID
Insert cell
db
SELECT playerID,fsum(HR)
FROM batting
WHERE teamID == 'PHI'
GROUP BY playerID
ORDER BY fsum(HR) DESC
Insert cell
db
SELECT nameFirst,nameLast,yearID,teamID,HR
FROM batting,people
WHERE batting.playerID == people.playerID AND teamID == 'PHI'
ORDER BY HR DESC
LIMIT 10
Insert cell
db
SELECT max(CONCAT(nameFirst,' ',nameLast)) AS name,fsum(HR)
FROM batting,people
WHERE batting.playerID == people.playerID AND teamID == 'PHI' AND ${year}
GROUP BY batting.playerID
ORDER BY fsum(HR) DESC
LIMIT 10
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
barY
(
phillietry
,
{
y
:
"HR"
,
x
:
"nameFirst"
,
sort
:
{
x
:
"y"
,
reverse
:
true
}
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
year
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
db
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
PHI
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
People.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
names
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
People.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
People.csv
CSV
Batting.csv
CSV
Databases
phillietry
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
People.csv
CSV
Batting.csv
CSV
Databases
phillies
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
People.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML