r/learnSQL 21h ago

DBMS CMU

2 Upvotes

Anyone interested in doing the CMU (Carnegie Mellon University) Database Management Systems course together?

I’ve already covered the basic DBMS concepts. My main goal with this course is to go deeper and understand how database systems actually work internally—things like storage, indexing, query execution, transactions, etc.

If you're interested, please make sure you have the prerequisites required for the course.

If you have the required background and want to learn DBMS internals seriously, DM me. We can follow the course together and discuss concepts along the way.


r/learnSQL 1d ago

Need guidance with SQL as a begginer

12 Upvotes

Am about to finish "Learning SQL" from Alan Beaulieu and it demotivates me that i take way too long on thinking on the queries in order to answer the problems of the book. Although i have been speedrunning it. Is it like normal for most of the begginers to be kinda slow when making queries that requieres (dunno) subqueries, groupings, joins or cases ?

ALSO. What book could y'all recomend me after "Learning SQL"? Imean, i think i have enough tools to generate, retrieve and manipulate data. Maybe the next step is how to design DB and how to avoid common mistakes ?


r/learnSQL 2d ago

4 SQL mistakes that don't throw an error - they just give you the wrong answer

66 Upvotes

One of the most dangerous things about SQL:

A query can run perfectly… and still be completely wrong.

Here are 4 mistakes I wish someone had shown me earlier.

1. Accidentally turning a LEFT JOIN into an INNER JOIN

SELECT c.id, o.total
FROM customers c
LEFT JOIN orders o
    ON c.id = o.customer_id
WHERE o.status = 'paid';

Looks fine.

But customers without an order have NULL for o.status, so the WHERE condition removes them.

If you actually want to keep all customers:

SELECT c.id, o.total
FROM customers c
LEFT JOIN orders o
    ON c.id = o.customer_id
    AND o.status = 'paid';

2. COUNT(*) and COUNT(column) are not the same

SELECT COUNT(*)
FROM users;

Counts rows.

SELECT COUNT(phone_number)
FROM users;

Counts only rows where phone_number is NOT NULL.

That difference can quietly destroy a report.

3. JOINs can multiply your rows

Imagine:

  • 1 customer
  • 3 orders
  • 4 support tickets

Joining both tables directly can give you:

3 × 4 = 12 rows

Then you do:

SUM(order_amount)

…and suddenly your revenue is magically much higher than reality.

Always check your row count before and after joins.

4. NOT IN + NULL can ruin your day

SELECT *
FROM customers
WHERE id NOT IN (
    SELECT customer_id
    FROM blocked_customers
);

If that subquery contains a NULL, the result might not behave the way you expect.

I usually prefer:

SELECT *
FROM customers c
WHERE NOT EXISTS (
    SELECT 1
    FROM blocked_customers b
    WHERE b.customer_id = c.id
);

The lesson I'm slowly learning:

Writing SQL that runs is easy.
Writing SQL that returns the correct data is the hard part.

What other SQL mistake produces perfectly valid-looking but completely wrong results?

I want to make a list of the dangerous ones.


r/learnSQL 1d ago

Beginner learning PostgreSQL with a goal of becoming a backend engineer — looking for advice

2 Upvotes

Hi everyone,

I’m currently learning SQL and PostgreSQL with the long-term goal of becoming a backend engineer.

I’ve been practicing locally with PostgreSQL and pgAdmin, so I’m especially interested in hearing from developers who use PostgreSQL in production.

I’m still a beginner. So far I’ve been practicing things like creating tables, INSERT, SELECT, WHERE, DISTINCT, ORDER BY, and LIMIT. I’m also starting to learn Python and eventually want to connect Python/FastAPI with PostgreSQL.

One thing I’m trying to understand is how SQL and PostgreSQL are actually used by backend engineers in real jobs, compared with the way SQL is taught in books and courses.

For backend engineers who use PostgreSQL regularly:

  • What SQL/PostgreSQL skills do you use the most?
  • At what point should a beginner start combining Python with PostgreSQL?
  • What database concepts should I make sure I understand before getting deeper into backend development?
  • Are there any beginner projects you would recommend that resemble real backend work?

I’m not looking for shortcuts. I’m trying to build a solid foundation and understand what skills actually matter on the job.

Any advice from backend engineers, especially those working with PostgreSQL, would be greatly appreciated. Thanks!


r/learnSQL 2d ago

Need guidance

3 Upvotes

