Giter VIP home page Giter VIP logo

the-best-of-baseball-awards's Introduction

The Best of BaseBall Awards

A Codecademy Pro Project from the Backend Engineer Career Path

Overview

This repository contains the project files for an online course on databases, focusing on a massive baseball database. The dataset spans from 1871 to 2019 and covers various aspects of baseball, including players, teams, managers, and salaries. The primary goal of the project is to analyze the data and create queries for a fictional "The Best of Baseball" award event.

🏆 Awards

  1. "Heaviest Hitters"
    This award goes to the team with the highest average weight of its batters on a given year.
  2. "Shortest Sluggers"
    This award goes to the team with the smallest average height of its batters on a given year.
  3. "Biggest Spenders"
    This award goes to the team with the largest total salary of all players in a given year.
  4. "Most bang for their Buck in 2010"
    This award goes to the team that had the smallest “cost per win” in 2010.
  5. "Priciest Starter"
    This award goes to the pitcher who, in a given year, cost the most money per game in which they were the starting pitcher.

Project Structure

  • queries/: Here, you will find the SQL files containing the query solutions for the award show analysis
  • docs/: This directory contains the following documentation:
    • Project Best of Baseball Awards.md: A markdown file that I wrote to contain the project instructions as well as my query solutions in one single file for ease of access.
    • TheBestOfBaseballAwardsStarterFiles.zip: Starter Files provided by Codecademy
      • baseball_database.sql: the database that is used in this project
      • readme.txt: contains information about the dataset
      • TheBestOfBaseballAwards: project instructions

Example Query

-- heaviest_hitters.sql

WITH avg_team_weight AS (
  SELECT ROUND(AVG(people.weight), 2) AS avg_weight,
          teams.name AS team_name,
          batting.yearid AS year_id
  FROM people
  JOIN batting
    ON people.playerid = batting.playerid
  JOIN teams
    ON batting.team_id = teams.id
  GROUP BY teams.name, batting.yearid
),
max_avg_team_weight AS (
  SELECT year_id, MAX(avg_weight) AS max_avg_weight
  FROM avg_team_weight
  GROUP BY year_id
)
SELECT max_avg_team_weight.year_id AS year,
        max_avg_team_weight.max_avg_weight AS "avg weight",
        avg_team_weight.team_name AS "team name"
FROM max_avg_team_weight
JOIN avg_team_weight
  ON max_avg_team_weight.year_id = avg_team_weight.year_id
 AND max_avg_team_weight.max_avg_weight = avg_team_weight.avg_weight
ORDER BY year;

the-best-of-baseball-awards's People

Contributors

melissaveraherbst avatar

Watchers

 avatar

Forkers

munaza51

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.