Saturday, August 10, 2024

ETL with PostgreSQL

I made data ingestion with ETL. I passed the data from staging table into its corresponding tables normalized to 3NF.

This is the Excel unnormalized table:


And this is the Physical ERD normalized to 3NF:




I started with salary table, I inserted unique values with the select distinct code:


Education table is the same.

Location table I needed to group by Address, Location Name, City and State, since these are company locations:


With Employee I grouped by EMP_ID, Employee Name and Email, this removes data redundancy for employees in the original table and keeps data integrity:


For Employee History I needed to join all the other tables with staging table so I could add the foreign keys, 

With a join all the asignations are ordered based on the on statement so I put the staging table first so that all the data could be visible.

I made a Left Join with managers because not all employees have managers, so I need to insert empties in that space:


And that's it.

No comments:

Post a Comment