[DATABASE]Difference between inner join, right and left outer join

Creating the tables
Screenshot 2018-11-27 at 8.06.37 PM
Screenshot 2018-11-27 at 8.21.57 PM

Data from T1
Screenshot 2018-11-27 at 8.43.29 PM

Data from T2
Screenshot 2018-11-27 at 8.44.09 PM

Left outer join
In the below example left table is T1 and right table is T2.
Left outer join will cause tuples of the left table (T1) to be preserved, the right table (T2) will display values that match the TID of the left, if there is no values matching the TID on the left NULL will be displayed.
Screenshot 2018-11-27 at 9.14.07 PM

Right outer join
In the below example right table is T2 and left table is T1. Right outer join will cause tuples of right table to be preserved and left table to display matching values, non-matching values will be NULL.
Screenshot 2018-11-27 at 9.16.20 PM.png

Inner join
Both tables T1 and T2 will display values that both commonly have.
Screenshot 2018-11-27 at 9.19.54 PM.png

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s