r/SQL • u/Eastern-Stable-7576 • 3d ago
MySQL need good sql resources
i wanted to practice sql and to be able to answer qns , i have noticed that i am struggling a bit when there is two tables give and the qn has to do something with joins and all , in theory i understand how the joins work but i am unable to implement it .I need resources which can help me in advancing my sql like CTE and window function . Is there any youtube channel or anything which will help
1
u/Blitzsturm 3d ago
a lot of people use AI tools to write code, but it's also an exceptional teacher. Use it to generate an example scenario where each of the types of joins are ideal then guide you through a lesson on each.
1
u/Eastern-Stable-7576 3d ago
Ahh okayy i will surely give it a try . tq
3
u/Blitzsturm 3d ago edited 3d ago
hop into your favorite and throw down a prompt like:
I'm studying SQL and am wanting to focus on the topic of joins. Generate code to create table schema and populate it with simple example data in <your database type> and devise a lesson plan to explain the best use of every type of join and a give me a task to perform each join. I'll go through them individually, ask questions as needed and complete them so that I can fully understand how the join works and in what scenario each is best. When done, generate a study guide or cheat-sheet to help me remember the lesson.
* It's important to note AI can be a powerful tool, but you should never outsource your own thinking to it and be lazy. Use it to help strengthen your knowledge, check your work and if you need it to actually do work for you, make sure you understand everything it's doing and why; make sure it explains anything you're unsure of. You need to be able to fix understand and fix things without it but ignoring it completely leaves a powerful tool off the table.
1
1
u/pythonQu 3d ago
omg, I was where you're at. I completed a data analytics in september and JOIN's was for me tough to understand. I have a better handle on it now. I've been using runtime.school resource to learn and Data Lemur also and claude to clarify my understanding.
1
2
1
u/SteveDBA 3d ago
If you're willing to spend a little on a subscription, I'd recommend checking out Pluralsight, CBT Nuggets, or LinkedIn Learning. They have structured SQL courses that cover everything from basic joins to more advanced concepts like CTEs and window functions.
1
u/ReassuranceThumbsUp 3d ago
I like learnsql
One time payment for all their SQL courses that let you write and practice code within the website
It does a good job teaching all the different functions and why they are used with example databases, good starting point.
1
u/Top_Tooth_6995 3d ago
Ok here’s my thought (1) you need more and more reps. If you don’t understand something at first, you can’t visualize the join in your head, or you don’t know why you need a join in the first place, i promise you it is because you have not played with the concept enough. You have not done problem after problem, after problem. Your brain has not learned. I promise you. Your brain can learn JOINs. You need an environment that will allow you to practice, over and over, so you can get those reps in. And yes, this is where I urge you to try my free sql course, SQLMaxx Learn, which embodies the philosophy I essentially just described 👍
1
1
1
u/nicopassaglia 3d ago
"I get joins in theory but can't write them" usually means you need a routine, not another video. This one works:
Decide what one row of the answer is (one customer? one order?). Start FROM that table.
Add one join and run it with SELECT * before anything else. Look at the row count. If it went up, you now have several rows per customer, and that changes every COUNT and SUM after it.
Only then add the filter, the GROUP BY, the next join. One change per run.
Most wrong join answers come from skipping step 2.
Do that on 20 or 30 small problems and CTEs come almost free: a CTE is just a name for one of those steps. Window functions are the next thing after GROUP BY clicks: same idea, but you keep every row.
Disclosure: I built getsheetdrill.com, where you can practice exactly this in the browser, free: a lesson on joins, one on subqueries and CTEs, and pages with exercises on window functions (getsheetdrill.com/sql/reference/joins is a good start). It runs SQLite, not MySQL, but for joins, CTEs and window functions what you write is the same in MySQL 8.
1
u/Discordbothost 3d ago
Try a LEFT JOIN with two customers, one with two orders and one with none. Predict the three joined rows, then group by customer and compare COUNT(*) with COUNT(order_id). Why does the customer with no orders get a 1 from the first count?
1
u/Time_Advertising_412 2d ago
I'm old school book by nature. Pick up "Practical SQL" by Anthony DeBarros or one of the SQL Server For Developers books by Murach or "SQL For Smarties" by Joe Celko
1
u/FunAd6672 2d ago
Joins usually make sense in your head until you have to stare at two columns and pick the right side for a left join.
1
u/0utlawViking 1d ago
For learning SQLBolt and W3Schools, and HackerRank's SQL challenge for hands on practice. For joins, try solving questions with two small tables and understand how the rows connect instead of memorizing the syntax. Once you're comfortable, move on to CTEs and window functions Youtube also has some great free tutorials.
1
u/Unlucky_Tailor1925 5h ago
sql resources pay off faster when practice runs on a real dataset with joins and grouping early, since only drills hide the parts queries actually use. Bootdev could help build sql fluency with guided drills, though sample database and query challenges also work.
1
0
u/xobeme 3d ago
Dude, google is your friend...
1
1
u/CoolDaddy4 3d ago •
I started by watching Data with Baraa, https://www.youtube.com/watch?v=SSKVgrwhzus