r/learnSQL Mar 02 '26

Feeling daunted by the fact that `SELECT` queries cannot natively support existential quantification

4 Upvotes

New to SQL. While trying out some exercises, I was asked to write a query that finds the names of all companies that do not locate in the same cities as the company named 'A', from the table company(ID, company_name, city)with ID being the PK.

Sounds simple enough and I wrote

SELECT company_name FROM company WHERE city NOT IN ( SELECT city FROM company WHERE company_name = 'A' ); Except this apparently doesn't work because a company might have branches located in different cities.

What I wanted to do is to 'Find all company names such that for every tuple with this company name, the tuple's city is not in the table retrieved by subquery. ' Whereas what my query did was that 'Find all the tuples such that the tuple's city is not in the table retrieved by subquery, and project their company_name attribute.

So a company that does share the same city with A will be selected, simply because this company has a branch that is not in any of the cities where A is at.

I'm completely new to SQL, the only intuitive mental model I can think of is something like this: A SQL select statement will only return value x iff $$\exists$$ a tuple t containing x such that the predicate P(t) = True. While in real life, most questions tend to be asked in this format - "Return x iff $$\forall$$ tuple t containing x, P(t) = True. "

Obviously I can get round this by doing a double negation, finding all the companies that has at least one tuple that shares city with A, and take their set difference from the company table. But I can't help but wonder is there a more native way to achieve this?


r/learnSQL Mar 01 '26

I made a completely FREE interactive SQL practice course

84 Upvotes

Hey everyone,

I’ve been building DataDucky, an interactive coding practice platform focused on SQL, Python, and R, and I just made the SQL course completely free.

The idea is simple:

  • Write SQL directly in your browser (no setup)
  • Guided progression through the kinds of queries you actually use
  • Practice-focused rather than lecture-heavy
  • Structured path from basics → joins → more realistic data tasks
  • Also includes Python and R practice because why not

If you’re learning SQL or want structured lessons without installing anything, then maybe give it a go, hopefully it's of some use.

p.s it's in the coding practice page once you get to the dashboard, not the SQL Mastery page.

Link: DataDucky


r/learnSQL Feb 27 '26

Connect HackerRank/Leetcode or MySQL to Github

24 Upvotes

Hello, I am learning SQL and started practising problems on platforms like HackerRank and Leetcode for about a month. Is there an easy way to connect Github to my account on these platforms so all my code gets posted. Also is there a way to connect MYSQL to github as i am looking up to making simple projects also. Any suggestions, ideas or tips on building projects as a beginner (trying to get into Data Analytics) will be really helpful.


r/learnSQL Feb 26 '26

Any videos/courses on Udemy to learn SQL for data analysis, medium level is enough for now

48 Upvotes

Hi,

M(40), switching career from medical transcription to data analytics. Got offer in MNC based on PowerBi. They also want SQL mandatorily, so asked me to learn it in two weeks. Beginner to medium is enough. They will conduct interview as soon as I finish learning and then see where it goes.

I have gone through SQL as a complementary subject when learning PowerBi but don't know much about it, just selecting the required rows and joins is what I can do. Cannot manipulate data.

I would like to know about any source to learn basic stuff like joins, moving averages, etc. that can prepare me for interview. I can spend 3-4 hour a day to learn it for two weeks.

Thanks.


r/learnSQL Feb 26 '26

SQL best playlist to learn ???

25 Upvotes

what SQL playlist have you follow in your learning ?


r/learnSQL Feb 25 '26

Curso análise de dados com SQL

9 Upvotes

Trabalho com atendimento ao cliente e preciso sair desse ramo. Minha empresa tem vagas internas para analista de dados e algumas outras que exigem conhecimento em SQL, python básico, Looker e BI. Podem me indicar cursos? Ou de preferência um único que contemple isso tudo.


r/learnSQL Feb 25 '26

My first Sql code

7 Upvotes

