r/AskProgramming • • Jun 13 '26

Databases I need help with SQL

(For context I'm a digital development trainee first year , preparing for this subject exam called manipulating databases)

I'm just completely and utterly frustrated with this language , so the most used command in SQL is SELECT right ? DDL DML that's just 20% of the whole thing , grabbing data from the database and knowing how to structure those queries and understanding the schema is what counts more, cause I have no problem creating tables, adding a new colum populating the tables... Etc but even a baby can learn that crap in a day , what Im struggling with is grabbing data and understanding the relationships between the tables , do you guys have any valuable advice that could help make it click ? Or perhaps some exercises that start from beginner all the way to advanced level select queries with detailed explanations , and thank you very much !!!!

4 Upvotes

26 comments sorted by

View all comments

Show parent comment

2

u/tasstoss Jun 13 '26

We did work with the left/right join in class , I don't remember the exact details but it was to show users who for example didn't create an account , say for example table one is user and table two is login , and the login has a foreign key of the primary key that uniquely identifies each user or person , if you do select user.name,user.userid,login.userid from user inner join login on user.userid = login.userid; this would show only the users that did make an account (I guess I should've named login signedup but whatever) so if we wanted to show everything with the ones that didn't make an account being NULL we would use left join on that first table or maybe right join idk but I sort of understand that one at least , thank you very much for that poster and the explanation

2

u/johnpeters42 Jun 13 '26

There's also full join (basically left and right join at the same time), but 99% of the time I just use regular (inner) joins and left joins

2

u/tasstoss Jun 13 '26

Well I honestly have never heard of that one before 😭, thank god I most likely won't need to use it (it's probably easy to grasp anyway I just am taking very long to understand this entire SQL thing)