Entity Relation Diagram (ERD)

Schema of data sets and connecting keys

Entity Relation Diagram (ERD)

Project Description

Model database, query data and create schema using PostgresSQL. Utilize principles of Extract, Transform, Load (ETL) to read, clean and convert CSV files into SQL tables. Create an Entity Relation Diagram (ERD) showing the connections between primary and foreign keys between data sets.

Import


drop table if exists departments;
create table departments(
dept_no varchar not null,
dept_name varchar not null);
select * from departments limit 20;

Query


select employees.emp_no, employees.last_name, employees.first_name, salaries.salary
from employees
inner join salaries
on employees.emp_no = salaries.emp_no;

Schema


ALTER TABLE employees
ADD CONSTRAINT pk_employees_emp_no
PRIMARY KEY(emp_no);
ALTER TABLE departments
ADD CONSTRAINT pk_departments_dept_no
PRIMARY KEY(dept_no);