{"id":49914387,"url":"https://github.com/halyusa16/basic-sql-employee-analysis","last_synced_at":"2026-05-16T15:06:42.817Z","repository":{"id":279039556,"uuid":"937552440","full_name":"halyusa16/basic-sql-employee-analysis","owner":"halyusa16","description":"This project focuses on analyzing employee data through querying, performing table joins to connect related information, aggregating salary statistics, and using subqueries to extract meaningful insights.","archived":false,"fork":false,"pushed_at":"2025-03-29T23:50:35.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-21T01:55:52.486Z","etag":null,"topics":["data","data-analytics","data-exploration","database","mysql","self-project","sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halyusa16.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-23T10:48:54.000Z","updated_at":"2025-04-08T02:42:37.000Z","dependencies_parsed_at":"2025-03-30T00:33:03.858Z","dependency_job_id":null,"html_url":"https://github.com/halyusa16/basic-sql-employee-analysis","commit_stats":null,"previous_names":["halyusa16/mysql-employee-analysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/halyusa16/basic-sql-employee-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halyusa16%2Fbasic-sql-employee-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halyusa16%2Fbasic-sql-employee-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halyusa16%2Fbasic-sql-employee-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halyusa16%2Fbasic-sql-employee-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halyusa16","download_url":"https://codeload.github.com/halyusa16/basic-sql-employee-analysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halyusa16%2Fbasic-sql-employee-analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33107574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","data-analytics","data-exploration","database","mysql","self-project","sql"],"created_at":"2026-05-16T15:06:41.389Z","updated_at":"2026-05-16T15:06:42.800Z","avatar_url":"https://github.com/halyusa16.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Employee Database\n\n\n## 📌 Project Overview  \nThis project focuses on practicing to extract and analyze employee data through querying, performing table joins to connect related information, aggregating salary statistics, and using subqueries to extract meaningful insights.\n\nThe dataset contains tables of employee details, salary information, and department assignments.  \n\n\n## 📂 Database Schema  \n\nThis project contains database from [GitHub](https://github.com/AlexTheAnalyst/MySQL-YouTube-Series/blob/main/Beginner%20-%20Parks_and_Rec_Create_db.sql), containing **three tables**:  \n\n1. **`employee_demographics`** – Stores personal details of employees.  \n2. **`employee_salary`** – Contains salary and department details for employees.  \n3. **`parks_departments`** – Lists all departments in the organization.  \n\n## 📌 Key SQL Concepts Covered  \n✅ **Basic Queries** (`SELECT`, `WHERE`, `ORDER BY`)  \n✅ **Joins** (`INNER JOIN`, `LEFT JOIN`)  \n✅ **Aggregations** (`COUNT()`, `AVG()`, `MAX()`, `MIN()`)  \n✅ **Grouping \u0026 Filtering** (`GROUP BY`, `HAVING`)  \n✅ **Sorting \u0026 Limits** (`ORDER BY`, `LIMIT`)  \n✅ **Subqueries** (`WHERE ... (SELECT ...)`)  \n\n\n## 📜 SQL Queries Included  \n\n### 🔹 Basic Queries  \n#### 1️⃣ Get all employees older than 40  \n```sql\nSELECT *\nFROM employee_demographics\nWHERE age \u003e 40;\n```\n\n#### 2️⃣ Retrieve first name, last name, and salary of all employees  \n```sql\nSELECT dem.employee_id, dem.first_name, dem.last_name, sal.salary\nFROM employee_demographics dem\nJOIN employee_salary sal\nON dem.employee_id = sal.employee_id;\n```\n\n---\n\n### 🔹 Joins \u0026 Sorting  \n#### 3️⃣ Get all employees along with their salary (Sorted by First Name)  \n```sql\nSELECT dem.employee_id, dem.first_name, dem.last_name, sal.salary\nFROM employee_demographics dem\nJOIN employee_salary sal\nON dem.employee_id = sal.employee_id\nORDER BY dem.first_name ASC;\n```\n\n#### 4️⃣ Get employees and occupations, sorted by highest salary  \n```sql\nSELECT dem.employee_id, dem.first_name, dem.last_name, sal.occupation, sal.salary\nFROM employee_demographics dem\nJOIN employee_salary sal\nON dem.employee_id = sal.employee_id\nORDER BY sal.salary DESC;\n```\n\n#### 5️⃣ Find employees data from Parks and Recreation Department  \n```sql\nSELECT dem.employee_id, dem.first_name, dem.last_name, sal.occupation, sal.salary\nFROM employee_demographics dem\nJOIN employee_salary sal\nON dem.employee_id = sal.employee_id\nJOIN parks_departments dept\nON sal.dept_id = dept.department_id\nWHERE dept.department_name = 'Parks and Recreation';\n```\n\n---\n\n### 🔹 Aggregations \u0026 Grouping  \n#### 6️⃣ Find the average salary for each department  \n```sql\nSELECT dept.department_id, dept.department_name, ROUND(AVG(sal.salary), 2) AS dept_average_salary\nFROM employee_salary sal\nJOIN parks_departments dept\nON sal.dept_id = dept.department_id\nGROUP BY sal.dept_id;\n```\n\n#### 7️⃣ Count the number of employees in each department  \n```sql\nSELECT dept.department_id, dept.department_name, COUNT(sal.employee_id) AS number_of_employees\nFROM employee_salary sal\nJOIN parks_departments dept\nON sal.dept_id = dept.department_id\nGROUP BY dept.department_id;\n```\n\n#### 8️⃣ Find the highest and lowest salary in the organization  \n```sql\nSELECT MAX(salary) AS highest_salary, MIN(salary) AS lowest_salary\nFROM employee_salary;\n```\n\n---\n\n### 🔹 More Queries \u0026 Subqueries  \n#### 9️⃣ Retrieve the top 3 highest-paid employees  \n```sql\nSELECT employee_id, first_name, last_name, salary\nFROM employee_salary\nORDER BY salary DESC\nLIMIT 3;\n```\n\n#### 🔟 Find employees whose first name starts with 'A' (Ordered by Age)  \n```sql\nSELECT employee_id, first_name, last_name, age\nFROM employee_demographics\nWHERE first_name LIKE 'A%'\nORDER BY age ASC;\n```\n\n#### 1️⃣1️⃣ Find employees earning more than the average salary  \n```sql\nSELECT employee_id, first_name, last_name, salary,\n(SELECT ROUND(AVG(salary),2) FROM employee_salary) AS average_salary\nFROM employee_salary\nWHERE salary \u003e\n(SELECT AVG(salary)\nFROM employee_salary)\nORDER BY salary DESC;\n```\n\n#### 1️⃣2️⃣ Identify employees who do not have a department assigned  \n```sql\nSELECT employee_id, first_name, last_name, dept_id\nFROM employee_salary\nWHERE dept_id IS NULL;\n```\n\n## 💻**Technologies Used**\n- 🛠️ Database: MySQL\n- 📚 Tools: MySQL Workbench, DBeaver, HeidiSQL\n- 📝 Languages: SQL\n\n---\n✨ _Created by Halyusa Ard Wahyudi as part of a data analytics portfolio._ 🚀\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalyusa16%2Fbasic-sql-employee-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalyusa16%2Fbasic-sql-employee-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalyusa16%2Fbasic-sql-employee-analysis/lists"}