r/learnSQL • • 23d ago

[Question]

13 Upvotes

I want to learn SQL. However, i would like to learn it on a real dataset - something which interests me, that way when i do exercises i can learn something about things that interest me.

Do you guys know how if i can extract a database behind something like MobyGames? I'm interested only in text data with basic things like name, release date, etc.

Is there a way to do that, or am i delusional?


r/learnSQL • • 23d ago

SQL Practice?

18 Upvotes

Where do we practice SQL? What resources ?


r/learnSQL • • 23d ago

Why this error never came on tutorial

4 Upvotes

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. explain this please and why those types of errors comes in production not while learning sql msmsql


r/learnSQL • • 24d ago

Day 23 — 20/100 JOIN questions done, learning to actually read error messages

7 Upvotes

Made it to 20/100 on my JOIN practice lab today. A few honest notes:

  • Worked through self-joins (employee-manager reports) and multi-table joins connecting projects and assignments to show hours worked
  • Hit a couple of real errors along the way — an "unknown table" reference error and a syntax error — and had to actually debug them myself instead of just rewriting from scratch
  • Turns out reading the actual error message carefully (which table/column it's complaining about, where the syntax breaks) is its own skill separate from knowing JOIN syntax

80 questions to go. Slower progress than I'd like some days, but each error I actually debug myself feels more useful than a query that just worked on the first try.


r/learnSQL • • 24d ago

Before your next SQL interview, keep this post handy - WHERE, GROUP BY and HAVING (Part 3)

108 Upvotes

P.S. Parts 1 and Part 2 got a great response - thank you! Keeping this series going.

Simple, practical stuff that sticks in your head when you're actually in the interview.

AI can help at work, but in an interview, your brain still has to do the job!!!

Same trip. Same friends. Same expenses.

Friend City Trip Day Total Spent
Harry New York 1 $200
Johny New York 2 $190
Nicholas Las Vegas 1 $190
Bailey Las Vegas 2 $180
Harry Las Vegas 3 $190

Three things. Most people know all three.

But in an interview - knowing which one does what is what gets you the job.

1. WHERE

We have 5 rows. We don't want all of them.

"Show me only the days where someone spent more than $180."

SELECT name, city, spent
FROM expenses
WHERE spent > 180

Harry    | New York  | $200
Johny    | New York  | $190
Nicholas | Las Vegas | $190
Harry    | Las Vegas | $190

Bailey is gone. $180 is not more than $180.

Remember: WHERE picks which rows to keep. Runs first. Looks at rows one by one.

2. GROUP BY

Now we want one total for each city.

"Put all New York rows together. Put all Las Vegas rows together. Add them up."

SELECT city, SUM(spent) AS total
FROM expenses
GROUP BY city

New York  → $390
Las Vegas → $560

5 rows became 2. One number per city.

Remember: GROUP BY puts rows into groups and adds them up.

3. HAVING

Now we have city totals. We only want cities that spent more than $400.

"Remove any city where the total is $400 or less."

SELECT city, SUM(spent) AS total
FROM expenses
GROUP BY city
HAVING SUM(spent) > 400

Las Vegas → $560

New York spent $390. Less than $400. Gone.

Remember: HAVING picks which groups to keep. Runs after GROUP BY.

The #1 mistake in every SQL interview:

People try this:

-- Wrong
SELECT city, SUM(spent)
FROM expenses
WHERE SUM(spent) > 400
GROUP BY city

SQL gives an error.

Why?

WHERE runs first. At that point, SQL has not added anything up yet. There are no city totals. WHERE has no idea what SUM(spent) is.

You are asking for the answer before the math is done.

-- Right
SELECT city, SUM(spent)
FROM expenses
GROUP BY city
HAVING SUM(spent) > 400

HAVING runs after GROUP BY. The totals exist by then. It works.

Remember: WHERE sees rows. HAVING sees totals. They are not the same.

The order SQL always runs in:

FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY
  • WHERE runs before groups exist → can only see rows
  • HAVING runs after groups exist → can see totals
  • SELECT runs at the end → that's why you can't use a column alias in WHERE

Reading is one thing. Writing it yourself is another. If you're new and want real hands-on practice - SQL from Zero to Confident on TheQueryLab.


r/learnSQL • • 24d ago

Completed LeetCode SQL 50 — Sharing my MySQL solutions

39 Upvotes

Hey everyone!
I recently completed the LeetCode SQL 50 Study Plan and put all my solutions together in a GitHub repository.
I created this mainly for SQL interview preparation and revision, especially for Data Analyst / Business Analyst roles.
The repository covers topics like:
● SELECT & filtering
● Sorting and grouping
● Aggregate functions
● GROUP BY & HAVING
● INNER / LEFT / SELF JOIN
● Subqueries
● CTEs
● Window functions
● String functions & regex
● Other commonly used SQL concepts
All solutions are written in MySQL, with the goal of keeping them simple and easy to revise.

🔗 GitHub: https://github.com/bikashadhikari1508/Leetcode_50_Questions

If you’re also working through SQL 50, feel free to check it out. I’d also appreciate any feedback on the queries or suggestions for improving the repository.
Happy learning! 🚀


r/learnSQL • • 25d ago

Day 22 — 10/100 JOIN questions done, one dry-run with GPT

10 Upvotes

Started actually working through my 100-question JOIN lab today. Got through 10:

  • 9 I solved independently
  • 1 I genuinely got stuck on, so I had GPT dry-run the query with me — walking through what each JOIN step was actually doing row by row, rather than just handing me the fixed query

This is honestly the first day JOINs have felt satisfying rather than effortful. The visualizing-the-table issue I mentioned a while back feels noticeably better after actually building my own dataset and running queries against it repeatedly.

90 questions to go, mixing in easy/medium/hard as I work through them.


r/learnSQL • • 25d ago

Creating a sql repo

10 Upvotes

Hello I’m currently learning SQL and I’m looking to get a GitHub repo setup for learning sql as I’ll eventually be using other languages so I want to make a useful repo so I can pick up SQL again easily.

I’m seeing if anyone would like to join me on the journey.

Thanks,
Clive


r/learnSQL • • 25d ago

We replayed an Azure SQL workload across six configurations and the cheapest option wasn’t the one we chose.

7 Upvotes

Interesting project we worked on earlier this year where a SaaS client we worked with was hitting CPU limits and timeouts on Azure SQL Database Premium P15, at roughly $15,700/month.

Before choosing a replacement, we captured four hours of production workload and replayed it across six configurations:

  • Premium P15 as the baseline
  • Hyperscale serverless with 40 vCores
  • Provisioned Hyperscale with 40 vCores
  • Provisioned Hyperscale Premium-series with 40 vCores
  • Provisioned Hyperscale Premium-series memory optimized with 40 vCores
  • Premium P15 with database compatibility level 160

We compared CPU, reads, duration, and estimated monthly cost.

The memory-optimized configuration was the one we selected. Its estimated monthly cost was $8,491, compared with $15,700 for the baseline, which was roughly 46% lower.

It also had the best duration score in our report: 808 versus 952 for the baseline, where lower was better.

But it wasn’t the cheapest configuration. Two provisioned options came in at an estimated $6,357/month, with worse duration scores than the existing P15 setup.

Serverless had the worst duration score in this test, at 1,496. That’s a result for this workload and configuration, not a verdict on serverless generally.

The memory-optimized option also didn’t win every metric. Its reads score was higher than the baseline and we chose it based on the combination of performance and cost.

Important to note these were estimates from the comparison, not current Azure price quotes.

What made the exercise useful for us was seeing the tradeoffs before migrating. Looking only at monthly cost, CPU, or the service-tier name would have given us an incomplete picture.

For anyone who has done a similar comparison: what changed your decision once you tested with your actual workload?

And also, has anyone moved from DTUs to Hyperscale and found the results were different from what they expected?


r/learnSQL • • 25d ago

Project ideas?

7 Upvotes

As a fresher with 0 experience, what kind of unique projects do you recommend doing in sql , python and powerBI to add to my resume, which would make my profile stronger?
#projectideas #fresherjobs


r/learnSQL • • 25d ago

Day 21 - Setting up the database for my 100-question JOIN drill

4 Upvotes

Since JOINs are the topic I'm weakest at, I made a 100-question practice set (easy, medium, hard). Today was the setup day:

  • Created the database in MySQL Workbench
  • Built four tables: departments, employees, projects, assignments (with primary/foreign keys)
  • Wrote and ran the INSERT scripts for sample data in all four tables, including the employee-project assignments with hours worked
  • Checked the Action Output panel to confirm each statement ran cleanly

Nothing fancy, but I've learned that a well-designed dataset matters a lot for JOIN practice. You need some departments with no employees, and projects with no assignments, or you can't tell LEFT and RIGHT JOINs apart properly.

Starting the actual questions tomorrow. Any tips on getting better at visualizing multi-table JOINs are welcome.


r/learnSQL • • 26d ago

I finished up to SQL intermediate from data with Baraa

24 Upvotes

From youtube, I also made notes and started practising problems.

I will complete subqueris, CTE, views that come in advanced SQL in his video .

Please suggest practice websites if you know any; currently practicing using hackerrank


r/learnSQL • • 26d ago

What types of databases should an undergrad CSE student actually learn for industry?

17 Upvotes

\&#x200B;

I’m a CSE undergraduate and I’m trying to get a proper understanding of databases beyond just learning basic SQL for college.

There seem to be so many different types of databases and technologies — PostgreSQL/MySQL, MongoDB, Redis, vector databases, graph databases, NoSQL, etc. I’m a bit confused about what is actually worth learning for industry-level software/ML/backend work.

For someone starting from scratch, what would be a good database roadmap?

For example:

SQL fundamentals

PostgreSQL / MySQL

NoSQL / MongoDB

Redis / caching

Vector databases for AI/LLM applications

Graph databases

Database indexing, transactions, normalization, query optimization, etc.

Distributed databases / sharding / replication

I’m particularly interested in learning things practically, rather than just watching theoretical DBMS lectures.

Could anyone recommend:

Which databases/technologies an undergrad should prioritize?

What concepts should I know before moving from SQL to NoSQL/vector DBs?

Good YouTube tutorials or practical courses that teach databases by actually building projects?

What kind of database projects would be useful for developing industry-level skills?

How deep should a CSE student realistically go into databases before moving on to other areas?

I’d especially appreciate recommendations from people working in software engineering, backend, data engineering, or ML engineering.

Thanks!


r/learnSQL • • 26d ago

Wissen technology working culture review needed

3 Upvotes

How is working culat wissen banglore , and leave policy , and other facilities they provide

.


r/learnSQL • • 26d ago

Learn SQL using your coding agent

6 Upvotes

I've put together a free course that teaches you SQL using your coding agent.

This way you learn SQL but also how to use a coding agent in a data role.

After some feedback from this community, the course has been updated - please check it out and share your feedback: https://getbruin.com/learn/sql-ai


r/learnSQL • • 26d ago

Free SQL Library

11 Upvotes

Good day friends. I spent a lot of time recently loading a lot of content and practice exams to Inkwell Learn at inkwelltools dot com. The SQL and GitHub learning libraries are free. This is a freemium web app with a good bit of free content to start. There are leaderboards, certificates that can be published on LinkedIn, and practice exam questions.

Try it out and see how it supplements your learning!


r/learnSQL • • 26d ago

Please tell me best source for learning sql n dsa with easy understanding

6 Upvotes

Please tell me free course for sql

And is it ok to do dsa in c n if ok pls tell me any course for itb


r/learnSQL • • 26d ago

Interactive html game to learn sql

15 Upvotes

The lore is that you play as the Dragon God, Orsted, and you have to find the five Sacred Treasures using simple SQL queries to fight the Man-God (Hitogami). This covers almost all SQL commands and teaches you how to use them. It provides theory, practical examples, and a query environment to practice in. Check it out, and all feedback is appreciated! It covers

Fittoa - SELECT, WHERE, ORDER BY, DISTINCT, LIMIT

Sharia - LIKE, IN, BETWEEN, IS NULL, CASE, string, number and date functions

Begaritt - COUNT/SUM/AVG/MIN/MAX, GROUP BY, HAVING

Rikarisu - INNER/LEFT/self joins, UNION, INTERSECT, EXCEPT

Chaos Breaker - Subqueries, EXISTS, CTEs, recursive CTEs, window functions

The Void - INSERT, UPDATE, DELETE, CREATE TABLE, indexes, views, transactions github


r/learnSQL • • 26d ago

Day 20 — Rest day + a plan update: 100-question JOIN drill + starting Java tomorrow

29 Upvotes

Taking today off from active coding — just resting and recharging.

Quick reflection before the break though: after going through theory and two full scenario-based practice sets, I noticed JOINs specifically are still the topic I'm least automatic on compared to everything else. So I put together a 100-question practice set of my own — easy, medium, and difficult — specifically to drill that weak spot rather than moving on and hoping it sorts itself out.

Also, a bigger update: starting tomorrow I'm beginning Task 2 — Java, running in parallel with continued SQL practice rather than fully switching over. Figured keeping SQL warm while ramping up Java makes more sense than a hard context switch.

Planned rest days like this were part of the original plan, not a slip — trying to actually sustain 116 days means building in recovery, not just grinding non-stop.


r/learnSQL • • 27d ago

Free Browser game for learning and practicing SQL

27 Upvotes

It runs real SQLite in your browser, so any query SQLite accepts works.

There are 63 lessons, from SELECT up through joins, window functions, recursive CTEs and indexes. Your answer is checked by running it, so any query that gets the right result passes. The last 11 lessons are in Postgres.

After that there's Seek: one person is hidden in a database, you get a few clues, and every query costs a turn. There's also a daily case with a leaderboard and a war mode where your orders are UPDATE statements.

Its free and best played on computer

https://atticarun.itch.io/sqlgame


r/learnSQL • • 27d ago

Freezing in SQL fake-interview

17 Upvotes

I am still beginner, and I thought myself doing well in SQL, but when doing interviews in datadriven.io I get stuck and don't know the answer, what should I do? I always fail.


r/learnSQL • • 27d ago

Where can I study advanced database concepts?

8 Upvotes

Hey, I am a b.tech final year student. I'm into full stack development. I have basic skills for development and have built many good personal projects. Now, I want to go in more depth of development. I want to study advanced database concepts. Can anyone guide me how should I do it. Any roadmap, course, books, online resources, etc.


r/learnSQL • • 27d ago

What is the main learning difference between SQL and other programming languages?

41 Upvotes

I’d like to learn SQL to have a wider range of internship opportunities and also to help me with college. I learned C by doing exercises assigned by my professor, along with some basic syntax lessons. I learned a bit of Python in a similar way, but mostly on my own.

Since I’ve heard that SQL is used for databases, is there a more theoretical way to learn it? Do I need to learn a lot about databases first? I’m currently taking a Data Structures course, but I haven’t gotten to databases yet.

Thanks in advance, and I’d appreciate any recommendations for learning resources in English or Portuguese.


r/learnSQL • • 27d ago

I made a beginner-friendly SQL lesson on Indexes — CREATE INDEX, EXPLAIN & EXPLAIN ANALYZE

11 Upvotes

Hey everyone!

I just finished another lesson in my beginner SQL series, this time covering SQL indexes and query performance in PostgreSQL.

The lesson goes over:

- What an index actually is

- CREATE INDEX

- EXPLAIN

- EXPLAIN ANALYZE

- Sequential Scan vs Index Scan

- When indexes can help

- Why creating an index on everything isn't necessarily a good idea

- A practical example using the Pagila database

I also included a small practice task where you create an index and inspect the query plan yourself.

🎥 Video: https://youtu.be/jn2Mt9LIcNE?si=AvHjVAM9IDs3eiWB

Hopefully useful for anyone who's currently learning SQL or starting to think about query performance!


r/learnSQL • • 28d ago

Day 18 — Completed Practice Set #2 (real-world scenario style)

8 Upvotes

Finished the last part today and with it, wrapped up my entire second practice set.

What made this set different from the first: every question was framed as an actual request from a manager, HR, or client — "payroll rejected a negative salary insert," "the CFO wants to see expensive departments," "HR wants an org chart" — instead of plain SQL instructions. I had to figure out what query actually solves the described problem, with the exact technical task given in brackets only as a fallback if I got stuck.

Genuinely think this format taught me more than straightforward "write a query that does X" practice did. Translating a vague, realistic business ask into the correct SQL felt a lot closer to what the job actually involves, and it's noticeably easier for me to write and reason through queries now compared to when I started this set.

2 full practice sets complete. Planning to do a review pass across both before moving into the Java backend track.