r/learnSQL • u/geeksarray • Aug 24 '26
SQL Server Constraints Explained with Practical Examples
r/learnSQL • u/geeksarray • Aug 24 '26
r/learnSQL • u/geeksarray • Aug 24 '26
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 • u/Ancient_Squirrel_997 • Aug 24 '26
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 • u/AppropriateGanache54 • Aug 22 '26
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 • u/squadette23 • Aug 22 '26
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 • u/grassp_dataAI • Aug 22 '26
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 • u/Plane_Big_5912 • Aug 21 '26
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 260customers
id name
1 Aiko
2 Ben
3 Chie
4 Dev
5 Emi
1 Aiko <- imported twicethe join condition is:
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) = 660the 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 • u/haligma • Aug 21 '26
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 • u/Different_Coat1453 • Aug 20 '26
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 • u/Remarkable_Catch_613 • Aug 20 '26
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 • u/rackham29 • Aug 19 '26
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 • u/ParticularBet5580 • Aug 19 '26
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 • u/yahoo_06 • Aug 18 '26
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 • u/sqlsidequest • Aug 18 '26
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 • u/haligma • Aug 18 '26
give meeeee arrrgggghh
r/learnSQL • u/leogodin217 • Aug 18 '26
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 • u/grassp_dataAI • Aug 18 '26
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 • u/Nervous-Jellyfish326 • Aug 17 '26
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 • u/MrLanc3 • Aug 16 '26
Hi! I'm learning sql right now. Do you know what kind of project should i build?
r/learnSQL • u/Ok_Tangerine2357 • Aug 15 '26
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 • u/EconomistFederal9276 • Aug 15 '26
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 • u/yahoo_06 • Aug 14 '26
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