Sharing buttons:

hello everyone in this video we are

going to understand or how we can join

three or more tables okay so before

starting with the queries let's

understand the basic structure of the

three tables okay so I have three tables

one is employees are there is details

for this department so an employee's

table we have employee ID and employee

me ID and a name ER is a primary key and

then there is another table details

which has the foreign key ID okay so

this idea basically is linked to this

table okay so this is a foreign key then

D ID which is a foreign key where the ID

is also foreign key and salary salary

okay so this is the details table and

then there is one department table which

gives the details for the department so

as this will the foreign key D ID is a

primary key in this table so di D D name

and man basically Department ID

Department name and manager of the

department okay so these are the three

tables and we are going to see two ways

how we can join join the or attributes

like he named all three manage all of

these these attributes all of these

together in one way how we can join

these three tables so there are two ways

so let's see the first way which is by

using joints so in this we will simply

select whatever we want to print so

select a name D name man sad manager and

Saturday okay then we write from

employees E so we'll give analyze to

this table employees E okay employees e

inner join details D so we are joining

these two tables and we are giving

allies E and D to these two tables and

when we write inner join we also have to

write on on what common attribute okay

so on a dot e ID is equal to d dot e ID

so first we are joining these two tables

then again we are writing

no join department thought table and

we're giving analyze to it so your I've

given analyze DP okay and on um so you

are we had your we are joining this in

the stable so DP dot di D is equal to d

dot di D so basically these two tables

so this is how we join three tables okay

so basically first we'll join these two

tables on the common heart attribute e

underscore ID and then we will join

these two tables on the common attribute

they underscore ID okay so this is how

the three tables are going to be joined

okay the second way is by using

parent-child relationship this is very

simple all you have to do is select

whatever you want to print okay

so en disco named Janos Connie mance and

everything selected from employees e

given a live stream price employee

details D Department deeply okay allies

we're simply that erode a ID is equal to

D dot yeah it's the same thing a dot AI

d is equal to d dot e ID so these two

tables will be joined okay and D dot d

ID is equal to DP by D so these two

tables will be drawn so basically select

whatever you want to print from the

tables we're simply simply a foreign key

of a table is equal to the primary key

of the other table that is how both the

that is how all the three tables are

going to be joined okay so these are the

two ways in which we can join three

tables one is by using visuals are there

is missing parent-child relationship I

hope it is clear if this video helped

you in any way do consider subscribing

to the channel thank you