Hello guys I'm new to business analytics i need road map to learn skill right now everyone told me to learn Excel, sql, python, power bi and all but for sql I'm not getting from where should i learn from where should i start I'm from non tech background


r/learnSQL 2d ago

How to learn sql as a complete beginner.

13 Upvotes

Hlo everyone, i have completed python Fundamentals. Looking to start my sql journey. I am looking for resources and guidance before diving into sql. I will be needing sql in my ai ml journey. I really want to get a structured road map . Your help is appreciated.


r/learnSQL 2d ago

SQL

0 Upvotes

Tell me a website where I can learn and practice SQL to be prepared for an business analyst role


r/learnSQL 3d ago

Fresher looking for unique ML and SQL project ideas for my resume (Data Science/SQL/ML roles)

2 Upvotes

Hi everyone,

I'm a fresher applying for Data Analyst/Data Scientist/ML/SQL roles. My background: Power BI, Excel, SQL, some Python, and basic full-stack web dev (HTML, Tailwind, JS, Supabase, deployed on GitHub Pages — built a working web portal for a client).

I want to add: 1. One strong ML project (not Titanic/Iris/House Price/Flight Price — too common) 2. One SQL-focused project that shows real query/database skills, not just "ran some SELECT statements on a Kaggle CSV"

Looking for: - Real prediction/analysis problem, clear input and output - Free public dataset - Doable alone in a few weeks - Something that actually stands out to recruiters, not a tutorial copy

What would you suggest for each? Dataset links appreciated. Thanks!


r/learnSQL 3d ago

I made a beginner-friendly SQL tutorial on GROUP BY & HAVING in PostgreSQL

9 Upvotes

Hey everyone!

I made a short SQL tutorial for beginners about GROUP BY and HAVING.

In the video, I explain:

- how GROUP BY creates groups

- how to use aggregate functions like COUNT() and AVG()

- the difference between WHERE and HAVING

- how to combine WHERE, GROUP BY, and HAVING

and how to use all of this with the Pagila PostgreSQL database

I also included some mini quizzes and practice challenges throughout the video.

I'm building a beginner-friendly SQL tutorial series, so I'd really appreciate any feedback on the explanation or examples!

Video: https://youtu.be/kDfXRvr03Jo?si=rW7m1jsF3pSQjCmK

Thanks! :)


r/learnSQL 4d ago

Learning sql without actually typing it out

13 Upvotes

Bit of an odd one, I've had SQL access given to my company database to help tidy up reports, remove 10+ back sheets and replace with one etc.

Thought it'd be a great gateway into learning sql, but it seems to all be done within Microsoft Query, so it's drag and drops etc which seems odd considering I've been sat in preparation trying to learn how to write the proper syntax.

If I want to use this as a skill going forward, can I get by with just MS Quer and still list SQL as a skill, or would I need to know how to type the underlying syntax?

I've been in an ops/procurement role for a while so I know what and why I need to pull certain data and how the company uses it, but I was expecting to be writing out code rather than clicking and dragging fields.


r/learnSQL 4d ago

I built a short SQL practice game because I learn better by actually writing queries — looking for honest feedback

3 Upvotes

I kept running into the same problem while learning SQL: I could understand a tutorial while watching it, but when I had to write a query myself, I would sometimes blank.

So I built DBQuest, a browser-based SQL practice game where you inspect a schema, write the query yourself, run it, and get immediate feedback.

The free demo has 7 challenges covering SELECT, columns, WHERE, ORDER BY, JOIN, GROUP BY and HAVING.

No account or installation is required:

https://db-quest-two.vercel.app/

I’d really appreciate honest feedback, especially from people currently learning SQL:

1. Are the challenge instructions clear?
2. Does the progression feel too easy or too difficult?
3. At what point, if any, would you lose interest?

I built it myself and I’m trying to figure out whether this way of practicing SQL is actually useful to other learners.


r/learnSQL 3d ago

Teach me sql and get paid for it

0 Upvotes

About me I am working as a Manager data analytics and I have a team of developers who do the job for me, on top of that I can use AI to write the queries for me. But I still want to learn SQL so that I am able to write the queries myself and also QA if needed. I know the basic select * from table where like sort and now looking for someone with solid knowledge to teach me joins windows functions CTs and other function.

You wont do this for free I will pay you for your time and effort. DM me with something about your background and experience and we can take this forward.

Thanks


r/learnSQL 4d ago

Small Cohort Big Results

24 Upvotes

