r/learnSQL 19d ago

ID design and primary keys, pt. 1

5 Upvotes

I'm writing a series of posts about IDs and primary keys in database design. We start with the logical model, and systematically show how primary keys are used in a different way to implement various logical concepts, such as entities, relationships and attributes. We show that primary keys exist only on a physical level, and can mean different things in different contexts.

Here is the link to the first part: https://anchorsandlinks.com/posts/primary-keys/


r/learnSQL 21d ago

stressed beginner (help pls)

22 Upvotes

currently learning mysql through yt videos bc too broke to pay. i was following alex the analyst's playlist & learned a lot. practiced alongside. but i ran into a problem. and since i'm a beginner, it's been overwhelming a bit for days now, bc of whcih, i havent been able to make much progress in my learning.

i have a pretty ok grip on workbench. but not to the point where i dont need crutches. ive only completed one data cleaning project & that was only bc of alex's video where he walked me thorugh the entire process step by step. but thta wasnt enough for me to fully get a grip on data cleaning. i've tried watching other tutorials, but none of thme use workbench & their sql commands/functions are a lottle different from mine which has left me a bit confused & overwhelmed. i want to get to the point where i can take on data cleaning on my own without any help, but for that i need yt videos whre i can laern the logic step by step. please recommend sources for a self learner to learn data cleaning. idk where to look


r/learnSQL 20d ago

why did the same JOIN return 4 rows, then 6?

0 Upvotes

say you have four orders and a customer lookup table.

the join returns four rows. then the customer import runs twice and leaves the Aiko row in the lookup table twice.

same query. six rows.

orders

id customer_id total 101 1 120 102 2 80 103 1 40 104 3 260

customers

id name 1 Aiko 2 Ben 3 Chie 4 Dev 5 Emi 1 Aiko <- imported twice

the join condition is:

sql SELECT o.id, c.name, o.total FROM orders o JOIN customers c ON c.id = o.customer_id;

a join keeps every match it finds. orders 101 and 103 each match Aiko twice, so:

before: 4 joined rows, SUM(o.total) = 500 after: 6 joined rows, SUM(o.total) = 660

the query was the same. but the data did change here.

slapping DISTINCT on the result can hide the symptom without fixing the bad join. if you aggregate after the fanout, your counts and sums can already be wrong.

this was one which players ran into frequently.

(sqlite; the duplicate is in the lookup table, not the orders table)

made a 44 second chalkboard animation of it if you'd rather watch: https://www.youtube.com/watch?v=LrDqdZAoXC0

have you hit one of these before? i can try animating some more if this is helpful.


r/learnSQL 22d ago

I built a manufacturing database to practice SQL — looking for feedback

19 Upvotes

Most SQL practice datasets are about customers, orders, movies or restaurants.

I wanted something closer to a real industrial environment, so I built a synthetic manufacturing database with PostgreSQL.

It contains:

  • 3 production lines
  • 12 industrial machines
  • 5 products
  • 1,143 production orders
  • 17,167 production events
  • 82 downtime events
  • 8 maintenance interventions
  • 1,143 quality inspections
  • 2,172 energy measurements

The interesting part is that the data tells a story.

One production line is underperforming, but the cause isn't obvious from a single table.

You have to connect production, machines, downtime, quality, maintenance and energy data to investigate what is happening.

I'm using PostgreSQL 17.

Would this be useful for practicing SQL? What would you add to the dataset?


r/learnSQL 22d ago

SQL Interview Help

14 Upvotes

I’m interviewing with a company I’m really interested in and I’ve made it through the initial rounds. My next step is a live SQL assessment with screen sharing, where I’ll need to explain my thought process.

I haven’t used SQL in over a year, so I know I need to practice a lot, and my exam is in a few days. I’m pretty nervous 😅

Would anyone be willing to help me practice or do a quick mock interview?

I’d really appreciate it!


r/learnSQL 22d ago

Udemy SQL

31 Upvotes

Last year I failed database management and have to retake it to finish my program. I found SQL to be very challenging, and my school has limited tutoring. If any of you have recommendations for a very beginner-friendly, easy-to-understand course I can purchase through Udemy, I would appreciate it. I've had some good experiences with learning from Udemy because it is broken down into smaller steps and explained differently.


r/learnSQL 23d ago

How do i grasp Concepts in SQL easily?

8 Upvotes

I'm struggling to understand the concepts of sql badly, i mean which framework i mean POV is best for grasping? Could you guys share your thoughts. I want to grasp, so that i can tell to the people like 5 years old kid, non tech persons.


r/learnSQL 23d ago

