Let’s say if we’re trying to combine table and they will be on the basis off condition Then this would return all of those throughs that ever the condition is satisfied or very But there is a match Great So let’s say there are 10 records in table and 15 records and they will be under those 10 and 15 record Let’s say fire gods much on and now on the base of the condition you will only get those fiery cards with satisfy the condition between Table A and table B But this is no less inner joy which only returned the mast records and after inner joy And we have something.
When I was there left join so in left joint we get all off the records from people in respect to off better The condition is satisfied or not right So we get all of the records from people or from the left table and only the match records from they will be or from the right people And when it comes to the right jury it’s exactly opposite off the left joint said right journey begins all off the record from the right table or from people be and only the match records from the left side of the table or that table.
Now going and we have something that stuff full out join So full outer join would give you all of the records from a Billy as the last all of the records from the B and then finally happy self join over here to set join is used to Joyner Bebe alluded itself So now the question arises So what you’re here is how can you actually join a table with itself So you just rename the people as something else You have a temporary table so devastated over here you self join is used to join a payment itself as in the table work two tables temporarily the naming at least one people in the sequel statement.
Now let’s see if you have a table called us A What you do is you try to join a with a diesel but there again you rename Yes something else And then we have the last joint which is known as the citation join or the cross join So this cross join returns the carnation product of the sets off records in these stables This would mean that if There are three cards in table and four records and they will be And if you apply the cross join on these two tables.
The filer table would have 12 records right Strictly because three into four will give you the Kardashian for equities 12 And the final result would have 12 records in it Now let’s start off with the 1st 1 which is inner Join The only tool you inner join would give you All of the common records are all of the match records in Table A on Table B and this is the syntax to at light inner joy 92 tables The first we’ll start with the selectee word After giving this Salik keyword we will give in the set off columns which would want to extract.
Let’s say if you want to extract call on one from Table one will first given the name of the people will use the daughter operator and then given the column name Similarly if we want the column to from table to then they’ll give in the name off the table will given the daughter operator and then we’ll give in the name of the column from the stable similarly will give all of the Golan from all the tables between one.
Let’s say if I want column and from Table one I’ll give a table one dot call and so once have listed all of the call if it weren’t from Table One and table to offer that I’ve given the from keyword and give the name off table one order left table and I’ll give in keywords in Earth join and I’ll give the name off the second table or the right table No one’s All of this is done I used the key word on and then give the condition on the basis off which I want to join these two tables So we’re here The condition is stable One dart common feel needs to be equal to table to the common field that does.
They’re never the records in this column off people one as equal to wherever the records off this column in Table two are equal all of to us the card side want to extract So let’s go ahead and apply this concept off in our joint in my sequel So let me go back so initially we had the employees stable when you’re so let me just show you guys that employ stables a select star from employees on this is our employees stable now to apply all the different joints that you have just seen I need one more table So for that I need the department table I’ll go ahead and create a department table for that purpose So I type in Create Dick Clyde mend and inside this I need certain problems.
First let’s say I would need their department idee columns over here I’ll type in department I D And this is often teacher type and Atlanta Stem And then I would need the department called him which is the common Call him over here So I have the department column in the employee stable as well So this would be my common column I said Weir car off when p And then after this I have maybe the department location column on again This would be off typo our car and I’ll said 20 toe this So this is how I am a bit do create the stable corners department So it seems like we haven’t air over here so create on After this I’d have to type in table So this was the era No I have been select star from department Let me get execute and let’s see what we get.
We have successfully created the stable Caldas department Now it’s time took insert while using tow this table So let me go ahead and insert some values So for that I have to use the insert command So I type in in soared into have to give in the name of the table which is department And then I have to say though call them names over here So this would be department idea after department i d I just have department and then I have their department location and I’ll go ahead and set up values So let’s say the first department ideas one on and the department s continent on the country department Let’s say besides in Chicago now let me got this and let me baby sit over here.
Let’s see where is reside So we have successfully created off for his department Now I’ll go ahead and create my second department over here which would be support so department ideas to on name off the Department of Support and let’s say support department as a New Jersey So let me just change this to New Jersey over here This is also set Now I’ll go ahead and create the tour department which would be seals So I lied Sales So were you on day after this let’s say the sales department sets in Boston I lied Boston over here I’ve got this to ready and I’ll go ahead and I more records.
Now let’s say the fourth department of the HR department Andi allowed heads are over here Let’s say also the HR department sets in Chicago And then I had one more department which would be operations So I said the idea to be equal to five on die on operations over here on operations is in New York So let me just add New York or what you and my department table is finally ready Now that I have bought of the stables ready I would want to apply the inner joint on this So I warned since I’m blind in a joint on these two tables I’d want only those records where the department best common in the employee stable and as well as the department table So let me go ahead and write the command Sadat First I have to give in the select keyword.