most intriguing was the use of WHERE clause to write a JOIN, and most of the useful was the LEFT vs RIGHT (that are the same but with different positions of the tables related). Thanks.
Damn im learning selftaught full stack development and already learned MERN stack but felt the need to learn SQL, and im loving it, this channel is so crystal clear with all the topics that i encounter when practicing with my project and want to learn. A great thing about SQL is that is an ancient concept and will prevail even longer so all this information will be valuable for years to come :)
You advised against using the USE keyword because it might break your query if your field name changes. Wont this still be the case if you use the ON keyword to specify field names?
Good question! Yes, if the actual field being joined on is changed in either table (such as renamed from id to person_id), then the join will break whether you have USING or ON keyords. If the field names are different, then USING won't work. It would have to be changed to an ON keyword.
What about these tables breaks referential integrity rules? In general, you can still join tables if they break rules like that, as long as the data being joined is the same (e.g. both IDs or names or values represent the same thing)
Yes, that's right, you can. If you leave the foreign key empty the row will still be inserted. You could put a Not Null constraint on it to prevent that though.
Yeah, you can. You would usually join between PK and FK, but you don't need to have those constraints to make the join work. If both columns represent the same thing then you can join. You can actually join on two columns that have two different sets of data, but your results will not be meaningul.
Want to easily remember the SQL commands for your database? Get my free SQL Cheat Sheets here: databasestar.mykajabi.com/lpkj-sql-cheat-sheets/?
I just love the way you break down the hardest topics & concepts so clear , easy to understand with simple examples . Thank you so much. ❤❤❤❤
Thanks! I’m glad you enjoyed the video and we’re able to understand the concepts from it.
most intriguing was the use of WHERE clause to write a JOIN, and most of the useful was the LEFT vs RIGHT (that are the same but with different positions of the tables related). Thanks.
Glad you found the video useful!
Extra thanks for the subtitles! Even if I don't have a listening issue, they help understanding better
Thanks! Glad to hear they are helpful for you.
Damn im learning selftaught full stack development and already learned MERN stack but felt the need to learn SQL, and im loving it, this channel is so crystal clear with all the topics that i encounter when practicing with my project and want to learn. A great thing about SQL is that is an ancient concept and will prevail even longer so all this information will be valuable for years to come :)
Thanks for the kind words, and I'm glad to hear my videos are helpful. Yeah, SQL has been around for a while and the fundamentals don't change.
Clear and to the point
Thanks!
This video was so helpful. Thank you!
Glad it was helpful!
thankyou for visualizing this
You're welcome
Thanks keep making content like this
Will do! Glad you like it.
You advised against using the USE keyword because it might break your query if your field name changes. Wont this still be the case if you use the ON keyword to specify field names?
Good question! Yes, if the actual field being joined on is changed in either table (such as renamed from id to person_id), then the join will break whether you have USING or ON keyords.
If the field names are different, then USING won't work. It would have to be changed to an ON keyword.
can we do joins without foreignkey?
Yes, you can. As long as the fields in both tables represent the same thing, you can do a join and there does not have to be a foreign key created.
Thank you
sorry I didn't find a link of the video that contains join three tables or more
No problem, the link is here: ruclips.net/video/TGt2xa7EzvI/видео.html
powerful insights
Thanks!
So correct me if I'm wrong these two tables break referential integrity rules, but joins still possible?
What about these tables breaks referential integrity rules? In general, you can still join tables if they break rules like that, as long as the data being joined is the same (e.g. both IDs or names or values represent the same thing)
@@DatabaseStar So I can create a record in a child table not related to to a parent table record.
Yes, that's right, you can. If you leave the foreign key empty the row will still be inserted. You could put a Not Null constraint on it to prevent that though.
helpful, keep it up
Thanks, will do!
can we really join without foreign key -- primary key relation?
Yeah, you can. You would usually join between PK and FK, but you don't need to have those constraints to make the join work. If both columns represent the same thing then you can join.
You can actually join on two columns that have two different sets of data, but your results will not be meaningul.
Thank you.
You're welcome!
Thanks!
No problem!
super awesome
Thanks!