SQL exercises and analytical queries focused on Data Analytics, Business Intelligence, reporting, and business decision-making.
This repository documents my SQL learning and practice through queries designed to solve analytical and business-oriented problems.
The objective is to develop SQL skills not only for retrieving data, but also for transforming raw information into:
- business metrics
- KPIs
- analytical reports
- performance indicators
- customer insights
- operational insights
- decision-support information
The exercises progress from fundamental SQL queries to more structured analytical scenarios.
- SELECT
- DISTINCT
- WHERE
- ORDER BY
- LIMIT
- aliases
- comparison operators
- AND / OR
- IN
- BETWEEN
- LIKE
- NULL handling
- COUNT
- SUM
- AVG
- MIN
- MAX
- GROUP BY
- HAVING
- INNER JOIN
- LEFT JOIN
- RIGHT JOIN
- multiple-table queries
- relational data analysis
- CASE WHEN
- conditional metrics
- customer and product classification
- business rules in queries
- subqueries
- Common Table Expressions (CTEs)
- date functions
- string functions
- data transformation
- calculated fields
- window functions
- ranking
- running totals
- period comparisons
- customer segmentation
- performance analysis
The focus of this repository is to connect SQL queries to real business questions.
Examples include:
BUSINESS QUESTION
↓
RELEVANT DATA
↓
SQL QUERY
↓
METRIC OR KPI
↓
ANALYSIS
↓
BUSINESS INSIGHT
Instead of asking only:
How do I write this query?
The analytical approach also asks:
What business question does this query help answer?
Queries in this repository may be used to explore questions such as:
- What is the total revenue by month?
- Which products generate the most sales?
- What is the average transaction value?
- Which customers purchase most frequently?
- Which customer segments generate the most revenue?
- Which products are underperforming?
- How is performance changing over time?
- What percentage of customers make repeat purchases?
- Which categories have the highest average sales?
- Where are unusual changes or performance deviations occurring?
SQL can be used to calculate and monitor business indicators such as:
- Total Revenue
- Sales Volume
- Average Order Value
- Conversion Rate
- Customer Retention
- Repeat Purchase Rate
- Revenue by Product
- Revenue by Customer
- Revenue by Period
- Growth Rate
- Operational Performance
The goal is to understand both how a KPI is calculated and what it represents in a business context.
A typical analysis may follow this structure:
SELECT
category,
COUNT(*) AS total_orders,
SUM(revenue) AS total_revenue,
AVG(revenue) AS average_order_value
FROM sales
GROUP BY category
ORDER BY total_revenue DESC;This type of query can help answer:
- Which categories generate the most revenue?
- Which categories have higher average transaction values?
- Is sales volume aligned with revenue performance?
The query itself is only part of the analysis. The next step is interpreting the result.
DATABASE
↓
SQL QUERY
↓
FILTERING & TRANSFORMATION
↓
AGGREGATION
↓
METRICS
↓
ANALYSIS
↓
INSIGHT
↓
DECISION
This repository emphasizes SQL as an analytical tool rather than only a database language.
Through these exercises, I am developing skills in:
- relational databases
- SQL syntax
- data filtering
- data aggregation
- joins
- analytical queries
- KPI calculation
- business metrics
- data validation
- reporting
- analytical thinking
- business problem solving
- SELECT statements
- Data filtering
- Aggregations
- GROUP BY
- Basic JOINs
- CASE WHEN
- Advanced JOINs
- Subqueries
- Common Table Expressions (CTEs)
- Date and string functions
- Window functions
- Ranking and running totals
- Customer segmentation queries
- Sales performance analysis
- KPI reporting queries
- Data quality validation queries
- Complete SQL business case study
The goal of this repository is to strengthen SQL skills for Data Analytics and Business Intelligence while developing the ability to connect database queries with real business questions.
The progression is:
SQL SYNTAX
↓
DATA EXTRACTION
↓
DATA ANALYSIS
↓
BUSINESS METRICS
↓
INSIGHTS
↓
DECISION SUPPORT
Good SQL retrieves the right data. Good analytics explains why that data matters.