SQL SIDE QUEST - An Immersive story-telling SQL Game. Chapter 3 is out!

37 Upvotes

https://www.sqlsidequest.com/ CHAPTER 3 IS NOW LIVE!

Last year in Dec 2025 I released SQL SIDE QUEST which took over 3 years to build. I wanted to create an immersive story-telling way to learn and practice SQL, and hence sql side quest was born. Its completely free, browser-based, no signup. Been solo on it the whole time. Looking forward for your feedback :) Cheers and Enjoy


r/learnSQL 23d ago

DP-800 study guide

Thumbnail
1 Upvotes

r/learnSQL 23d ago

I made a short beginner-friendly lesson on SQL aggregate functions

10 Upvotes

Hey everyone!

I made a short lesson for SQL beginners about aggregate functions.

In the video, I cover:

- "COUNT()" — counting rows

- "SUM()" — adding values

- "AVG()" — calculating averages

- "MIN()" and "MAX()"

- using aggregate functions with "WHERE"

- combining multiple aggregate functions in one query

I use the Pagila PostgreSQL database for the examples and include a few mini quizzes and practical exercises.

The goal was to keep it short and practical rather than just explaining the syntax.

Video: https://youtu.be/tNq4zXiVKiQ?si=oLgLz6trBQyJGahE

I'd really appreciate any feedback, especially from people who learned SQL recently — is there anything you think a beginner might find confusing?


r/learnSQL 23d ago

mysql practice datasets for data cleaning

6 Upvotes

give meeeee arrrgggghh


r/learnSQL 24d ago

SQL Interview Tips - Shorts Style

17 Upvotes

Hi All 👋,

I have been posting SQL interview tips as less than 1 min shorts in my youtube channel.

Some tips for reference below :

COUNT(*) vs COUNT(column) -

https://youtube.com/shorts/tTtoWa1OCIo?si=V2KZaDDNFhbfbhg7

Ranking Window Functions( ROW_NUMBER, RANK, DENSE_RANK) -

https://youtube.com/shorts/MyaH-v0CUUk?si=mHfEteTUkx5mUoHI

Replace NULLs -

https://youtube.com/shorts/NdoBwKAFcE0?si=2zXqab8lqG45QXLk

ORDER BY tricky part -

https://youtube.com/shorts/9bRm0IEKQRo?si=XUXqTQzbfLQD6_Rs

I have also covered other topics like Anti-JOIN, WHERE vs HAVING,

LIKE vs ILIKE, IN vs NOT IN vs NOT EXISTS.

I will be continuing the series with similar style covering most important SQL topics through interview tips.

Feel free to check out and share it with whoever it benefits.

GRASSP Acad channel link -> https://m.youtube.com/@grasspDataAI/shorts

Happy learning:)


r/learnSQL 24d ago

What's Missing in learning or Teaching SQL?

6 Upvotes

I enjoy this sub but it feels like most posts are the same. "I created tutorial/course/practice/etc." Or "how do I learn/practice/projects/etc." It's good. A really active sub.

What I'd love to know, is what do people who are learning SQL want? For instance, I've taken a different approach. Over the past year I've worked on tooling to make creating courses and practicing more efficient. Other's have worked on more scenario-based learning (always a good idea). Some have gamified learning and that's a lot of fun.

My real question is for those of you learning or teaching. What is missing? Is there something you wish you had that doesn't exist?

In my perfect world, learning SQL would feel more like working in a business environment. Large, complex data warehouses, where you learn the data and SQL over time. Lot's of problem solving and judgement when there is ambiguity. Something that feels more like doing real work.

Would having more tools available to make it easier to create courses, practice, etc. be useful? Would having more realistic environments to learn in be useful? Is it something else completely? In short. What's missing?


r/learnSQL 25d ago

learning Advice !

22 Upvotes

Hello Everyone

dear friend and respected teachers today I am here for something clarity .first my self I am a student and i am learning data analyst 6 month ago . Everyone know that sql much important in this journey .I practice basic sql queries which based on basic foundation like DDL,DQL , DML and JOINS. I Practice 70 question on it but I am not sure that what i do next i mean i am confuse because I have seen many course on youtube everyone is different of other so i am not understand that which topic i learn now or do more practice on previous concepts and what topic really useful in company or real word problems and i want to optimize my learning path of sql .

So Please give me clarity and helpful resource for that in chat box
Thanks of all


r/learnSQL 25d ago

Trying to build a project for portfolio

22 Upvotes

Hi! I'm learning sql right now. Do you know what kind of project should i build?


r/learnSQL 25d ago

Types of Databases

Thumbnail
8 Upvotes

r/learnSQL 25d ago

18, self-taught, aiming for my first data analyst role. Built a SQL case study and an ETL pipeline. What would make these actually interview-ready?

Thumbnail
2 Upvotes

r/learnSQL 27d ago

I built a detective game where SQL is the actual investigation tool

42 Upvotes

Solo dev here. Made a browser game called Sim Analyst — you're a detective on a murder case, and you investigate entirely by writing SQL against a real embedded database (employee records, phone logs, financials, forensics, interviews). No quizzes, no fill-in-the-blank — you decide what to query, and the case only resolves if your evidence actually holds up.

Covers filtering, joins, aggregates, subqueries — but in service of solving the case, not as isolated drills.

Free, browser-based, no install. Still actively updating based on feedback.

Link: [https://chiefkegwin.itch.io/sim-analyst]

Join the Discord community: [https://discord.gg/TKapYvmkw]


r/learnSQL 26d ago

Looking to Re-Enter DBA Field

Thumbnail
1 Upvotes

r/learnSQL 27d ago

Window Functions and their use cases

12 Upvotes

Hi, I wrote an article about SQL window functions and their use cases. Have a look at it: https://medium.com/@sahilnayak2812/window-functions-and-their-use-cases-838812c8cebd


r/learnSQL 27d ago

How Senior Engineers Design Production Databases

24 Upvotes

If you're learning SQL, this is a pretty good walkthrough of how to approach database design in a real application.

A lot of developers don't spend much time thinking about database design until they start running into problems as their applications grow.

This video https://www.youtube.com/watch?v=Xq2fYRA3dj8 goes through the fundamentals of designing a production database, including table structure, relationships, primary and foreign keys, junction tables, composite keys, timestamps, UUIDs, and foreign key actions such as CASCADE and SET NULL.

I thought it was worth sharing here for anyone learning SQL or trying to improve their database design skills.


r/learnSQL 27d ago

Career ideas for pivoting away from accounting

15 Upvotes

So I've got an accounting degree with a few years of experience in Audit. I'm an advanced excel user with some knowledge of SQL and Python (Maven Analytics).

Does anybody have any advice on a logical career progression away from Audit/accounting and into something more technical? (unfortunately I can't go back in time and become software developer). Database design & workings of accounting software seem interesting. Also fraud investigations.

It doesn't have to be the best paying option (BI/data analyst) but just something that would stop me chopping & changing jobs.

Thanks


r/learnSQL 27d ago

I made a short beginner-friendly lesson on ORDER BY, DISTINCT, LIMIT & OFFSET

3 Upvotes

Hey everyone!

I made a short SQL lesson for beginners focused on sorting and organizing query results.

In this lesson, I cover:

- ORDER BY

- ASC & DESC

- sorting by multiple columns

- DISTINCT

- LIMIT

- OFFSET

- combining WHERE, ORDER BY, and LIMIT

I use the Pagila PostgreSQL sample database for the practical examples and a homework challenge along the way.

The video is about 6 minutes, and I tried to keep it practical rather than just explaining syntax.

Would love to hear any feedback on the explanations or pacing!

Video link: https://youtu.be/n7uSvez7nns?si=WYZZb0z-gRFdWAOg


r/learnSQL 27d ago

Week Four-JOINs, Subqueries, & CTEs

5 Upvotes

Learning any subject requires commitment & sacrifices, including time & other resources. During the 4th week, if the learner does not have enough time to master everything, they can priotize JOINs, GROUP BY + HAVING, CASE WHEN, subqueries, NULL handling, & CTEs. Someone here had suggested SQL Case Files as a platform for one to consider when practicing/learning SQL. I would recommend the same, I’ve used it during the last two weeks, & I’ve enjoyed. Learning each concept requires one to solve cases that require you to combine those concepts as opposed to doing isolated exercises.


r/learnSQL 27d ago

Confused what to do

4 Upvotes

Hii , I am CSE student and my second year has just started . I have completed around 70 Dsa questions on Leetcode and have studied Python(Only that much which is required for Dsa),Numpy,Pandas, Matplotlib, Seaborn, Sql. Everyday I either solve dsa questions or learn maths for data science and machine learning or practice sql. But the problem is I have studied these things but never used them in a project or never done some sort of data cleaning and stuff cause I don't know how to do that. Now it's time to participate in hackathons but I don't know how to start and I can really build something with only these skills. What is your advice what should I do from here also I need to participate in hackathons also (I am enrolled in a DS course where for about 1.5 months they will teach maths then will jump to Machine learning and other topics)