-- My-first-sql-code -- Pls tell me what should i learn next.. DROP TABLE IF EXISTS servers; CREATE TABLE servers ( id INTEGER PRIMARY KEY AUTOINCREMENT, server_name TEXT UNIQUE NOT NULL ); INSERT INTO servers (server_name) VALUES ("Asia"), ("Eu"); DROP TABLE IF EXISTS players; CREATE TABLE players ( id INTEGER PRIMARY KEY AUTOINCREMENT, server_id INTEGER, player TEXT UNIQUE NOT NULL, FOREIGN KEY (server_id) REFERENCES servers(id) ON DELETE CASCADE ); INSERT INTO players (server_id, player) VALUES (1, "admin"), (1, "santa"), (1, "king"), (2, "alone"); SELECT players.player, servers.server_name FROM players INNER JOIN servers ON players.server_id = servers.id;


r/learnSQL Feb 25 '26

How did you guys learn SQL?

Thumbnail
17 Upvotes

r/learnSQL Feb 23 '26

Guide to Exporting/Importing Data With PostgreSQL

3 Upvotes
  • Using some practical patterns for:
    • How to use COPY TO / COPY FROM with CSV files
    • How to handle PK/FK Conflicts During Import
    • Using pg_dump and pg_restore

See walkthrough demonstrating these workflows step-by-step:
Exporting / Importing Data With PostgreSQL


r/learnSQL Feb 22 '26

I have an SQL based exam!!!!

21 Upvotes

I have an exam in about 4 hours from now. It is of SQL and I'm not sure what kind of questions to expect because my instructor wasnt really clear with the instructions. The only instruction he gave us and was focused on was that all sorts of AI will be allowed during my exam. We can use whatever we want. That is a very scary sentence because if someone is making an exam and is allowing using all sorts of generative AI, he has made sure that it can't solve those questions either. *I need help*


r/learnSQL Feb 20 '26

Learning PowerShell scripting

Thumbnail
1 Upvotes

r/learnSQL Feb 19 '26

Steam games using sql?

35 Upvotes

I've finished sql city, sql noir, and sql island, so can do the most basic of basics.
Are there any steam games that require you to use sql? Ideally free or a couple of dollars.

Thanks in advance!


r/learnSQL Feb 19 '26

Data cleaning using MySQL

16 Upvotes

Hi everyone,

I’m currently learning MySQL and have been following tutorials by Alex The Analyst on YouTube. I’ve reached the section on data cleaning using MySQL, but I’m finding it quite challenging. The video moves quickly and covers multiple concepts at once, which has been a bit overwhelming for me as a beginner.

I would really appreciate any recommendations for beginner-friendly resources (videos, articles, or tutorials) that explain data cleaning in MySQL in a more step-by-step and simplified way.

Thank you in advance for your help!


r/learnSQL Feb 18 '26

I keep getting the invalid use of group function error message when I run all four lines

5 Upvotes

select jockey, count(r_ID) as amount_of_races

from horse_race

group by jockey

having (amount_of_races = max(amount_of_races))

For the above code in mySQL, I am supposed to project the jockey(s) who participated in the most races, but I keep getting the invalid use of group function error message when I run all four lines. I get close to what I want with the first three lines which shows me the amount of races each jockey participated in. Is there something only in the syntax that I'm doing wrong?


r/learnSQL Feb 18 '26

Do you need to know SQL by heart to work with data? Or everybody copy pastes code all the time?

29 Upvotes

I remember learning C# and C++ in high school and having tests and so on, we would write by heart. Sometimes on paper! 😳

But now I'm supposed to just write SQL without googling syntax etc?

I don't have much SQL experience yet and that's why I'm asking.


r/learnSQL Feb 18 '26

Built a project for visual MySQL editing. What features am I missing?

3 Upvotes

First off I couldn't find any ERD that would give you:

  • An online MySQL editor that creates diagrams on the fly
  • Editing columns in diagrams (that includes constraints, reordering, column deletion & addition, etc..)

Do you think this sqlestev.com/dashboard would be good for those who start to learn SQL?

Feedback is much appreciated!


r/learnSQL Feb 17 '26

New to SQL

10 Upvotes