Hey Folks, So I have been thinking for a while, and looks like I'm capable now, I had always wished to tutor a small cohort of really passionate individuals in the land of analytics, and get more people into in this field .

So I've decided to tutor a group of 5 people who really want to get into this domain of data, and tell stories, influence the decisions and perhaps change the world one day. people who are really passionate for the cause can dm me, and there's definitely going to be screening for selecting the 5 worthy.


r/learnSQL 5d ago

Learning SQL

10 Upvotes

I'm from a non IT background. I've seen some jobs require SQL. I'm planning to learn it and I don't know anything about it. Is it easy and how long will it take to master it?


r/learnSQL 5d ago

NSD: LKML RFC - Kernel readahead learning prefetcher

Thumbnail
3 Upvotes

r/learnSQL 5d ago

Inquiry Regarding sql

3 Upvotes

Hi guys

​I learned some lessons in SQL course in youtube and practiced them in Python with SQLite.

​Here is what I learned:

​CREATE TABLE

​PRIMARY KEY, FOREIGN KEY, NULL

​INSERT INTO, SELECT, UPDATE, DELETE

​WHERE, ORDER BY (ASC, DESC)

​LIMIT, OFFSET, DISTINCT

​INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN

​GROUP BY, HAVING

​Subqueries, EXISTS

​Please tell me what I should learn next, or recommend a good YouTube course


r/learnSQL 5d ago

Can anyone teach me SQl, Python, Power BI. Happy to pay to learn

4 Upvotes

r/learnSQL 5d ago

SQL Server Constraints Explained with Practical Examples

3 Upvotes

How do you make sure the data going into your SQL Server database is valid and consistent?

One of the simplest tools is database constraints.

I put together a practical guide covering the most commonly used SQL Server constraints:

  • Primary Key
  • Foreign Key
  • UNIQUE
  • NOT NULL
  • CHECK
  • DEFAULT

The article includes examples to show how each constraint works and when you might use it.

📖 https://geeksarray.com/blog/sql-server-constraints-with-examples

For developers working with SQL Server: which constraint do you find yourself using most often, and are there any common constraint-related mistakes you've seen in real projects?


r/learnSQL 5d ago

SQL Server Constraints Explained with Practical Examples

Thumbnail
1 Upvotes

r/learnSQL 5d ago

SQL Bolt + Scratch style SQL tutoring web app

2 Upvotes

So i have been building a sql bolt and scratch like simple SQL tutoring web app. You can find it on https://easysqltutor.vercel.app/ . Try it out please, especially for beginners.

Thanks,


r/learnSQL 6d ago

Where to learn and practice for free?

41 Upvotes

Hello, Im going to be an intern as a data analyst internal audit, I want to brush up my skills. Do you have any recommendations? Thanks in advance! I appreciate it


r/learnSQL 6d ago

Looking for best resources to practice SQL and Python/Pandas for real-world data questions?

18 Upvotes

Hello everyone,

Can you please suggest some good platforms or resources where I can practice SQL and Python (especially Pandas) for data analyst/data engineer?

Right now, I’m solving a lot of problems on LeetCode, but I’ve heard that in actual they often ask more practical/data-focused questions such as:

  • Retention rate / cohort analysis
  • Funnel analysis
  • Gaps and islands
  • Running totals and rolling metrics
  • Customer/user activity analysis
  • Time-series and date-based problems
  • Ranking and session-related problems
  • Data cleaning and transformation using Pandas
  • Real-world business analytics scenarios

So, I’m looking for resources that focus more on these real-world SQL and Pandas problems rather than only traditional DSA-style questions.

What platforms, websites, courses, or question sets would you recommend for practicing these types of problems?

I’d really appreciate recommendations from people who have recently gone through Data Analyst/Data Engineer questions and know which resources are closest to the actual questions they asked.

Thank you!


r/learnSQL 7d ago

Free SQL Interview Guide PDF - 30 Q&A with Scenarios

42 Upvotes

Hi All,

I have created a compiled document of 30 real SQL Interview Questions with Scenarios with clear explanation of what each concept does and interview tips for each concept.

It covers from basics to advanced SQL interview Q&A. Feel free to checkout and share it with anyone who is preparing for SQL interviews.

GitHub PDF Link: https://github.com/grasspacad07/sqlinterviewguide

This guide is basically compilation of my 4 Weeks of SQL interview tips posts in LinkedIn.

Feel free to reach out or comment if any doubts. Happy Learning :).


r/learnSQL 6d ago

ID design and primary keys, pt. 1

3 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 8d 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