Skip to content

About

Rebuilt a legacy employee database from 6 CSVs: schema design, ERD, PostgreSQL import, and SQL analysis

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Employee Database: SQL Data Modeling & Analysis

Rebuilding a company's 1980s–1990s employee database from six raw CSV files: designing the schema, loading the data into PostgreSQL, and answering business questions with SQL.

The Problem

All that remained of the legacy employee database was a set of flat CSV exports: employees, departments, department assignments, managers, salaries, and titles. The goal was to turn them into a working relational database that people could query.

What I Did

  1. Data modeling: inspected the CSVs and sketched an entity relationship diagram (ERD) to map how the tables relate
  2. Data engineering: wrote table schemas with data types, primary keys, foreign keys, and composite keys, then imported each CSV in dependency order
  3. Data analysis: wrote SQL queries using multi-table JOINs, date filtering, and aggregation. Examples:
    • Employee number, name, sex, and salary for every employee
    • Employees hired in 1986
    • Each department's manager
    • Department assignments for every employee

Sample Query

-- Manager of each department
SELECT d.dept_no, d.dept_name, e.emp_no, e.last_name, e.first_name
FROM employee e
JOIN dept_manager dm ON e.emp_no = dm.emp_no
JOIN departments d   ON dm.dept_no = d.dept_no;

Tech

PostgreSQL · SQL · ERD design

Repo Contents

Path Purpose
Table Schemas/ CREATE TABLE scripts for all 6 tables
Queries/Data Analysis.sql Analysis queries
Query file.sql Additional queries

About

Rebuilt a legacy employee database from 6 CSVs: schema design, ERD, PostgreSQL import, and SQL analysis

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors