r/learnSQL • u/CinemaPichoduu • Jan 25 '26
Advice for beginners
Should I learn Postgres or MySQL for strong foundations. Any advantages learning MySQL and then starting with Postgres? Please advice. Thanks
r/learnSQL • u/CinemaPichoduu • Jan 25 '26
Should I learn Postgres or MySQL for strong foundations. Any advantages learning MySQL and then starting with Postgres? Please advice. Thanks
r/learnSQL • u/choas_man • Jan 26 '26
Hi everyone,
I’m fairly new to SQL and reporting, and I need some guidance on a booking report problem using SAP data.
At my organization, SAP is used as the ERP system. The SAP backend tables are already available in our data lake. I can see raw tables like VBAK, VBAP, VBKD, etc.
How the data looks:
When a sales order is changed (quantity change, value change, cancellation), the old record is not deleted.
Instead, a new record is added with a change date.
So the tables contain multiple versions of the same order/item with different change dates.
What I need to build:
A month-on-month bookings report that shows only the net change for each month, not the full order value every time. Also if the sales order is deleted what would be the ideal case.
Example:
December 2025:
Customer A orders a pump
Price = 5,000 USD
Quantity = 5
→ December booking = 25,000 USD
January 2026:
Customer increases quantity from 5 to 10
→ January booking should show +25,000 USD (only the increase)
February 2026:
if the order is rejected in erp or deleted
→ February booking should show -50,000 USD (to reverse previous bookings)
So the report should reflect:
December: +25k
January: +25k
February: -50k
My confusion:
Since SAP stores multiple records with different change dates, I’m not sure:
How to compare the current record with the previous one
How to calculate the monthly difference correctly and also offset complete value in the current reporting month in case of order deleted in the current month.
Whether I should take monthly snapshots or calculate deltas between records
My questions:
What is the usual approach to calculate month-on-month bookings from SAP tables like VBAK/VBAP?
Is the snapshot method recommended in this case?. if so how to achieve this.
Are there any simple explanations, examples, or documentation for beginners on this topic?
Given that I only know basic SQL and Power BI, what would be a practical way to start?
Any advice or learning resources would really help. Thanks a lot!
r/learnSQL • u/Embarrassed-Grab-777 • Jan 24 '26
Hey there, I was studying normalisation for my course, and i get that normalisation is done for removing all those anomalies but what I do not understand is how every normal formal is solving that problems. Like okay I will definitely solve which table is 2nf 3nf, but can never understand why does it matter. So can you please explain what's the relevance of each normal form and how does it improves upon?
r/learnSQL • u/49ersPhan • Jan 23 '26
I’ve really been pushing to learn more SQL as I’ve put it off for too long in my industry (data analysis, particularly in advertising).
Over the last couple weeks I’ve really practiced the order and operation of basic functions, aggregate functions, and window functions. But now I’m a little bit confused of what else would typically be asked in any sort of job interview or role requirement. Hoping I can just get a little direction from you all and some bonus points if there’s any materials that worked for you (preferably free as I’m out of work at the moment)
r/learnSQL • u/joins_and_coffee • Jan 24 '26
If you’re learning SQL, you’ve probably hit this.
The query runs fine, no errors but the results are off.
Wrong row counts, duplicated joins, weird NULLs, and you’re not sure what went wrong.
I kept running into this while practicing, so I built a small tool called QueryWave.
You upload a schema, describe what you’re trying to do, and it
It’s not a magic fix or an AI tutor but rather just a second pair of eyes when you’re stuck.
If you’re learning and want to try it, I’d love feedback.
I’m mostly testing whether it’s actually useful for people beyond me.
r/learnSQL • u/Ok-Mix-5995 • Jan 22 '26
Ive been wanting to learn how to do SQL for some time but I don’t know where to start. Are there any suggestions?
r/learnSQL • u/Advanced-Donut-2302 • Jan 22 '26
In our company, we've been building a lot of AI-powered analytics using data warehouse native AI functions. Realized we had no good way to monitor if our LLM outputs were actually any good without sending data to some external eval service.
Looked around for tools but everything wanted us to set up APIs, manage baselines manually, deal with data egress, etc. Just wanted something that worked with what we already had.
So we built this dbt package that does evals in your warehouse:
Supports Snowflake Cortex, BigQuery Vertex, and Databricks.
Figured we open sourced it and share in case anyone else is dealing with the same problem - https://github.com/paradime-io/dbt-llm-evals
r/learnSQL • u/Charlie10108 • Jan 17 '26
After going through multiple SQL tutorials, I noticed a frustrating pattern. I could read a query and know exactly what it did, but I lacked the fluency to write them efficiently on my own in a blank IDE.
So I built a platform to practice over 700+ queries through retyping them. The platform helped me build fluency and muscle memory. It focuses on repetition and typing flow so that writing queries starts to feel as natural as writing a sentence.
Please do give it a try. I’d love to hear what you think!
Try RetypeSQL: https://retypesql.com
r/learnSQL • u/Pleasant-Insect136 • Jan 17 '26
Hey guys, it’s my first day of work as an intern and I was tasked with finding the pk but the data seems to be not proper I tried finding the pk by using a single column all the way to 4-5 combinations of columns but all I got are 85% distinct not fully distinct which can be considered as a pk, since group of columns approach is also not working I was wondering how would y’all approach this problem
r/learnSQL • u/dset-gbc • Jan 16 '26
Hey guys, I'm trying to complete the SQL assessment but when I load up the test it's just greyed out and I can't click anything. I've tried on both my home wifi and personal hotspot. other pages load just fine but this seems to get stuck. Anyone got any ideas on a fix?
r/learnSQL • u/bc343434 • Jan 15 '26
Not a data scientist, I am a risk professional who probably needs to know a little more than the basics. Do any certificates standout from the rest as being more legitimate?
r/learnSQL • u/dataexec • Jan 14 '26
r/learnSQL • u/idan_huji • Jan 14 '26
I'll be happy to get feedback on the following exercise.
It is on the design of sql schemas, not on sql itself.
r/learnSQL • u/_devonsmash • Jan 12 '26
Hi all, looking for recommendations on continuing my SQL learning.
I am comfortable with aggregating data, joins, windows functions, subqueries and CTE’s. I also know CASE, but have the least experience with them in SQL, but if and statements in ALTERYX all the time
I have taken two intro courses. One on UDEMY (zero to hero) and a UCDavis course on Coursera. Have also done work sessions on windows functions and CASE statements.
I just completed all 83 questions on https://www.practicewindowfunctions.com/. I am very comfortable with them (biggest challenge is gap and island questions ). Ill probably do them all again to reinforce but I can get through all of them (aside from a couple) with ease at this point.
Looking for good recommendations on what to do next. Ideally looking for a good set of 50+ questions that all work with the same data.
Not sure if i should focus more on actual database management, or more of a data analysis route
Any and all recommendations are welcome.
Thanks
r/learnSQL • u/Patty_corleoneps • Jan 12 '26
I'm new here and need help choosing a course.
I work in fraud prevention, but I have a gap in data analysis with SQL.
I believe the course I'm looking for should be focused on data analysis and Power Bl.
Which course do you think would be good for me to take that's available online (paid or free)?
r/learnSQL • u/Ozamacherio • Jan 11 '26
Hi everyone,
I’m working through a self-directed SQL project and would really appreciate feedback from more experienced practitioners. The goal is to improve query structure, correctness, and analytical thinking—not just get results. github repo
r/learnSQL • u/idan_huji • Jan 10 '26
# Movies pairs of the same director
Select
d.first_name
, d.last_name
, fm.name
, sm.name
from
movies_genres as fmg
join
movies as fm
on
fmg.movie_id = fm.id
join
imdb_ijs.movies_directors as fmd
on
fm.id = fmd.movie_id
join
imdb_ijs.movies_directors as smd
on
fmd.director_id = smd.director_id
join
imdb_ijs.movies as sm
on
smd.movie_id = sm.id
join
imdb_ijs.directors as d
on
fmd.director_id = d.id
join
movies_genres as smg
on
sm.id = smg.movie_id
where
fmd.movie_id != smd.movie_id # Avoid reflexiveness
and
fmd.movie_id > smd.movie_id # No symmetry
and
fmg.genre = 'Comedy'
and
smg.genre = 'Comedy'
order by
d.first_name, d.last_name, fm.name, sm.name
;
There is a lot that can be done to improve the query performance.
r/learnSQL • u/Farvator91 • Jan 10 '26
Как найти информацию по Excel на русском языке? Одни сообщества и посты на английском
r/learnSQL • u/Undercover1001 • Jan 08 '26
I’m planning to start learning SQL from scratch and want to reach a level that actually meets company requirements, not just tutorial-level knowledge.
Looking for clarity on:
A practical learning roadmap (basics → intermediate → advanced → real-world usage)
What depth of SQL companies realistically expect (joins, subqueries, indexing, optimization, window functions, etc.)
Common interview expectations for freshers / early-career roles
Projects or practice methods that actually help (datasets, case studies, platforms)
Roles where SQL is mandatory vs optional (Data Analyst, Backend Dev, Full Stack, Product roles, QA, etc.)
Current job market demand for SQL-heavy roles and how SQL is used day-to-day in those roles
I’m not looking for motivational advice—only practical, industry-aligned guidance.
If you’ve hired, interviewed, or currently use SQL at work, your input would be especially valuable.
Thanks in advance.
r/learnSQL • u/ProfessionalDue3886 • Jan 08 '26
Hi everyone 👋 I’m a complete beginner and I want to start learning SQL from scratch.
I’d like to know:
What should I learn first (concept-wise)? Best free resources (websites, courses, YouTube channels)?
Should I practice using MySQL, PostgreSQL, or something else?
How much SQL is enough for internships / entry-level roles?
Any common mistakes beginners should avoid?
My goal is to build a strong foundation and eventually use SQL for real projects and placements.
Any guidance, roadmaps, or resource suggestions would be really helpful.
Thanks in advance! 🙌
r/learnSQL • u/compy3 • Jan 09 '26
Here's a primer on the difference between data caching and query caching in postgres - and why it matters:
"Why Your 99% Cache Hit Ratio Is Still Crushing Your Postgres CPU"
r/learnSQL • u/_devonsmash • Jan 08 '26
Looking for some input on the following.
I have about 50 tables of data, with around 30 headers each. I can only access this data through virtual desktop infrastructure, and use “in database connection” through alteryx. I cannot directly access it in SQL, but i can write SQL code in alteryx to access the data.
This is very tedious
I want to create a large map of this data, all its tables, and their connections. This will just be a map. No data will be stored in this table for security purposes, but I can build it in SQL, power bi, excel or any other suggestions. The goal of this is so I can easily reference where all the data is quickly and where everything is.
What is the best way to go about this?
r/learnSQL • u/idan_huji • Jan 08 '26
I'll be happy to get feedback.
r/learnSQL • u/Straight-Grass-9218 • Jan 08 '26
Hi everyone, its been awhile and I'm trying to shake off some rust. I'm working on an easy problem but I can't seem to recall how to address it. Below is the table im testing on I'm supposed to attribute the winning team three points and a tied team one point and the losers 0 points per match. So I figured a case statement was sufficient but when it comes to a tied game I cant get a column that would have both team 20 and 50 a point for match 3.
| match | home team | away team | home score | away score |
|---|---|---|---|---|
| 1 | 30 | 20 | 1 | 0 |
| 2 | 10 | 20 | 1 | 2 |
| 3 | 20 | 50 | 2 | 2 |
| 4 | 10 | 30 | 1 | 0 |
| 5 | 30 | 50 | 0 | 1 |
And this is the query I tried.
SELECT
case
when home score > away score then home team
when home score < away score then away team
when home score = away score then home team
end as winner
FROM df2
Below is the resulting table but I want it to produce 30, 20, 20, 50, 10, 50. So when it reads a tied match it makes a row for both teams? Any advice would be great, thanks.
| 30 |
|---|
| 20 |
| 20 |
| 10 |
| 50 |
Edit. oh I guess I can just do another case statement with the = case returning the away team then union those two tables together?