/r/learnSQL
Adventures in the most popular database language
Sequel
/r/learnSQL
Hi, I’m an MSc student learning data analytics. I’ve started with SQL and Excel and want to improve my skills
I have been preparing for tech interviews using this cheat sheet PDF I found on DataLemur.com / LinkedIn from Nick Singh. However, I would like to be able to print it out and have it be readable but the font is too small and the way it is formatted doesn't lend itself to easy manipulations with text sizes. Does anyone know how to make this each half of this 1 page cheat sheet into its own page?
SELECT w1.id as id
FROM Weather as w1
WHERE w1.id IN
(SELECT w2.id FROM Weather as w2
WHERE DATEDIFF(w1.recordDate, w2.recordDate) = 1
AND w2.temperature > w1.temperature);
Input
Weather =| id | recordDate | temperature |
| -- | ---------- | ----------- |
| 1 | 2015-01-01 | 10 |
| 2 | 2015-01-02 | 25 |
| 3 | 2015-01-03 | 20 |
| 4 | 2015-01-04 | 30 |
Output
| id |
| -- |
| -- |
Expected
| Id |
| 2 |
| 4 |
I don’t know about you, but I’ve wasted so much time trying to find SQL resources that are actually useful. You search for something simple, and suddenly you’re neck-deep in outdated tutorials, half-baked blog posts, or YouTube videos that take 10 minutes to get to the point.
So, I decided to do something about it. I spent some time collecting the good stuff—articles, cheat sheets, tools, and YouTube channels—and threw it all into one GitHub repo. It’s basically a "SQL survival kit" for 2025.
Here’s what I put in there:
This list is for anyone working with SQL, whether you’re just starting or already knee-deep in data.
It’s all here: Awesome SQL Resources for 2025.
Let me know if this is helpful.
SQL gawds, I humbly request your guidance, on beginning the journey. I am trying to learn SQL and would appreciate your suggestions on resources that cover:
Any and all assistance is much appreciated. I need to learn it as part of just about anything I want to do in data.
is there any assistants (ai or some website) where i can copy my tables into and they help me write queries for it? im really in the begining of learning sql so this would be helpful. Or any tipps with mysql in xampp?
Hello, I just finished the SQL for Data Science Course by UC Davis in Coursera.
It seemed like an elementary course, which was great since I had 0 experience in SQL.
However, now I am wondering how I should continue learning SQL? Should I practice it? How?
Thank you very much
Let me know what you guys think. I’m a SWL developer and stock trader at heart.
Quick sanity check needed regarding a Data Science exam question I'm disputing.
Question asked: "The SQL keyword for filtering after grouping is (i), and the SQL keyword for querying is (ii)."
I put SELECT for (ii) but was marked wrong. Prof says WHERE is correct because "SELECT is for specifying a subset of columns; querying is the act of specifying a subset of rows."
However, PostgreSQL's documentation literally states: "The process of retrieving or the command to retrieve data from a database is called a query. In SQL the SELECT command is used to specify queries."
When I disputed it, prof mentioned it was meant to parallel Pandas concepts from lecture, but the question itself made no mention of Pandas or specifically asking about row filtering.
I get that WHERE filters rows. But if you're asked "what's the SQL keyword for querying" with no other context, isn't SELECT a valid answer? The question doesn't specify row filtering anywhere.
I'm 1.3 points from an A in the course, so this isn't just me being pedantic. Would love to hear what other DS folks think.
Additional context: This was in an intro DS course where we covered both Pandas and SQL.
Hi there,
I'm a co-founder for Uphop.ai and we are building a new way of learning SQL and other skills through AI. A major challenge with online learning today is that you can't get real-time support when you have questions or want to go deeper on a concept being discussed. It's also hard to keep engaged with hours and hours of passive recorded videos. We believe AI can help make learning fun and engaging.
We've built a set of AI instructor-led lessons on SQL and you can try it out here for free. Appreciate any feedback or inputs and thanks for your support! 🙏
A good friend of my is currently building a SQL course. He shared this image with me from an article he is writing about SQL order of operations. I found it very helpful to distinguish between the written order and the query process order in SQL.
Hi everyone! If you've just started with SQL and want to solidify your basics using a fun and interesting database, I’ve got the perfect resource for you.
I’ve created a video featuring 30 practical and engaging tasks to help you build confidence with SELECT statements. By the end, you’ll feel ready to tackle more advanced SQL concepts.
The database is currently available for SQL Server users, but I plan to release a PostgreSQL version if there’s enough demand.
To be able to receive the database file, simply fill out the form linked in the video description. If you'd like additional advanced puzzles on the same database, check the relevant box while filling out the form.
Enjoy, and feel free to share your progress or feedback!
If you’re learning SQL or just need a quick refresher sometimes, you’ve gotta check out this Free SQL Cheat Sheet. It’s clean, super easy to follow, and has all the basics—SELECT
, JOIN
, GROUP BY
, all that stuff—without any unnecessary fluff.
Here’s the link: SQL Basics Cheat Sheet
We made this because, honestly, who remembers everything off the top of their head? Bookmark it, pin it, whatever—trust me, it’s worth it.
Do you use any cheat sheets or tricks for SQL? Always looking for new ways to make life easier.
I would like to learn SQL as I work in customer data management. Can anyone recommend PDFs, Apps, Websites or books for learning SQL? If possible in German. Learnsql.de is unfortunately not for free.
I am a n00b at this...anything wrong with my syntax that would cause this to order by two separate times? MJ should be at the top with the last name in the list being Kevin Salvadori.
You guys really liked my last post about creating a custom Spotify Wrapped with SQL, so I thought—why stop there? This time, let’s tackle Netflix!
Ever wonder how much time you really spent bingeing your favorite shows? Or which series kept you glued to the screen the most? Netflix doesn’t give you a Wrapped like Spotify, but the good news is—you can make your own!
Step 1: Download your Netflix watch history (it’s super easy).
Step 2: Use SQL to analyze it.
Step 3: Discover your top shows, total hours watched, and other fun stats.
Here’s an example query to find your top 5 most-watched titles by viewing time:
SELECT title, COUNT(*) AS totalViews
FROM viewing_activity
GROUP BY title
ORDER BY totalViews DESC
LIMIT 5;
Check out the full step-by-step guide here: https://learnsql.com/blog/netflix-wrapped-with-sql/.
It’s a fun project to practice SQL while turning your watch history into insights.
What’s your real most-watched show? Share your results! 🎬
I am beginner to intermediate level software engineer with day to day work on sql server along with .net ,
Can someone please suggest me book for sql server to make my skills to next level , I like to read tech books cover to cover
You know how Spotify Wrapped drops every year, and everyone posts their top tracks, artists, and listening stats? It’s fun, but let’s be honest—sometimes you want more than just what Spotify decides to show you. Like, how much of your life did you waste listening to that one guilty-pleasure song? Or who really was your top artist if Spotify didn’t sneak in podcasts?
If you’ve ever wanted to nerd out with your own music data, I’ve got something cool for you: build your own Spotify Wrapped using SQL. It's not as complicated as it sounds. You’ll get full control over the insights, bragging rights, and a legit reason to practice SQL while making charts for fun.
For example This query sums up the time you spent on each track and sorts them in descending order.
SELECT trackName, artistName, SUM(msPlayed) / 60000 AS totalMinutes
FROM streaming_history
GROUP BY trackName, artistName
ORDER BY totalMinutes DESC
LIMIT 5;
Check out the full guide—from downloading your data to visualizing it: https://learnsql.com/blog/spotify-wrapped-with-sql/
I’d love to see your results—share them here!
import mysql.connector as sql
ModuleNotFoundError: No module named 'mysql'
...and leave a review please
https://www.udemy.com/course/hands-on-sql-for-data-analysts/?couponCode=DEC2024FREECODE
Need recommendations for online data engineering courses which will have a real life project.
Please help
Hi there,
I need steps on how to install sql for my macbook version, it's macos bigsur 11.6 apple chip. I tried but the myself website only works for newer versions of macbook.
Thanks!
Hey everyone, I'm working on a query for work and I've found the solution to my issue, but I can't at all understand the reasoning for it. If anyone could help me understand what's happening that would be greatly appreciated. Anyway, the problem is that I seem to be losing rows in my original query that I regain in the second query just by including the columns I use in the coalesce function also outside of the function
My original query with the problem:
SELECT Monday, a.id, FORMAT(COALESCE(a.date,b.date),'yyyy-MM') as Month,
FROM a
LEFT JOIN b on b.anotherid = a.anotherid
and then the query that does not have the issue:
SELECT Monday, a.id, FORMAT(COALESCE(a.date,b.date),'yyyy-MM') as Month, a.date, b.date
FROM a
LEFT JOIN b on b.anotherid = a.anotherid
Hello SQL Enthusiasts,
I’ve been working tirelessly on a gamified SQL platform alongside my full-time job, and it’s finally ready to launch! The platform features daily challenges, streaks, and a leaderboard to help you build a 5-minute-a-day habit (Duolingo format) and sharpen your SQL skills.
Your feedback means everything to me. I will keep the current platform free for 3 months for this community as a thank-you. Whether you’re preparing for placements or just love SQL, I’d love for you to try it out and share your thoughts.
Your feedback means the world to me—I’ve poured my heart into this project and truly want to make it better for learners like you. Thank you for your support, and I can’t wait to hear your thoughts! 🙌
Link to the platform - sqlninja.ai
It doesn't work when I type 100 instead of 100.0 may I know why
```
SELECT patient_id, weight, height,
case
when weight / (power(height / 100.0, 2)) >= 30
then 1
else 0
End as isObese
from patients
```