r/learnSQL • • 2h ago

Database design

2 Upvotes

Hey guys.

Gonna be real quick.

I know about databases but I struggle with database design either relational or non relational.

Do you have any resource that I can binge on and like solve this issue once and for all ?

Would appreciate it. Thanks in advance.


r/learnSQL • • 1d ago

Understanding SQL patterns that cover 90% of interview questions

40 Upvotes

Instead of trying to memorize 100 different questions, it helps to learn the underlying patterns. I put together a walkthrough of the 17 patterns I see most often in MySQL interviews, breaking down the logic so you can recognize them instantly.

The core patterns covered:

  • Window Functions: Running totals, LAG for YoY/MoM growth, and 7-day moving averages.
  • CTEs & Recursion: Traversing hierarchies (like employee/manager trees).
  • Gaps & Islands: Finding consecutive login days (a classic tough one).
  • Ranking: Top N per group, 2nd/Nth highest salary.
  • Advanced Joins: Self-joins, monthly cohort retention, and pivot tables using CASE WHEN.

Why this approach helps:
When you see a question like "find the highest sales day," you shouldn't just start typing. You should recognize it as a "Ranking + Filtering" pattern. Once you know the pattern, the query writes itself.

I recorded a step-by-step video solving each of these 17 patterns with the exact queries and explanations of why they work. I also included the dataset/script so you can practice alongside it.

Walk-through:- SQL Interview Questions & Answers MySQL 17 Must Know Patterns

