Skip to content

rjeezel35-afk/SQL-database-and-table-creation-with-subqueries-and-nested-queries-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

SQL-database-and-table-creation-with-subqueries-and-nested-queries-practice

This project is designed to practice working with multiple related tables using joins, subqueries, and nested queries to answer complex business questions. It covers of SQL learning, focusing on real-world database problem solving.

Project Overview

The project simulates a small organizational database with three tables:

Employees (employee details with salary and department)

Departments (list of business departments)

Projects (projects assigned to employees)

The tasks include:

Creating database tables and inserting sample data.

Applying different types of joins (INNER JOIN, LEFT JOIN, RIGHT JOIN, SELF JOIN, CROSS JOIN).

Using subqueries in SELECT, WHERE, and HAVING clauses.

Answering business-focused questions such as finding top earners, employees working on projects, and departments with high average salaries.

Methodology

Database Setup → Created Employees, Departments, and Projects tables with sample records.

Data Exploration → Queried the tables individually to understand the structure.

Joins → Combined related tables to answer multi-table queries.

Subqueries & Nested Queries → Used to calculate averages, filter employees, and check department-level conditions.

Query Testing → Verified results against expected business logic.

Practice Insights

Learned how joins reveal relationships across multiple tables (e.g., employees and their departments/projects).

Practiced correlated subqueries for comparing employee salaries to their department averages.

Applied aggregations with subqueries in HAVING to filter departments based on conditions.

Gained hands-on experience with real-world SQL patterns useful for data analysis and business reporting.

Discussion

Joins are powerful for merging related datasets, but they can return duplicates or exclude data if not chosen carefully (INNER vs. LEFT JOIN).

Subqueries make SQL more flexible, allowing filtering based on calculated values (like averages or maximums).

Correlated subqueries, while useful, can be less efficient on large datasets compared to joins or window functions.

Practicing with these queries strengthens the foundation needed for tools like Power BI and Excel, where SQL often powers the backend data connections.

Conclusion

This project demonstrates the practical use of joins, subqueries, and nested queries in SQL for answering complex questions. These skills are essential for Business/Data Analysts to:

Derive insights from multiple related tables.

Support data-driven decision making.

Build a strong foundation for analytics and BI tools.

By completing this practice, I improved my ability to transform raw relational data into meaningful business insights.

About

this is a project to help practice how to work multiple related table using joins, subqueries nested to answer complex questions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published