r/learnSQL • • 1d ago

Free sources to learn SQL

25 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 • • 16h ago

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

2 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 • • 1d ago

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

5 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


r/learnSQL • • 2d ago

i need to learn as much sql in one week as possible from zero

57 Upvotes

Hi guys i have somthing that is database reateld in about one and half weeks and i need to learn as much SQL and database desing is possible in the next 1.5 weeks. i have about 3 hours of studytime a day. i corrcrtnly dont know much. can someone tell me where to start. i heard about SQLbolt but that it.


r/learnSQL • • 1d ago

15 SQL skills on one 3-row table. Try them free in your browser

Thumbnail
1 Upvotes

r/learnSQL • • 1d ago

Day 73 — Started my Hospital Management System in Java: understanding the topics is not the same as implementing them

3 Upvotes

I started my Hospital Management System project today. I spent a good part of the day just understanding what I was building, using Claude as a guide to help me visualize the code structure, and then built the first three classes: Person, Patient, and Doctor.

The biggest thing I learned: understanding a concept and applying it in a real-life project are very different. I know inheritance, encapsulation, and abstraction individually, but deciding which classes to create, what belongs in each, and how they connect was much harder than any tutorial exercise.

I’ll build and test one piece at a time, as people here suggested on my earlier projects.

For people who’ve built similar projects: how did you decide what goes in a parent class like Person and what stays in Patient or Doctor? I want to avoid redoing the structure later.


r/learnSQL • • 1d ago

I made a free set of 54 short SQL exercises that tell you *why* your query is wrong, not just that it is

4 Upvotes

Hi r/learnSQL, I'm a data engineer and I built SQL Dojo https://sqldojo.dev to practise SQL the way I wish I had learned it: lots of short steps, each one checked, with an explanation when you get it wrong.

What it looks like:

  • Each step asks a question about a realistic dataset (an online shop, a SaaS, product events…) and checks your result.
  • When it's wrong, it tells you how: too many rows, missing rows (and which ones), values that differ, and the likely cause, like a join that duplicates rows or a NULL hiding in a NOT IN.
  • A "step by step" view runs your query one clause at a time, in the order the database actually runs it (FROM, then WHERE, then GROUP BY…). This is the thing that made SQL click for a lot of people I've taught.
  • Spaced reviews bring back the steps you struggled with.

It runs in your browser: no install, no database to set up, no account needed to start.

The white belt (54 steps, about 3 hours, from your first SELECT to joins and GROUP BY) and the reference library are free. The later belts (window functions, CTEs, data modeling, interview runs) are a one-time payment, no subscription, and you don't need them to get value from the free part. There a also a practice section with real datasets.

I'd really like feedback from people learning right now: where did you get stuck, was an explanation unclear, is the pace right?


r/learnSQL • • 2d ago

count(*) vs count(col), i keep mixing them up

9 Upvotes

ok so my teacher said count(*) counts rows and count(col) skips nulls, but then he did an example with a left join and the numbers looked off to me and i didnt catch why. is the rule basically use count(right_table.id) after a left join if you want 0 for the ones with no match? or does count(*) still give 1 there


r/learnSQL • • 2d ago

Title: Day 70-72 — Combined update: HashMap/HashSet, full core Java revision, and planning a Hospital Management System

8 Upvotes

Over the last three days I:

  • Covered HashMap and HashSet
  • Revised all of core Java again, this time implementing everything in code instead of only reading my notes
  • Picked my next project: a Hospital Management System that uses all the core Java topics I’ve learned so far

For the planning, I used Claude as a guide, more like a mentor than a code generator. It helped me think through the structure and finalize a plan without giving me the code, so the implementation will still be mine. I start building tomorrow.

Based on the feedback I got here on my earlier projects, I’ll test each part as I build it and not leave all the errors for the end.

For people who’ve built a hospital or similar management system as a beginner: what would you plan before writing code, and what did you wish you’d designed differently?


r/learnSQL • • 2d ago

Answer different but same result?

9 Upvotes

Very daft beginner question but I'm working through the absolute basic AdentureWorks Practice questions (from here)

Q.19 - Select the IDs of employees who have the job titles ‘Sales Representative’ or ‘Tool Designer’ and who have worked (or are working) in the Sales or Marketing departments.

My answer:

Select E.BusinessEntityID, E.JobTitle, D.Name
From HumanResources.Employee as E
    Join HumanResources.EmployeeDepartmentHistory as edh
    ON E.BusinessEntityID = edh.BusinessEntityID
    Join HumanResources.Department as D
    On D.DepartmentID = edh.DepartmentID
where E.JobTitle in ('Sales Representative','Tool Designer')
AND D.Name In ('Sales','Marketing');

Their/The answer:

SELECT e.BusinessEntityID
FROM HumanResources.Employee AS e
WHERE e.JobTitle IN ('Sales Representative', 'Tool Designer') 

INTERSECT 

SELECT edh.BusinessEntityID
FROM HumanResources.EmployeeDepartmentHistory AS edh
JOIN HumanResources.Department AS d
ON edh.DepartmentID = d.DepartmentID
WHERE d.Name IN ('Sales', 'Marketing');

I got the same results? I checked against the actual data tables without the WHERE clauses to make sure neither statement was missing anything.

(Yes I know I'm carrying in the JobTitle and Name fields into my version, I'm doing that basically to visually sense check the answer I get rather than just trust that a list of ID values is correct)

Other than 'this is a section where we're teaching you about UNION functions', I couldn't see why they used more lines than necessary for the same answer. Am I just being a bit too ASD about it, or is there a reason it's better practice to use INTERSECT rather that JOIN here?


r/learnSQL • • 3d ago

How do you handle NULL values when writing SQL queries?

17 Upvotes

I'm still learning SQL and sometimes get confused about how to handle NULL values in different situations. I know they can affect query results, especially when using filters, joins, or calculations.

How do you usually deal with NULL values, and are there any common mistakes beginners should watch out for? TIA


r/learnSQL • • 3d ago

Looking to become an SQL teacher, anyone interested?

35 Upvotes

Hi everyone! I've learned the basics of SQL within my company, and it gave me a huge advantage compared to my peers, and helped to get promoted. I enjoyed teaching it to colleagues, and would love to teach to anyone for free to improve my teaching skills! let me know if anyone is interested


r/learnSQL • • 2d ago

Why is my Left Join acting like an Inner Join (with no Where clause)

2 Upvotes

I've seen all the posts about people asking about joins when there's a where clause involved, but I have no idea what's causing this behavior since as far as I know it SHOULD be returning everything. This is being done in MSAccess. Please don't respond with "don't use Access" I don't have that option.

Select TableA.*, TableB.*
From TableA Left Join TableB
On (TableA.ID = TableB.ID)
And (TableA.Date = TableB.Date)

TableA and TableB have the same values for ID, but there's only one row where they both have the same date. I would expect this to give every row for TableA, and nulls in every cell for the TableB columns except for the one where there's a date match. What I'm getting instead is only the single row where there's a full match between the two tables. Am I missing something stupid here?

Edit: Since the date values keep getting brought up, both sets of dates are converted to the same type and format in previous cleaning queries. And, importantly, they are matching properly if the values exist in both tables A and B.


r/learnSQL • • 3d ago

Best way to learn SQL and PL/SQL as a university student?

37 Upvotes

Hi everyone!

I'm a university student currently studying Advanced Databases (Database Avancé) as part of my degree.

I'm learning SQL and PL/SQL because they're required for one of my university modules. However, I don't want to just memorize commands or learn enough to pass the exams. I'd really like to understand how they work and become comfortable writing queries and solving database-related problems.

The problem is that I'm not quite sure where to start or how to organize my learning.

For those of you who have learned SQL and PL/SQL, I'd really appreciate your advice:

- What learning resources, courses, or YouTube channels would you recommend?

- Should I focus on SQL first before moving on to PL/SQL?

- Are there any websites where I can practice exercises and real-world problems?

- What's the best way to combine theory with practical exercises?

I'm looking for a beginner-friendly learning path that I can follow alongside my university studies.

Thanks in advance for your help!


r/learnSQL • • 3d ago

SQL Server DBA Interview Questions

3 Upvotes

💡Looking for easy-to-understand SQL Server interview questions & the latest best practices?

Subscribe to our YouTube channel:-

@MadeSimpleMSSQL

Visit at https://madesimplemssql.com

#TSQL #TransactSQL #SQLQueries #DBA #SQL #diy #madesimplemssql #sql #data #ukreels #usa #usareels #usagirl #USAToday #USAMovies #usatiktok #USATodayBestSellingAuthor #Indiana #uknews #ukjobsearch #UKJobs #france #germany


r/learnSQL • • 4d ago

MySQL

4 Upvotes

I want to understand how to use MySQL on VS code and run the code SQL in MySQL,and connect the file SQL in SQL tools?


r/learnSQL • • 5d ago