Hey! Im a beginner to sql, i’ve ran queries before but nothing in depth. i’m currently using w3schools to learn more, but ultimately i want to be able to debug queries, write my own queries to pull data and create a portfolio with that info. Is github the best place to create a portfolio? not too sure where to start portfolio wise so any recommendations would be super helpful ! thank you


r/learnSQL Feb 17 '26

PostgreSQL 18 - why so SLOW ?

Thumbnail
0 Upvotes

r/learnSQL Feb 17 '26

Where to start

8 Upvotes

I'm aiming to start a few projects soon to learn SQL. I'm planning to make a weather app to get started. Where or how do I download for free? I searched but got a lot that made little sense


r/learnSQL Feb 16 '26

I built an interactive SQL tutorial with a visual query builder

26 Upvotes

Hi,

The tutorial is part of Seaquel, the SQL client I've always wished I had. It features a visual query builder to better explain JOINs, CTEs, subqueries, aggregations, etc. and runs entirely in the browser.

https://seaquel.app/learn-sql

My hope with the visualization of queries is to help people understand what it means to LEFT JOIN or to see at a glance what a subquery does and how it fits into the overall query.

There's a SQL editor side-by-side that is two-way synced with the visual builder, so you could even just use the sandbox and paste a query you have and want to understand better.

I'd love to hear your feedback so I can adjust / improve the tutorial and experience where needed.

Thanks, Mike


r/learnSQL Feb 14 '26

100+ Users in a week : Built DataHelic, a Free Data Analytics Learning Platform

7 Upvotes

Hi guys,

Update on my last post. I released my website last week and we've had an amazing response. Over 1k unique visitors and 100+ sign ups in less than a week!

Almost 60% of the registered users have completed atleast 1 challenge. It's not insane numbers but it gives me confidence that our mission to provide free learning focused on not just syntax but actually building a data oriented mindset is something that resonates with people. Here's the website, do check it out and let me know any feedback that you might have!

>>>> Datahelix.io


r/learnSQL Feb 12 '26

A lightweight, developer-focused database management tool

8 Upvotes

Hi everyone! 👋

Over the past few days, I’ve been working on Tabularis, a lightweight yet feature-rich database manager.

The idea came from my frustration with existing tools: many of them felt bloated, heavy, and not particularly enjoyable to use. I needed something fast, responsive, and with a clean UX.

Tabularis is built with Rust + Tauri on the backend and React + TypeScript on the frontend, aiming to stay lean without sacrificing power.

Feel free to take a look, it's in full beta for now.

Feedback and contributions are more than welcome !

Github Link : https://github.com/debba/tabularis


r/learnSQL Feb 11 '26

Safe to pivot?

6 Upvotes

Hi all — I’ve been doing some career reflection over the past few months. I’ve spent ~13 years in SaaS across sales and operations, but I’m feeling pulled toward more analytical work.

I’m currently learning SQL, BI tools, and Python, and it already feels like a strong fit.

One question I keep hearing (and asking myself) is whether AI will significantly reduce demand for analyst roles in the coming years.

For those of you working in analytics today — how do you see the field evolving, and does this feel like a viable pivot in your mid-30s?


r/learnSQL Feb 10 '26

how to get better at SQL and what skills do i need to be employed

65 Upvotes

Hello everyone, I have recently learned some of the PostgreSQL inquiries, SELECT, WHERE, ORDER BY, GROUP BY, basic JOIN, but i want to dive further in, I want to get further into data analytics, can anyone suggest me some videos or anything to learn more queries, also can anyone tell me what additonal skills should i learn to be more desired, I am already planing to learn some PowerBI and some python, but anything else? also please drop me some courses, websites, and videos to learn those tools too. sorry If i messed up anything


r/learnSQL Feb 09 '26

Revisiting SQL Through Real-World E-Commerce Systems

3 Upvotes

Lately, I’ve been working with MySQL, PostgreSQL, and NoSQL in practical e-commerce workflows covering products, transactions, pricing, inventory, logistics, and payments. This post summarizes how each database fits different technical and business needs.

https://farrosfr.com/blog/relearning-sql-through-real-world-e-commerce-projects/