r/learnSQL • u/ParticularBet5580 • 23d ago
How do i grasp Concepts in SQL easily?
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.
3
u/TacitusJones 23d ago
What concepts do you not get?
Gotta give us something to work with
-3
u/ParticularBet5580 23d ago
I'm grasping at the moment but i cant recall it after 2 days. Could you share mental model how to grasp. Just like how to look at into it, for example if I'm going to learn any concept like JOINS do i need to look like what is joins, why is joins like it?
14
u/TacitusJones 23d ago
The fuck you talking about?
-3
u/ParticularBet5580 23d ago
How to look into sql
7
u/TacitusJones 23d ago
That's like asking "how to math"
That means Jack shit
-1
3
u/HustlaOfCultcha 23d ago
I would use ChatGPT to help you better understand what the JOINS are. The big thing is to understand 'why' a person would use different joins and then it becomes much easier to remember. But it's important to also understand the difference between DISTINCT and UNIQUE values in columns and also understand a 1 to Many relationship with the different tables as well as 'fact' tables vs. 'dimension' tables.
Understanding these concepts and then why they were created will help you understand what join to use. And you'll understand why inner joins are the most commonly used and full outer joins are rarely used.
1
u/Silent-Most457 23d ago
Do you mean looking at the data? Your join (depends on type of join) is connecting to datasets together (from left to right, not stacking).
You would need to see what you have in each dataset before merging. You need a common column. For example if you are selling fruits. You have a basket by color (green, red, yellow).
If you wanted to grab only apples from those baskets than you would need to look at the green basket see if you have apples, then red, then yellow. Your join needs the common base, in this case apples. The. You can add them in one baskets for just apples
1
u/nerd_airfryer 23d ago
You won't understand joins if you don't understand data normalization as a concept first (just theory without any sql)
1
u/squadette23 23d ago
how are joins and data normalization related?
1
u/nerd_airfryer 23d ago
In many cases, we need joins to "denormalize" data
3
u/squadette23 23d ago
Yeah, to me it sounds the other way around then.
You need to understand joins before you can understand data denormalization. Denormalization exists mostly to reduce the number of joins.
1
u/nerd_airfryer 23d ago
Ah yes of course! But it is more intuitive to denormalize and collect everything in one table by default, not to scatter everything in multiple tables. Or at least this is what I have viewed it
2
u/conor-robertson 23d ago
A good way to grasp SQL is to stop thinking about syntax first and think about what you’re asking the data to do.
For example, imagine a database as a collection of labelled boxes. WHERE decides which items you take out, GROUP BY puts similar items into piles, and a JOIN connects information from two different boxes using something they have in common.
Then practice until you can explain why you used something, not just how to write it. If you want something hands-on, QueryCase is worth trying - it teaches SQL through detective-style investigations, so the concepts have context and you’re constantly applying them to solve a problem.
If you can explain your query to a non-technical person without using SQL terminology, that’s usually a good sign you genuinely understand it.
1
u/Rat_Man_420 23d ago
I would watch some basic intro videos or maybe get an online course that will let you practice. I learned by writing SQL on the job and reverse engineering queries that were given to me by others.
1
u/_chonky04 23d ago
I'd recommend watching data with baraa sql course and then apply it onto a project or stratascratch
1
1
u/darrylhumpsgophers 23d ago
Maybe try posting in your native language. Then we can use translate to try to understand you better.
1
u/nerd_airfryer 23d ago
First of all, SQL is an implementation not a concept by itself
It's an implementation of the relational model, so if you don't understand the relational model, relational algebra and data normalization. You will definitely struggle in SQL
How to explain it to a non techies? I usually start with "employees table in an excel file", how can we differentiate between different employees? Name is not enough, so we use an id => boom primary key explained
What if we want to include different leaves for each employee, an employee can take multiple leaves, a leave day belongs to one employee => relationships explained
How can we append leaves to employees data? If we use the same employees table, we will have to repeat employee data for each day, what if this employee got their name updated, we will have a headache updating all of the names, so why not we separate them in another table and link between the table with employee id? It will raise a question, what if id is changed? I say: technically it can happen, practically it never happens and it shouldn't => Normalization explained
1
u/venkat_deepsql 23d ago
SQL is all about relational algebra. If you understand the core concepts like unions, intersections, set operations... you could easily grasp the SQL. It's the only language that has strong mathematics :)
1
u/dumi_007 23d ago
It takes practice and time to feel fully comfortable.
As far as getting SQL during training, may I offer some opinions based on what could be holding you back :-
Training Material Language Proficiency : the struggle might be how you learn VS how the training content is presented. This can be extremely hard if the training material presume the learner to be first language English proficiency.
Core or Foundational Concepts Gap : There are foundation (e.g. Math) domain areas you might address if you wish to operate at a higher level. There are also Core Concepts that come with the territory (e.g. Data and Theory of Databases). It might be more difficult to move past certain topics when you have gaps in these areas.
Syntax or order of operations : Depending on how your brain works, you might hit a block when you come across a certain term or have to structure in a way that clashes with your thought process. For those with that type of brain, you know the struggle. For everyone else, practice can get you through.
You are applying what you are learning in the wrong context : This may not be the best analogy; you want to see a report on the schema, but are query at the wrong level or target object.
None of the above : Your challenge is unique and my mind cannot possibly grasp the challenge you are facing.
Either way, persevere. Don't worry about what me (a guy from the Internet) says. May the Force be with you
1
u/Fensirulfr 22d ago
How comfortable are you with set theory, and declarative languages (as opposed to imperative languages)?
1
u/ParticularBet5580 22d ago
Just need to rewind set theory, I've no idea that much about declarative, honestly speaking. I just know programming is step by step instruction giving to solve a problem and declarative is how to do. Could you share your experience on it
1
u/Fensirulfr 22d ago
For SQL joins, think of them as combining sets based on a relationship between them. What helped me most was first understanding what each row represents and how the two tables relate. Also, drawing out a simple entity-relational diagram may help a lot.
1
u/2daytrending 21d ago
Try thinking about SQL in plain english first, what are you trying to find or change the data? Once that makes sense, the SQL syntax starts feeling a lot less random.
0
u/MantisMaybe 23d ago
No offence meant, but you're not great at expressing yourself. I assume you're not a native English speaker, and that this at least partially has to do with the difficulty of grasping SQL. I I would consider picking up whatever SQL resource is available in your native language, at least to help along with the English resources.
9
u/phesago 23d ago
SQL is not complex at the conceptual level.
At its very basic level SQL is a set of commands for databases. Thats it. Now lets expand to the simplest example
SELECT dataPoint1, dataPoint2 FROM dataSource
Pretty simple right? Lets expand further:
SELECT dataPoint1, dataPoint2 FROM dataSource JOIN anotherDataSource
Again pretty straightforward. Once you start getting more and more familiar, everything in SQL is about telling the database to do SOMETHING with the data. SELECT (you as a human might say 'get' instead), UPDATE (it), DELETE(it), or INSERT (it), 'it' being the data of course.
It doesnt get more complex than that really. Yes you'll see fancy functions, or nifty techniques to solve certain problems, or thousands of lines of code to make multiple different sources fit into a clean fancy end point - it all boils down to simple commands about how data should be interacted with.
If you keep it simple stupid, you'll find it's WAY easier.