T-SQL: How To Write A RIGHT JOIN and Why You Should Be Aware of Them

  • Note the tables that we’re using and what values are identical based on the column names and what values differ based on the column names. We’ll be using these tables throughout these videos. As a note on aliasing tables — the first table always gets a “t1” while the second table always gets a “t2” and so on and so forth (the 5th table would get a “t5”). Finally, consider that some SQL languages may not support the JOINs that we discuss.
  • How do the results of the RIGHT JOIN differ from what we learned previously with the results of the LEFT JOIN?
  • Consider that using LEFT and RIGHT joins together may create confusion when developers try to conceptualize what the query is running. While it’s useful to know how to write a RIGHT JOIN, I would advise to using a standard with JOIN types like these (almost always LEFT) so that developers can easily understand what’s being queried. Combining types will create confusion. This being said, it’s important to know how to write these, as consultants will often run into these in environments that may not have standard practices — which are popular environments for consultants. Often these RIGHT JOINs indicate that there’s a lack of standards, which is contributing to the problems.
  • If we were consultants debugging code and we came across this being used, how would we write the queries with LEFT JOINs instead?

--

--

--

Data | Development | Security.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

PyTorch Distributed Data Parallel Training

Always Strive to Be Mentoring and Mentored

Top Things an Interviewer Looks For During a Job Interview.

How to Build a Chess Board With JavaScript

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
SQLInSix Minutes

SQLInSix Minutes

Data | Development | Security.

More from Medium

SQL or NoSQL ?

What is SQL?

ER Diagram to Create Database Schema Made Simple: What You Need to Know

Static VS Dynamic SQL

SQL