Time
7 hours 36 minutes
Difficulty
Beginner
CEU/CPE
3

Video Transcription

00:00
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.
00:08
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.
00:24
So it's not going to be useful in some databases where the
00:29
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.
00:44
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.
00:55
So let's go ahead and get started. So we're going to select.
00:59
I don't know what I want. Yes, someone to say from
01:02
employees.
01:03
I'm going to give it an alias of empty again.
01:07
There's no comma here, and I'm going to.
01:11
I used the key word join
01:14
titles
01:17
using
01:19
hemp
01:21
underscore number. Now this would be the same thing is if we did the regular way, which was a comma
01:30
titles,
01:33
Um,
01:34
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,
01:53
so you won't always be able to apply this.
01:56
So let's go ahead and
01:59
get back. The Fields were interested in so am dot first name
02:04
and titles
02:07
dot title and let's bring back the dates, too,
02:12
that from date and the titles, not two dates, and let's go ahead and run this issue. This works for us,
02:22
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.
02:34
Uh uh,
02:37
number comma.
02:38
Bring that back correct. So we can see that Ah, employees
02:46
1007 or 10,007
02:50
was a staff
02:52
have the title of staff from 89 to 96 from 96 2
02:58
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.
03:16
You do see that from time to time. And that's what I would interpret this to mean. Is that
03:22
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.
03:31
And that's just how it works sometimes.
03:34
So that was the joint keyword.
03:37
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.

Up Next

Introduction to SQL

This introductory SQL training teaches SQL core concepts that can be applied in professional environments. Once students complete this course, they will be able to query and interact with an SQL database, and know how to design database schemas.

Instructed By

Instructor Profile Image
Kitt Parker
Instructor