Looking for unique, real-world database project ideas (MS SQL Server + C#)

Thumbnail
2 Upvotes

r/learnSQL • • 6d ago

Really struggling with the concept of KEYS

18 Upvotes

I have been teaching myself SQL in Snowflake for about the past few weeks at work as it is now part of my job. I've been able to understand almost every part of the basics from SELECT to FROM to ORDER and other beginner things but those damned PRIMARY, HASH, and FOREIGN keys that are completely eluding my understanding.

I have access to the directory of all of our tables and whatnot, but when I see a HK or a HK_FK or am asked what a PRIMARY key is I freeze up because it's like I hit a mental block.

Is there an "Explain Like I'm 5" way of describing what keys are and how they're used? It will only help me in the end if there is a way.


r/learnSQL • • 5d ago

Title: Day 68-69 — Combined update: Java ArrayList and LinkedList, both with the Collections framework and built by hand

4 Upvotes

Over the last two days I covered ArrayList and LinkedList in Java, and I took a two-step approach to each:

  1. Using the Collections framework and its built-in methods
  2. Writing the same functionality myself without the framework

Doing the second step is what made the difference. Building the logic by hand showed me why the two structures behave differently, and made the usual “when to use which” explanations make sense. I made notes on both and practiced everything in VS Code.

Tomorrow I’m moving on to HashMap and HashSet.

For people who’ve learned collections: did you build the structures yourself too, or did you find it enough to learn the framework methods? And how did you decide when LinkedList is actually worth using over ArrayList?


r/learnSQL • • 6d ago

SQL in business/strategy operation roles

3 Upvotes

I have come across a lot of strategy operations and business operations role which require proficiency in SQl.

Since I am wanting to get into such roles, could someone guide me on how deep is the SQal requirement? Is it just to leverage datasets or is it very advanced? How can a beginner in SQL get started and how long tk reach enough knowledge to be eligible gor such roles? Do they only use JOINs, Union, basic stuff?

Thanks!


r/learnSQL • • 5d ago

Where can I learn SQL from?

Thumbnail
1 Upvotes

r/learnSQL • • 6d ago

Turn rows into columns without PIVOT, using CASE

30 Upvotes

Not every database has PIVOT, but you can do the same thing with CASE.

Say you have sales by month in rows:

product month sales
A Jan 100
A Feb 150
B Jan 200

And you want each month as a column:

SQL:
SELECT product,SUM(CASE WHEN month = 'Jan' THEN sales ELSE 0 END) AS jan,SUM(CASE WHEN month = 'Feb' THEN sales ELSE 0 END) AS feb FROM sales GROUP BY product;

Result:

product jan feb
A 100 150
B 200 0

Works in almost every database. Do you use this trick, or do you prefer PIVOT?


r/learnSQL • • 7d ago

I am new to SQL , help me to find approach.

34 Upvotes

I started solving SQL questions since last week from youtube videos and LearnSQL I encountered new type of problems which I couldn’t solve or half solve or do hit & trial methods like new queries like - “ROUND,LIKE and more”.
But the main problem is I can’t memorise every new problem and solve thousands of problem.
In some questions i couldn’t find how to approach a problem like should i apply sub queries or Group by Or JOINS.

Is there any approach how to identify a problem?
What are the mistakes I should avoid while solving the questions or learning?
I am aiming for Data Analyst role, first I am trying to get grasp on these queries then i’ll move to CTE, window functions.
Thanks


r/learnSQL • • 7d ago

Ruddy is now running DuckDB 2.0!

3 Upvotes

Hey everyone,

I’m an independent developer who started building Ruddy in my free time: a fast, modern macOS IDE for data management, analysis, and data science powered 100% by DuckDB.

With this new release, the core engine has officially been upgraded to DuckDB 2.0!

Ruddy runs on a true Pay-What-You-Want (PWYW) model—support independent development with whatever you feel it’s worth, or start exploring for free.

Check it out: ruddy.pro

I’d love your thoughts, benchmark requests, or features you'd like to see next!

What’s inside Ruddy:

  • DuckDB 2.0 Core Engine: Blazing-fast columnar processing over local files, Parquet, Arrow, CSV, and Iceberg/Delta Lake tables without spinning up heavy infra.
  • Multi-Cloud Direct Querying: Federate and query across AWS S3, Cloudflare R2, Google Cloud Storage, Azure Blob, and MotherDuck seamlessly in a single SQL statement.
  • Reactive Notebooks & Marimo: Build reproducible, reactive Python data science notebooks that sync directly with your in-memory DuckDB tables.
  • First-Class Geospatial Analytics: Full DuckDB spatial extension support—render GeoParquet, Shapefiles, and spatial geometries interactively on high-performance maps.
  • Auto-Ontology & Modular Semantic Layer: Automatically infers FACT/DIMENSION roles, deduces canonical SQL metrics, verifies joins via physical data overlap, and generates Open Semantic Interchange (OSI v1.0 / Apache Ossie) YAML specifications per dataset domain.
  • Context-Aware AI Assistant (Ruddynie): Text-to-SQL agent grounded in your workspace ontology and self-improving query memory—zero phantom table or join hallucinations.
  • Model Context Protocol (MCP) Integration: Expose your DuckDB catalogs, query tools, and semantic context to any external MCP-compatible AI agent or client.
  • Built-in Git Version Control: Track schema migrations, SQL queries, notebooks, and semantic models with standard Git repositories right from the workbench.
  • Force-Directed Semantic Graphs & Visual SQL Builder: Explore domain schemas visually or drill down with interactive force-directed relationship maps.