Platform
Solutions
Resources
Pricing
Sign in
Sign up
Charles Redmond
Workspace
Fork
Public
aaa-Database550Fall23
By
Charles Redmond
Edited
Sep 29, 2023
Fork of
Sets Part 2
•
3 forks
5
aaa-Database550Fall23
Plotting Template
Class Exercise Part 2
Make-up Quiz
Views and Analytics
The CASE Statement
CASE Part 2
Correlated SubQueries
Quiz 6
Chinook Problems
Subqueries
Sets Part 2
Sets
H VS SO Application
Homerun Application
Plotting Tutorial
Data Viz
Joins
Baseball Database
Creating and Populating a Database
Insert cell
Insert cell
db
SELECT max(HR)
FROM batting
Insert cell
db
SELECT playerID,HR
FROM batting
WHERE HR = (
SELECT max(HR)
FROM Batting
)
Insert cell
db
SELECT name,HR,yearID
FROM teams
WHERE HR = (
SELECT max(HR)
FROM teams
)
Insert cell
db
SELECT b.playerID,nameFirst,nameLast,yearID,HR
FROM batting b INNER JOIN people p
ON b.playerID = p.playerID
WHERE teamID = (
SELECT teamID
FROM teams
WHERE name = 'Philadelphia Phillies'
)
Insert cell
db
SELECT DISTINCT nameFirst
FROM people
WHERE nameFirst LIKE 'Bob%'
Insert cell
db
SELECT b.playerID,nameFirst,nameLast,yearID,HR
FROM batting b INNER JOIN people p
ON b.playerID = p.playerID
WHERE teamID IN (
SELECT teamID
FROM teams
WHERE name LIKE 'Philadelphia %'
)
Insert cell
db
SELECT DISTINCT playerID
FROM managers
WHERE playerID NOT IN(
SELECT playerID
FROM batting
)
Insert cell
db
SELECT playerID, HR
FROM batting
WHERE teamID = 'NYA' AND yearID = 2022 AND HR > ALL(
SELECT HR
FROM batting
WHERE teamID = 'PHI' AND yearID = 2022
)
Insert cell
db
SELECT playerID, HR
FROM batting
WHERE teamID = 'NYA' AND yearID = 2022
ORDER BY HR DESC
Insert cell
db
SELECT playerID, HR
FROM batting
WHERE teamID = 'PHI' AND yearID = 2022
ORDER BY HR DESC
Insert cell
db
SELECT teamID
FROM teams
WHERE name LIKE 'Philadelphia %'
Insert cell
db
SELECT name,HR
FROM teams
WHERE yearID = 1950
ORDER BY HR
Insert cell
db
SELECT name,HR
FROM teams
WHERE yearID = 2022
ORDER BY HR
Insert cell
db
SELECT name,HR
FROM teams
WHERE yearID = 1950 AND HR < ALL (
SELECT HR
FROM teams
WHERE yearID = 2022
)
ORDER BY HR
Insert cell
Insert cell
db
=
DuckDBClient
.
of
(
{
batting
:
FileAttachment
(
"Batting.csv"
)
,
hall
:
FileAttachment
(
"HallOfFame.csv"
)
,
managers
:
FileAttachment
(
"Managers.csv"
)
,
people
:
FileAttachment
(
"People.csv"
)
,
teams
:
FileAttachment
(
"Teams.csv"
)
}
)
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.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
db
File attachments
Teams.csv
CSV
People.csv
CSV
Managers.csv
CSV
HallOfFame.csv
CSV
Batting.csv
CSV
Databases
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
db
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML