Skip to content

HJandu/SQL-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

SQL-Challenge

Background

It’s been two weeks since I have been hired as a new data engineer at Pewlett Hackard (a fictional company). My first major task was to do a research project about people whom the company employed during the 1980s and 1990s. All that remained of the employee database from that period were six CSV files.

This project is divided into three parts: data modeling, data engineering, and data analysis.

Data Modeling

This is where I inspected all six CSV files, and then sketched an Entity Relationship Diagram (ERD) of the tables. To create the sketch, I used a tool called 'QuickDBD'. I produced a Physical data model, showing the many to one and one to one relationships.

Employee_ERD

Data Engineering

The above information was exported to create a table schema for each of the six CSV files, where I specified the data types, primary keys, foreign keys, and other constraints, as seen in schema file.

After doing the above, I had:

  • Created the database in PostgreSQL
  • Imported the schema into the database
  • Ran each part to create the tables within the database
  • Imported the following CSV files into the corresponding SQL table
    • departments
    • dept_emp
    • dept_manager
    • employees
    • salaries
    • titles

Data Analysis

  1. List the employee number, last name, first name, sex, and salary of each employee.

Query_1

Output_1

  1. List the first name, last name, and hire date for the employees who were hired in 1986.

Query_2

Output_2

  1. List the manager of each department along with their department number, department name, employee number, last name, and first name.

Query_3

Output_3

  1. List the department number for each employee along with that employee’s employee number, last name, first name, and department name.

Query_4

Output_4

  1. List first name, last name, and sex of each employee whose first name is Hercules and whose last name begins with the letter B.

Query_5

Output_5

  1. List each employee in the Sales department, including their employee number, last name, and first name.

Query_6

Output_6

  1. List each employee in the Sales and Development departments, including their employee number, last name, first name, and department name.

Query_7

Output_7

  1. List the frequency counts, in descending order, of all the employee last names (that is, how many employees share each last name).

Query_8

Output_8

About

Module 9 SQL queries and Data modeling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors