This project involves managing employee data within a PostgreSQL (Version 16) database using SQL queries. It includes setting up table schemas, importing data from CSV files, and performing various data analysis queries to extract meaningful insights from the employee data.
Step 1: Download and install the latest version of PostgreSQL from PostgreSQL Official Website.
Step 2: To set up the Employee SQL database, follow these steps:
-
Create Tables from CSV Files:
- Use the provided SQL schema to create tables for each CSV file.
- Specify the data types, primary keys, foreign keys, and any other constraints as needed.
-
Import Data:
- Import each CSV file into its corresponding SQL table using PostgresSQL.
-
Employees Table Schema:
CREATE TABLE employees ( emp_no INT PRIMARY KEY, emp_title_id VARCHAR(10) NOT NULL, birth_date DATE NOT NULL, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(50) NOT NULL, sex CHAR(1) NOT NULL, hire_date DATE NOT NULL, FOREIGN KEY (emp_title_id) REFERENCES titles(title_id) );
-
Data Import
- Import each CSV file into its corresponding SQL table using SQL LOAD DATA or equivalent commands based on your database system.
-
List Employee Details:
SELECT emp_no, last_name, first_name, sex, salary FROM employees JOIN salaries ON employees.emp_no = salaries.emp_no;
- Study Group Members:
- Gursimran Kaur - [email protected] - SimranBoparai\
- Evan Wall - [email protected] - Ewall24