7 hours 36 minutes
I welcome back to module to databases. We're currently in less than four sequel joints, and we're moving into Sub Lesson 4.6.
Applying the using statement in inner joins the using keyword is a way for you to simplify your inner joints. It, however, requires that the column name that you are joining on is the same in both tables.
So it's not going to be useful in some databases where the
key names change from table to table. Because this key, this key word of using, requires that the column name that you're joining it joining on be the same. So let's take a look at how we would apply this.
So we're going to join the Employees table to the titles table to return a data set that contains employees with the title that they have.
So let's go ahead and get started. So we're going to select.
I don't know what I want. Yes, someone to say from
I'm going to give it an alias of empty again.
There's no comma here, and I'm going to.
I used the key word join
underscore number. Now this would be the same thing is if we did the regular way, which was a comma
and then with aware statement. So it's simplified the expression of it by making it so that we don't have to put his much text in there to define what we are looking for. But however, it does require that both tables have the same column name for the key field that you're using, and that's not always true,
so you won't always be able to apply this.
So let's go ahead and
get back. The Fields were interested in so am dot first name
dot title and let's bring back the dates, too,
that from date and the titles, not two dates, and let's go ahead and run this issue. This works for us,
and sure enough, it did. Let's bring back the employee number the sea. Make sure that we're not dealing with somebody who has the same first name.
Bring that back correct. So we can see that Ah, employees
1007 or 10,007
was a staff
have the title of staff from 89 to 96 from 96 2
the indefinite future Who was senior staff? Some applications will do this. You may see this is that when they have to include an end date and there's no foreseeable end date, they will default to a, uh, future end date That's way beyond the scope of the application.
You do see that from time to time. And that's what I would interpret this to mean. Is that
right now this employee is titled Senior Staff. There's no change planned. So the future and date is currently way, way in the future.
And that's just how it works sometimes.
So that was the joint keyword.
I hope you got it working on dhe. I hope that you are able to see how it can simplify some of the inner joins for you. And that completes this lesson. I will see you in the next lesson. Thank you.