Hands-On SQL: Real Datasets, Real Queries and a Portfolio That Proves It

Reading about SQL is not enough. This tutorial shows how to practise on real datasets, answer real business questions, and turn the work into a portfolio.

By Galactic News Editorial · Published 2026-11-23T16:32:00+00:00 · Updated 2026-11-23T16:32:00+00:00

Hands-on SQL practice with real datasets, queries and a portfolio

Hands-On SQL: Real Datasets, Real Queries and a Portfolio That Proves It

Reading about SQL is not enough to learn it. Employers want proof you can query real data. The fastest way to build that proof is to practise on real datasets, answer real business questions, and publish the work in a portfolio. This tutorial shows how, step by step.

Why Hands-On SQL Practice Beats Tutorials Alone

Tutorials teach syntax. Real datasets teach judgement. A real dataset has missing values, inconsistent formats and messy categories. Cleaning and querying that mess is the actual job of a data analyst. Guided exercises with perfect toy data never show you those problems. Practising on real data also builds the habit employers test in interviews: given a question and a database, write the query that answers it. Start with the basics, then move to real data as soon as you can write a simple SELECT, WHERE and GROUP BY.

Hands-On SQL Real Datasets Queries Portfolio: Where to Find Them

Free public datasets are easy to find. Choose ones with enough rows to make the analysis meaningful, and with a question a real business would ask.

DatasetSourceSizeGood for
Sample SuperstoreKaggleOver 9,000 rows of retail ordersSales, profit and category analysis
Online Retail (UCI)Kaggle / UCI Machine Learning RepositoryOver 500,000 transactionsCohort analysis, repeat purchase behaviour
IBM HR Analytics Employee AttritionKaggle1,470 employee recordsHR analytics, attrition patterns
Northwind StoreLearnSQL practice databasesCustomers, products, orders and salesJoins and order analysis
MoMA collectionLearnSQL practice databasesReal museum recordsExploring an unfamiliar schema

Download the data as CSV files. Most practice platforms, such as SQLBolt, SQLZoo and Mode, also let you run queries in the browser with no setup. For a portfolio, load the data into a free database such as PostgreSQL or SQLite so you can show the full workflow, from raw file to finished analysis.

Step 1: Pick One Dataset and One Question

Choose the Sample Superstore dataset. It is clean, well documented and familiar to hiring managers. Then pick one business question. A good first question is: which product category generates the highest profit margin? Write the question down before you touch the data. A clear question keeps the analysis focused and gives your portfolio a story.

Step 2: Explore the Data Before You Query It

Run simple queries to learn what you have. Count the rows. List the distinct categories. Check the date range. Look for missing values. These checks take ten minutes and prevent hours of confusion later.

SELECT COUNT(*) AS total_orders FROM orders;
SELECT DISTINCT category FROM products;
SELECT MIN(order_date) AS first_order, MAX(order_date) AS last_order FROM orders;

Note anything odd you find. A column full of blanks, a date stored as text, or a category spelled two ways are all normal in real data. Record them in your notes. Cleaning decisions are part of the portfolio story.

Step 3: Answer the Question With Real Queries

Build the answer in stages. First, total sales and profit by category. Then add the profit margin. Then order the results so the best category sits at the top.

-- Monthly revenue trend
SELECT
    DATE_FORMAT(order_date, '%Y-%m') AS month,
    SUM(sales) AS total_sales,
    SUM(profit) AS total_profit,
    ROUND(SUM(profit) / SUM(sales) * 100, 2) AS profit_margin_pct
FROM orders
GROUP BY DATE_FORMAT(order_date, '%Y-%m')
ORDER BY month;

Then answer the original question with a grouped summary.

SELECT
    category,
    SUM(sales) AS total_sales,
    SUM(profit) AS total_profit,
    ROUND(SUM(profit) / SUM(sales) * 100, 2) AS profit_margin_pct
FROM orders
GROUP BY category
ORDER BY profit_margin_pct DESC;

Check the result against common sense. If a margin looks impossible, inspect the underlying rows before trusting it. Debugging a wrong result teaches more than a correct one.

Step 4: Go Deeper With Joins and Window Functions

Once the basics work, add a second project layer. Join orders to customers and find which customer segment has the highest average order value. Then try a cohort analysis on the Online Retail dataset: group customers by the month of their first order, then track how many return in later months. Window functions such as ROW_NUMBER and LAG make this possible. These are the skills that separate a beginner portfolio from a job-ready one. Practice platforms such as HackerRank and LeetCode offer database problems drawn from real interview questions, which are a good test of readiness.

Step 5: Turn the Work Into a Portfolio

A portfolio needs three projects, not thirty. Each project should sit in its own GitHub repository with a clear README. The README should cover five things: the business problem in one paragraph, the dataset source and size, the key questions you answered, the SQL concepts used, and the key findings in two or three bullet points. Include the SQL files, not just screenshots. Hiring managers want to read the queries. Add a short findings section with the numbers your queries produced. A suggested set of three projects is a retail sales analysis, a customer cohort analysis and an HR analytics project. Together they show aggregation, joins, date functions, window functions and real data handling.

Common Beginner Mistakes

Do not practise only on toy datasets with ten rows. Real data is messy, and messy data is the skill. Do not copy answers from tutorial sites without understanding them. Interviewers ask follow-up questions. Do not skip the README. A project without a README looks unfinished, however good the queries are. Finally, do not wait until you feel ready. Publish the first project when it works, then improve it as you learn.

Bottom Line

Hands-on SQL means real datasets, real questions and a public portfolio. Pick one dataset, answer one business question, and publish the work with a clear README. Repeat with two more projects. That portfolio proves more than any certificate that you can work with data.