I have to start out of the columns retired warned from the employee table So first I used the alias So I’ll type in eat dart on And after this let’s say I would want the first name from the Empire Table I would also need the last name from the employee stable So I add E guard Let me add last name on and apart from this let’s say I warned the department name and the department location columns from the department table.
1So I type in the door The e p T On guy will also need the dart the Bt locations of these are the four columns retired one from both of these stables And after this I have to give in the from keyword and given the name of the four stable which is employees And I said that Elia’s E So this you want to see is basically I went extracting the first name and the last name columns from the employee stable So This is the alias which have given to the imply stable And after this since I’m applying in our joint.
Let me just start in a joint over here and I have to give in the name of the right table which ISS department and I have to give in the alias for department which is B over here right I’m extracting the department name column in the department vacation column from this department table On day after that I’ll finally given the keyboard on and I have to set in The conditions of the condition would be E dart The E V P is equal Do the Gare de the doctor is there department and name column needs to be seem in Both of those statements are in other words wherever these records are common in the department table and the employees stable I would want Alito’s record.
So let me go ahead and execute this and this is our results Now let me just elongate this and this is what we have So it seems that the common departments are support content sales and again we have content of what he also seems like These are the only common departments over here on with respect to this I have extracted Are these people so on Brad Charlie and Nicole So these are the people which are rich basically occur in the same departments Just to be sure I also select star some and then let me give in the department people over here Select star from department Let me on this Right.
As you see we have the content Support these two departments over here Now let me run this and I’ve got content support and seeds Right So these other three departments content supporting sales other three departments which are common in both these tables So we have applied this in a joint Now it’s time to work with the left joints As it s stated over here from the apply left turn we get all the records from the left table and own leader Max because from the right table and wherever there is no match we will put in null values in the right side And this in Texas pretty much the same Plus.
We’ll give in those Stella keyword And after that people stopped the site off columns which we want to extract from table one and table after that Well given the from keyword and give the name off table one and then we’ll type left join and then give enable off table toe off that will type on and then given the condition on the beast soft which will have to join these two tables So this is our example Off left joint over here Let’s say we have this employee stable and this department table over here and I’m applying this left Join and the conditioners wherever.
There department I D S common between these two So we’re here Let’s see I for 10 11 12 by Gore 10 11 13 and 14 Now since this is left joined I’d get all of the records from this left table So doctors like a Su C over here God Hardy Edwin Stephen and Eric All of these are there and from the right side off the table let’s see Very what This is not present So 12 very work 12 hours north present I get no value So though I d s 103 100 so as you see over here 100 entry and 100 So as thes two employees or these two records are not present in the department table I have another value over here And wherever the records are common on this yeah get the records from both the people’s.
Let’s go ahead and apply a similar operation on the employee stable and the department people in my sequel Now off this leader command would be selected and I type in E I warned the first name And after the first name I’d want the salary so selected or force name and I the Lord salary on from the department table I warned the PP which is the department name and I want the department location So I I did our d e be on the score locations This is actually loc Now that I have given the list of all the corals which I want to extract I just have to given the from keyword and I have to give in the name of the force people which is employees and the alias nous e.
Now that this is done I have to give the left join because doctors work I want to apply on these two tables I’ll type left join and I will give in the name of the second table which is department on dial given the alias which is B After that I have to give in the on keyword and I have to set in the conditions of the condition is that ever these columns are equal Other records in the department column are equal so this would be e door E v p is equal to the door d e b T I put a semi colon and let me hit run and this is what we have So 123 and four So these four records which you see So these four records are where the condition is satisfied doctors the department as common and the employees stable as well as the department table Now these records the rest of the records which you see these that bar are the less stable.
But since this department whatever deport department these guys belong to dive department as not president of the department table That is like we have a nun who were here for the last four values so repeated against for the 1st 4 values The condition is satisfied and for the last four values the condition is not satisfied And since this is the left joint that is why we have all of the records in the left table And we have no values from the tri table over here I have that right joint So the join us exactly opposite left joint So when I joined the would have all of the records return from the right table by Leader Max Records in the left table.
This is the same packs argument type select with less down all of the columns from table one and table two from table one joint table two on and then welcome in the condition on the basis off which would have to join these two peoples And over here of course the employee table over your department they below it here And I want to join these two tables on the basis off their the department ideas equal And since this is the right joint I’m getting old that it costs in the right table over here as you see and that ever this is not satisfied directly with the department Ideas not equal there I am getting the values over here So have 11 13 and 14.
As you see 2 13 and 14 is north present over here So this is the resources and shipping So these two records very where are there So for these do I have no values from the left side of the table So while the eaters and let me write the command for this as well So I’ve got the employee stable Andi as well as the department table Really for started after type and select Andi have to list on the set of column.