Giter Club home page Giter Club logo

sql's Introduction

Who Is Paid The Most?
(Examples of Building Tables and Executing Queries in SQL)

Overview:

The purpose of this project was to create a SQL database from 6 CSV files containing various employee data from a fictitious company and analyze the data. The first step was to examine the CSV files and determine all the relationships between the fields and create an Entity Relationship Diagram (see below), paying attention to data types, primary and foreign keys, and other possible constraints. The next step was to create the necessary tables in the database (see "table_setups.sql") and load in the CSV files. Once this was complete, several queries were run (see "employee_queries.sql") to analyze the data. As a final step, a jupyter notebook was written (see "SalaryAnalysis.ipynb") to explore the data in the database even further.

Folders/Files:

  • "SQL Queries" (folder)
    • "table_setups.sql" (schemata for creating the tables in postgresql)
    • "employee_queries.sql" (several examples of postgresql queries)
  • "Data Files" (folder)
    • "departments.csv" (input data file if needed)
    • "dept_emp.csv" (input data file if needed)
    • "dept_manager.csv" (input data file if needed)
    • "employees.csv" (input data file if needed)
    • "salaries.csv" (input data file if needed)
    • "titles.csv" (input data file if needed)
  • "Analysis Code" (folder)
    • "SalaryAnalysis.ipynb" (jupyter notebook file containing code for further salary analysis)
  • "Images" (folder)
    • "TableRelationshipDiagram.png" (table relationship diagram)

Note:

The csv files in subfolder "data" are only needed if re-building the tables from scratch.
The Jupyter notebook requires you to either hardcode your postgresql password into the cell where indicated or put your postgresql password into a config.py file before running.

Entity Relationship Diagram:


Query To Show Top 25 Paid Employees:


Query To Show Top 5 Paid Employees in Each Department:


Query To Show Salary Statistics for Each Department:


Interesting Visuals from the Salary Analysis Notebook:

sql's People

Contributors

rickmora98 avatar

Watchers

 avatar

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.