(Note: I'm sharing this because I've seen it help folks in my training sessions—if it helps even one person land a role, I'm happy!)

Question for the community: Which of these patterns trips you up the most in interviews? For me, it was always the "Gaps and Islands" problem.


r/learnSQL • • 16h ago

Websites to practice SQL

4 Upvotes

Any websites to practice excercises of SQL in mobile ??

It should contains all excercise easy to understand and practice

Comfortably in mobile


r/learnSQL • • 19h ago

The one thing that made T-SQL stick for me: check figures on every exercise

4 Upvotes

I've been learning T-SQL on the Chinook sample database in SSMS, and the thing that changed everything was giving every exercise an expected answer to check against — a row count, a total, a specific value. Without it I was just guessing whether my query was right. With it, I know immediately, and the mistake teaches me something. Curious what worked for others here — what made SQL actually click for you?


r/learnSQL • • 1d ago

I built ForgeSQL, a hands-on learning platform for SQL and data engineering

5 Upvotes

Sharing something I built: ForgeSQL, a browser-based learning platform for SQL and data engineering.

For SQL practice, there are guided exercises with sample tables, a query editor, results, and solutions you can compare with your own approach. You can start with joins and move on to window functions, then explore Python, file ingestion, pipelines, APIs and Kafka in the same workspace.

The idea is to try a query, inspect what happened, and change it until you understand why it works. It runs on DuckDB, so SQL dialect differences still apply.

It’s an early public beta. If you’re learning SQL, I’d appreciate hearing which exercises are helpful and where the instructions need work.

https://forgesql.clawiz.com/

Screenshot: https://forgesql.clawiz.com/assets/hotlink-ok/forgesql-workspace.png


r/learnSQL • • 1d ago

Guidance?

3 Upvotes

Years ago while incarcerated I earned a college cert for Microsoft apps which is now basically outdated. After talking with ChatGPT it recommended learning SQL because I mentioned that I really enjoyed my Access class and after a weird assessment i created noted I have a systems analyst kinda mind. "Investigative".

As a final project for that Access course I had to construct a library database from scratch using queries that could handle isbns, book details, borrower personal info, due dates, late fees (if applicable etc). It was hard but really really cool. Anyway, I went to the w3 site and that seems cool but I feel like I need a book, and to take notes and work on stuff on my computer. But I have no real idea how to begin or why id even do this esp vs Access refreshing???

Im a truck driver and would love to get out of it but im also a 8x felon. So...i dont wanna waste my time. Is SQL worth learning to move up or pivot? I see it occasionally in job searches. And how would you approach learning it if so? Lastly am I doing all of this to go like test somewhere and get a certification? Or is it a show me what you can do kinda thing?

- notable fact: I tried doing a boot camp for CSS a few years ago and got through the first level. At the second I kinda fell out of it due to lack of motivation even after taking a FrontPage class (in that program) but mostly due to talking myself out of it knowing my background. Plus I just wasnt really in love with CSS 🤷🏾‍♂️

Sorry this is so long but I figured some context may help.


r/learnSQL • • 21h ago

Free Excel and SQL level tests for beginners: 10 questions each, no sign-up. Tell me where they're too easy or too hard

Thumbnail reddit.com
1 Upvotes

r/learnSQL • • 1d ago

Day 78 — Hospital Management System: connecting the classes

3 Upvotes

Today I added BillingService, AppointmentService, and Schedulable to my Hospital Management System.

Writing each class was not the hard part. Connecting them so they work together was much harder, and it is the part no tutorial prepared me for. I used GPT as a mentor to understand the connections, not to write the code for me.

Tomorrow I will write the Main class to bring everything together.


r/learnSQL • • 1d ago

hi guys so i am a frontend dev and now i wanna expand into fullstack and for that i need to learn postgresql and about ORMs so what should materials should i check out which would help me to bridge to sql from only frontend?

3 Upvotes

r/learnSQL • • 1d ago

Text column is storing accented text weirdly

Thumbnail reddit.com
1 Upvotes

r/learnSQL • • 1d ago

Confusion about joining tables.

8 Upvotes

can anyone help me to understand how one to many relation tables work .how to avoid duplicates when joining.i am struggling to understand how it works


r/learnSQL • • 1d ago

Is there any point proofreading SQL an agent wrote?

2 Upvotes

My manager has started pasting Claude-written SQL into Slack with "can you check this is right?". They always look fine on the page. Last week's joined to dim_customer_v2, which still exists but stopped updating in March. The one before used a revenue column that includes tax because it's the one with the obvious name. Both read perfectly well, both answers were wrong, and I only caught them because I happen to know the history of those tables. I mean, our BI tool's chat shows the SQL behind every chart now too, and I don't see how reading it would have caught either of those. Right now the only real check is whoever happens to remember the history of the tables.


r/learnSQL • • 1d ago

Sql skill level

Thumbnail reddit.com
1 Upvotes

Sql skill level

What level of expertise should I have in Sql, to carry out sql tasks in data annotation jobs ?

How about python ?

Does these two skills widen my task availability? What platforms can I target for ?

Kindly guide me !


r/learnSQL • • 2d ago

Day 77 — Hospital Management System: added Appointment and RoomService

2 Upvotes

Two more classes today:

  • Appointment, which links a patient with a doctor
  • RoomService, which manages the hospital rooms

The project now has doctors, patients, billing, appointments, and rooms. Following the advice from earlier comments here, I kept each part in its own class and the logic in service classes.

For people who have built an appointment system: what edge cases should I plan for first (double booking, an unavailable doctor, cancelling an appointment)? I want to handle them with custom exceptions from the start.


r/learnSQL • • 2d ago

Free Excel and SQL level tests for beginners: 10 questions each, no sign-up. Tell me where they're too easy or too hard

9 Upvotes

I see a lot of "am I ready to apply?" posts here, so I built two short tests to answer that with something other than a certificate.

\- Excel: 10 questions in a real spreadsheet, from SUM and IF up to VLOOKUP and INDEX/MATCH. [https://getsheetdrill.com/test

\- SQL: 10 questions on a real database, from SELECT up to JOINs and subqueries. [https://getsheetdrill.com/sql/test

You type the formula or the query, it runs in your browser and gets checked right away. Typing the result by hand doesn't pass. At the end you get your level and which topic to study next.

Both are free and need no account. The site has paid lessons further on, but the tests and the first lessons are free.

I made it, so I'm biased. What I'd like to know: which question felt unfair, and what topic is missing for an entry-level analyst role?


r/learnSQL • • 3d ago

Title: Day 75-76 — Combined update: Hospital Management System, adding Billable, Inpatient/Outpatient, and service classes

2 Upvotes

Progress on my Hospital Management System over the last two days. I added:

  • Billable
  • Inpatient and Outpatient classes
  • PatientService and DoctorService

In DoctorService I wrote methods to search doctors by specialization (case-insensitive), update a doctor's availability (throwing a custom DoctorNotFoundException if the ID doesn't exist), list the departments, and view all doctors.

I followed the advice from earlier comments here: keep the model classes simple, put the logic in separate service classes, and use custom exceptions for errors.

For people who've structured something similar: do you keep the doctor collection inside the service class, or in a separate repository class? I'm not sure whether the service is taking on too much.


r/learnSQL • • 3d ago

Is SQL certificate for free worth it ?

5 Upvotes

Hello, I want to learn SQL in hopes to become a data analyst. We don’t have SQL course in our university so I stumbled upon a website that teaches you SQL and you get a certificate after. However the certificate is for free so it’s not taken seriously. I am just wondering if it’s worth even completing or should I pay for one ? I am wondering what would look good on my CV


r/learnSQL • • 3d ago

Does SQL pair well with a marketing degree?

4 Upvotes

I actually graduated 4 years ago and eventually got a marketing job this year, but it’s boring, I work in SEO and there’s nothing fulfilling about it, also the pay is terrible.

I was looking into skills that could make me more valuable o to go alongside my marketing experience and SQL came up, is it worth it?


r/learnSQL • • 3d ago

MySQL Query Optimization in 2026?

11 Upvotes

How to actually learn because I think they are very important for a SQL engineer in 2026...More so than ever.

I want to learn the details of cost-based and heuristic-based query optimization. The problem is I am from Nepal and we do not have libraries or digital courses service from libraries.

To the USA people: Please consider tell government to help us read and learn in a mass way.

I would really appreciate if you guys could help me out.

I found lots of free resources in google pdfs, but they are lecture slides meant to be accompanied with the lecture. But the problem is that lecture video is not freely accessible.

I am willing to pay huge money to learn this thing.


r/learnSQL • • 3d ago

FREE Ebook - Your First 30 Days as a DBA

16 Upvotes

(Portuguese, English, and Spanish versions)

Most of us didn't plan to become DBAs. One day the databases were ours, and we learned the rest in production.

Get the free ebook: https://www.dbatopro.com/products


r/learnSQL • • 3d ago

W3 Schools SQL course

3 Upvotes

Hi Reddit,

I just started the SQL course on W3 Schools online because it is free.

If you complete this course, will it be enough to get a entry level job using SQL?

Or is W3 Schools something that prepares you for certification for SQL?

Thank you!


r/learnSQL • • 5d ago

Free sources to learn SQL

53 Upvotes

Hi everyone, I'm a 3rd-year B. Tech Data Science student and I want to learn SQL from scratch. I don't have money to take a course and I don't want to fall into tutorial hell, so please suggest some free and good resources to learn SQL.


r/learnSQL • • 5d ago

Day 74 — Hospital Management System: started coding with packages, three classes, and custom exceptions

3 Upvotes

I moved from planning to coding today:

Several people here suggested planning modules first, handling exceptions carefully, and not putting all the logic in one class, so I tried to follow that from the start.

Next I’ll build one module at a time and test it before moving on.

For people who’ve used custom exceptions in a project like this: how many did you end up needing, and did you group them under a common parent exception?


r/learnSQL • • 5d ago

We made a free SQL playground that runs in your browser, plus a 21-day beginner challenge

8 Upvotes

If you've ever wanted to practise SQL but got stuck installing a database, this is for you.

DBA Genesis Playground opens with a sample EMPLOYEE table already loaded. Click Run and you see real results in seconds. Nothing to install.

We're also running #21DaysOfSQL: one small challenge a day until Dec 10.

Day 1: Show every row in the table.

Day 2: Show only the employees in Accounting.

Try it here: dbagenesis.com/playground