Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
WEBVTT
00:01.300 --> 00:02.410
Body in progress.
00:03.020 --> 00:03.280
Okay.
00:03.730 --> 00:06.220
Can we start in today's session?
00:06.220 --> 00:10.540
We are going to learn about the concept called cardinality.
00:10.540 --> 00:12.250
Are relationships between tables.
00:32.690 --> 00:35.120
Captain and their relationship between tables.
00:38.390 --> 00:39.160
Let us consider.
00:39.170 --> 00:40.460
We have two tables.
00:42.380 --> 00:43.550
Table one and table two.
00:54.670 --> 00:59.260
When it comes to these relationships in SQL, we have three types of relationships.
01:00.630 --> 01:01.680
There are 1 to 1.
01:04.770 --> 01:05.820
One too many.
01:09.630 --> 01:09.840
One.
01:09.840 --> 01:10.560
Many too many.
01:15.690 --> 01:16.140
Many.
01:16.140 --> 01:16.800
Too many.
01:21.330 --> 01:21.660
Minute.
01:21.660 --> 01:27.000
To me, these three are the relationships which we have in SQL.
01:27.260 --> 01:30.030
So when it comes to first thing, 1 to 1 relationship.
01:30.980 --> 01:34.970
One value in table one will be matched with only one value in table.
01:36.880 --> 01:38.680
In both table one and table two.
01:38.680 --> 01:40.150
Only one value should be matched.
01:41.220 --> 01:43.110
More than one value is not the image.
01:48.920 --> 01:52.250
One value in table one should be matched with one value in table two.
01:53.510 --> 01:55.490
Cabinet match with more than one value.
01:57.480 --> 02:00.930
For example, we have two tables called countries table.
02:04.870 --> 02:06.190
And Prime Minister Stephen.
02:14.980 --> 02:18.460
Country stable and prime minister stable in country stable.
02:18.460 --> 02:22.060
You are storing the list of countries with their ID number or something.
02:23.750 --> 02:25.880
The serial number or something you are storing.
02:26.150 --> 02:32.320
List of countries in prime ministers table You are storing list of prime ministers for each country.
02:32.330 --> 02:33.800
How many prime ministers will be there?
02:34.490 --> 02:39.280
One One value in country will be matched with one value in Prime Minister's table.
02:40.980 --> 02:45.420
One value in country stable will be matched with only one value in prime Minister.
02:45.420 --> 02:45.780
Stable.
02:47.570 --> 02:47.710
The.
03:00.520 --> 03:04.570
We will have country names, country ID, any related value.
03:05.380 --> 03:08.680
Primary key and foreign key value like Prime Minister ID.
03:21.000 --> 03:23.940
After that, we have something called one to many relationship.
03:24.150 --> 03:25.530
One to many.
03:27.030 --> 03:31.560
One value in table one will be matched with many values in table.
03:32.860 --> 03:36.820
One value in table one will be matched with many values in table two.
03:37.120 --> 03:38.290
For example.
03:39.410 --> 03:40.910
Department and employees.
03:52.190 --> 03:52.360
No.
03:52.400 --> 03:55.820
For stable, you will have only department name, department, ID and all.
03:57.050 --> 03:59.360
In the second table, you will have employee details.
03:59.810 --> 04:04.310
Under one department, we can have more than one employee in each department.
04:04.310 --> 04:05.750
We can have more than one employee.
04:05.900 --> 04:09.410
One value in department table will be matched with many values in.
04:11.110 --> 04:11.860
Employee status.
04:17.690 --> 04:24.530
When it comes to this 1 to 1 relationship and one to many relationship, these two can be achieved only
04:24.530 --> 04:25.700
with two tables.
04:25.730 --> 04:29.450
If we have table one and table two, we can get these relationships.
04:31.880 --> 04:34.250
For example, let me show you small tables.
05:11.060 --> 05:12.740
We have three countries.
05:13.040 --> 05:14.480
Who is the prime minister of India?
05:16.560 --> 05:17.100
America.
05:31.630 --> 05:32.260
Pakistan.
05:37.280 --> 05:37.580
Google.
05:37.610 --> 05:38.030
Google.
05:45.480 --> 05:45.640
Think.
05:45.670 --> 05:48.030
Got something we can transfer from person.
05:53.590 --> 05:55.560
Okay, here we have countries table.
05:55.570 --> 05:56.800
We will have country ID.
06:00.350 --> 06:01.880
Just one, two, one, three.
06:01.910 --> 06:04.100
For each country after that name.
06:09.710 --> 06:10.790
After that name.
06:11.870 --> 06:13.550
Here you will have Prime Minister.
06:16.750 --> 06:17.290
Name.
06:17.680 --> 06:17.950
Name?
06:21.850 --> 06:23.020
And I'll show you how.
06:23.290 --> 06:24.010
Country aid.
06:26.950 --> 06:28.780
This country is foreign key here.
06:30.030 --> 06:30.600
This country.
06:30.600 --> 06:34.170
ID is primary key here and it is foreign key in prime minister table.
06:35.260 --> 06:39.330
We will have primary stages one, two, three and Countrywide also.
06:39.330 --> 06:39.930
One, two, three.
06:42.230 --> 06:45.890
We will match with these two tables, we will have primary key and foreign key relationship.
06:45.890 --> 06:46.100
Right.
06:46.370 --> 06:50.900
How many values in first table is matching with values in second table?
06:51.410 --> 06:55.250
Only one value in first table is getting matched with one value in second table.
07:00.170 --> 07:04.490
One value in first table is in getting matched with one value in second value.
07:05.600 --> 07:07.250
This is called 1 to 1 relationship.
07:07.430 --> 07:12.690
We will not have more than one value in the second value or more than one matching value in first,
07:12.860 --> 07:13.910
first or second table.
07:14.600 --> 07:17.210
If you have more than one matching value.
07:18.470 --> 07:21.350
In any tables, we will call it as one too many.
07:22.370 --> 07:23.330
One too many.
07:25.320 --> 07:26.070
For example.
07:27.730 --> 07:29.990
But no, nothing like that.
07:30.000 --> 07:33.360
One value in table one will be matched with one value in table.
07:34.790 --> 07:37.400
Yeah, we can have a number of records also.
07:37.610 --> 07:39.380
Even if you have 1000 values.
07:39.680 --> 07:43.400
Only one value in table one will be matched with one value in table.
07:48.830 --> 07:49.370
Let us see.
07:49.370 --> 07:50.540
About one too many.
07:50.580 --> 07:52.010
We thought that department.
07:57.260 --> 07:58.040
UN employees.
08:05.390 --> 08:05.990
Department.
08:08.820 --> 08:09.660
Department name.
08:13.300 --> 08:13.720
Okay.
08:13.870 --> 08:16.540
I have two columns department ID and department name.
08:17.050 --> 08:18.670
I have four departments.
08:21.490 --> 08:22.540
A department.
08:29.790 --> 08:32.310
Mighty operations.
08:35.760 --> 08:36.300
Since.
08:37.740 --> 08:38.220
Like that.
08:38.220 --> 08:39.630
I have some departments.
08:41.070 --> 08:42.240
For each department.
08:42.240 --> 08:43.770
Will there be only one employee?
08:45.090 --> 08:49.050
We will have more than one employee right here in employee table have employee.
08:51.060 --> 08:51.780
Employee name.
08:55.180 --> 08:56.290
And department ID.
08:58.130 --> 09:01.330
And department employee ID employee name and department.
09:25.790 --> 09:26.900
These are the employees.
09:28.450 --> 09:29.850
And that department is.
09:39.920 --> 09:40.340
Yeah.
09:41.180 --> 09:43.220
In our department, there are two people.
09:46.140 --> 09:47.320
Budget Department.
09:47.440 --> 09:48.400
There are two people.
09:48.550 --> 09:53.140
One value in department table is getting matched with multiple values in the employee table.
09:54.580 --> 09:54.720
But.
09:55.730 --> 09:57.080
Based on the department.
09:57.080 --> 09:58.820
ID relate these two tables.
10:00.140 --> 10:01.400
How many people are working in.
10:03.670 --> 10:06.160
So how many people are working in IT department?
10:07.330 --> 10:09.520
How many people are working in operations?
10:11.690 --> 10:11.950
One.
10:11.960 --> 10:14.300
How many people are working in sales department?
10:16.870 --> 10:21.100
One value in table one is getting matched with multiple values in table.
10:23.340 --> 10:27.990
One value in table one is getting matched with multiple values in table.
10:29.640 --> 10:29.820
Huh?
10:30.950 --> 10:34.190
Yeah, we will have relationship with multiple venues.
10:34.640 --> 10:36.560
That's all it is called as one to many.
10:43.070 --> 10:44.240
More than one column is.
10:48.850 --> 10:51.970
Yeah, we will have only one related column between both the tables.
10:52.180 --> 10:53.740
Primary key value and foreign key value.
10:54.130 --> 10:56.520
By using these values, we will relate each other.
10:58.000 --> 11:01.570
Here, if we have one value is matching with multiple values in another table.
11:01.570 --> 11:03.190
It is called one to many relationship.
11:06.900 --> 11:09.420
One value is matching with one value in another table.
11:09.430 --> 11:10.320
It is called 1 to 1.
11:11.700 --> 11:13.290
If it is matching with multiple values.
11:13.290 --> 11:15.060
It is called one to many.
11:16.200 --> 11:18.720
We will have one more relationship called many to many.
11:20.470 --> 11:20.860
Many.
11:20.860 --> 11:21.490
Too many.
11:24.910 --> 11:25.240
Many.
11:25.240 --> 11:25.900
Too many.
11:32.260 --> 11:35.200
Air for writing this many to many relationship.
11:36.710 --> 11:40.290
We will have one more table, which is called bridge table.
11:40.310 --> 11:44.720
At least we need three minimum tables to write, many to many relations.
11:46.770 --> 11:49.470
For example, I have trainers and students.
11:58.350 --> 11:59.400
Reign of Unstolen.
12:00.560 --> 12:01.910
A teacher and student.
12:05.170 --> 12:07.620
One teacher will have multiple students write.
12:08.560 --> 12:15.010
Once one teacher will have multiple students and one student also will have multiple teachers.
12:15.040 --> 12:16.990
Only one teacher will not teach all the subjects.
12:17.500 --> 12:19.840
One student will have multiple teachers.
12:21.950 --> 12:22.280
Here.
12:22.490 --> 12:25.640
Some decide it will be many from table one and table two.
12:25.640 --> 12:26.120
Both sides.
12:26.120 --> 12:27.080
It will be many to many.
12:29.140 --> 12:31.120
For example, I have four trainers.
12:31.330 --> 12:31.990
Trainer one.
12:35.840 --> 12:36.560
Train up to.
12:38.320 --> 12:39.940
Reign of three and reign of four.
12:41.660 --> 12:43.490
And here I have ten students.
12:45.490 --> 12:47.110
There is one student who.
12:48.790 --> 12:49.810
Student three.
13:11.300 --> 13:11.810
Like this.
13:11.810 --> 13:14.060
I have two different tables.
13:14.330 --> 13:18.590
How to build a many to many relationship between these two tables.
13:20.590 --> 13:22.750
This is trainer ID one, two, three, four.
13:23.320 --> 13:24.640
This is student ID.
13:38.630 --> 13:42.170
This is Trainer Stable, which contains trainer and trainer name.
13:42.380 --> 13:45.440
This is Prudent table which contains student ID and student name.
13:48.870 --> 13:50.160
Now how to build.
13:50.430 --> 13:52.170
Many to many relationship between them.
13:54.040 --> 13:54.250
But.
13:56.170 --> 13:56.680
Personal.
14:00.260 --> 14:03.650
Well, here I have only two tables called trainer and student.
14:13.070 --> 14:14.930
We can't have one more column here.
14:16.010 --> 14:17.570
One to many relationship.
14:19.070 --> 14:21.860
For example here if I have trainer id as.
14:23.140 --> 14:23.760
Foreign key.
14:24.800 --> 14:27.140
For one student, there will be multiple trainers.
14:27.680 --> 14:28.730
For example.
14:28.730 --> 14:32.750
Student one is getting trained, trained from trainer one and two.
14:33.600 --> 14:35.250
How can you have multiple values here?
14:36.790 --> 14:37.750
We can't have like the.
14:39.350 --> 14:41.020
We cannot have multiple values like the.
14:42.420 --> 14:43.080
For example.
14:43.710 --> 14:47.280
Student two is getting trained on four subjects.
14:48.640 --> 14:51.040
Is getting trained under four trainers.
14:51.940 --> 14:54.550
His trainer should be one, two, three and four.
14:55.970 --> 14:57.320
How can we build like this?
14:58.460 --> 14:59.300
It is not possible.
15:00.920 --> 15:02.540
Is it possible to build like this?
15:05.390 --> 15:06.320
It is not possible.
15:07.950 --> 15:12.120
That's why we need the help of one more table called bridge table.
15:14.220 --> 15:18.210
In both trainer table and students table will have only primary key.
15:18.780 --> 15:19.710
Primary key values.
15:21.040 --> 15:22.630
In both trainers table.
15:23.780 --> 15:27.830
On student table, I will have only primary key values.
15:30.010 --> 15:36.870
Foreign key values will be present In one more table is called student trainers table, which is bridge
15:36.880 --> 15:37.180
table.
15:42.110 --> 15:45.710
I will build one more table with the name of student trainers table.
15:46.250 --> 15:47.240
Here I will have.
15:48.460 --> 15:50.590
Student ID and trainer ID.
15:53.400 --> 15:53.970
We just.
15:56.180 --> 16:03.080
Which is foreign key value from both the student ID is foreign key of student table and trainer ID is
16:03.080 --> 16:04.760
foreign key of trainer table.
16:05.090 --> 16:06.410
What I will do here.
16:06.560 --> 16:07.640
Student ID one.
16:09.460 --> 16:12.100
Back to training on the train ride.
16:12.160 --> 16:12.460
Number.
16:12.880 --> 16:14.230
Student number one.
16:14.590 --> 16:16.660
Training under trainer number two.
16:17.380 --> 16:21.220
Student ID number one Took training under Trainer three.
16:21.400 --> 16:24.850
Student ID Number two Training under Trainer one.
16:24.910 --> 16:27.040
Student ID number two Took training Under.
16:28.870 --> 16:29.830
Brainer number two.
16:29.860 --> 16:32.860
Student two Took training under.
16:33.130 --> 16:34.780
Trainer Number three.
16:35.140 --> 16:37.600
Student Number three Training under.
16:37.930 --> 16:38.860
Trainer number four.
16:40.820 --> 16:43.730
By using this bridge table as mediator.
16:43.730 --> 16:49.670
We can relate one to many relationship, one to many relationship, many values.
16:49.670 --> 16:50.930
In student table.
16:51.200 --> 16:56.570
Many values in student table is getting matched with many values in trainers table.
16:58.060 --> 17:02.260
Without this bridge table, we can't build a many to many relationship.
17:03.720 --> 17:06.210
Without this bridge table, we can't build it.
17:06.240 --> 17:07.620
Many to many relationship.
17:24.250 --> 17:27.350
Why do we need to learn about these relationships?
17:28.900 --> 17:31.060
For the topic called James.
17:31.300 --> 17:33.250
For the topic called James.
17:33.970 --> 17:38.590
Only if you know how these relationships are working, then only you can do joins.
17:43.060 --> 17:45.160
The purpose of using joints is.
17:47.430 --> 17:50.040
To retrieve data from multiple tables.
17:55.370 --> 17:57.080
Joint, not joint.
17:58.610 --> 17:59.840
To retrieve data.
18:03.920 --> 18:05.210
From multiple tables.
18:15.100 --> 18:19.870
They will use the concept called joins to retrieve data from multiple tables.
18:22.100 --> 18:25.520
But why do we need to retrieve data from multiple tables?
18:26.180 --> 18:31.860
Actually, at the beginning, without knowing about normalization, we have data only in single table,
18:31.900 --> 18:37.460
every single big table to save our storage, we divided the data into multiple tables.
18:38.630 --> 18:40.700
What if I want the data together?
18:41.360 --> 18:43.160
I want to print the data together.
18:43.760 --> 18:45.050
I am not storing here.
18:45.290 --> 18:48.830
I just want to print the data of both the tables.
18:50.910 --> 18:54.420
I should know how these both tables are related with each other.
18:55.740 --> 19:00.950
About these two tables are related with each other, and only by using that relationships.
19:00.960 --> 19:03.300
I can join both the tables.
19:03.510 --> 19:06.990
By joining both the tables, I can retrieve data from multiple tables.
19:07.200 --> 19:13.320
For example, in our scenario, I want all the student details along with their course details in a
19:13.320 --> 19:13.980
single table.
19:15.390 --> 19:17.270
Just want to print it in the output.
19:18.180 --> 19:21.330
Stored data in multiple tables to save the storage.
19:21.330 --> 19:23.340
But I want to print in single table.
19:26.880 --> 19:27.660
How can we do it?
19:27.930 --> 19:30.090
By using concept called joints we can do.
19:32.270 --> 19:34.520
For example, here in our database.
19:38.110 --> 19:41.770
We created student table and course details table.
19:41.770 --> 19:42.130
Right.
19:44.510 --> 19:50.870
We have one negative point here, actually, for course, on student tables, we should have many to
19:50.870 --> 19:51.680
many relationships.
19:52.640 --> 19:55.970
Many to many relationship to not to go to complex.
19:56.020 --> 19:57.590
I just used one too many.
19:59.900 --> 20:00.320
So let.
20:02.070 --> 20:03.600
Select star from student.
20:04.320 --> 20:06.330
First, you have to choose your database.
20:09.070 --> 20:10.990
Select star from student details.
20:12.080 --> 20:12.300
Here.
20:12.350 --> 20:14.480
I have details of multiple students.
20:20.060 --> 20:20.270
Here.
20:20.270 --> 20:22.400
I have details of multiple courses.
20:24.380 --> 20:28.790
In our scenario, one student cannot enroll for multiple courses.
20:30.030 --> 20:30.810
Check properly.
20:31.080 --> 20:34.350
One student cannot enroll for multiple courses.
20:35.670 --> 20:38.070
Under one course, there will be multiple students.
20:39.690 --> 20:46.320
One student cannot enroll for multiple courses because it is one too many which we use.
20:46.740 --> 20:47.940
We build only two tables.
20:47.940 --> 20:48.150
Right?
20:49.300 --> 20:53.260
If we want to build many to many, we need to take one bridge table.
20:55.120 --> 20:57.580
And we should have foreign key values in the bridge table.
20:58.780 --> 20:58.980
Here.
20:58.990 --> 20:59.830
Check this course.
20:59.830 --> 21:01.420
Details have two courses.
21:06.040 --> 21:07.750
Protect student details Table.
21:10.600 --> 21:12.940
One student enrolled for only one course.
21:13.480 --> 21:16.960
What if this student ID number one want to enroll for one more course?
21:20.480 --> 21:25.820
The student ID one enroll for now if you want to enroll for power also.
21:27.180 --> 21:27.420
What?
21:29.930 --> 21:31.040
Like it is not possible here.
21:31.760 --> 21:33.200
The student ID is primary.
21:33.350 --> 21:34.280
You can't duplicate it.
21:36.600 --> 21:38.730
Student primary can't duplicate it.
21:39.210 --> 21:42.150
You want many to many relationship in both the tables.
21:43.300 --> 21:45.910
We should take two tables which contain only primary key.
21:46.600 --> 21:50.350
You have to store course details separately and student details separately.
21:51.670 --> 21:57.220
After that, we should have one more bridge table with course student details our student course details.
21:58.190 --> 22:01.910
Where we will have only student ID and course ID Both are foreign keys.
22:03.310 --> 22:07.960
We should take the help of the bridge table and we can get many to many relationship.
22:14.860 --> 22:17.040
Yeah, we can work on multiple tables.
22:21.600 --> 22:27.540
Over the two weeks of no vegetable will have only foreign keys.
22:29.040 --> 22:34.080
Both of parent tables are to course details and student details will have only primary key.
22:36.080 --> 22:36.260
The.
22:38.560 --> 22:38.780
Okay.
22:40.340 --> 22:40.820
Yeah.
22:40.830 --> 22:41.570
Unpredictable.
23:05.290 --> 23:05.470
It.
23:08.790 --> 23:09.030
How?
23:12.710 --> 23:13.370
Each galaxy.
23:16.110 --> 23:16.280
It.
23:17.290 --> 23:17.570
Trainer.
23:17.650 --> 23:18.610
ID Trainer.
23:18.610 --> 23:18.880
Length.
23:19.420 --> 23:19.840
Hair.
23:19.840 --> 23:20.540
Student ID.
23:20.560 --> 23:21.190
Student Name.
23:21.880 --> 23:23.920
Here we have student ID as foreign key.
23:24.340 --> 23:26.350
We will relate it with student ID number.
23:26.860 --> 23:28.090
Trainer id as foreign key.
23:28.120 --> 23:31.120
We will relate it with trainer ID and we will get the.
23:35.650 --> 23:38.340
If we will have one more item, One more foreign key.
23:39.290 --> 23:40.910
Foreign key can have duplicate values.
23:45.100 --> 23:46.210
If we have one more.
23:47.860 --> 23:49.420
Table called course details.
23:55.040 --> 23:56.920
Here you have coarse and coarse name.
24:00.750 --> 24:02.340
Here you have one more thing called.
24:04.260 --> 24:04.800
Courtside.
24:08.270 --> 24:13.610
And you will write one, two, three, whatever the course required because one trainer can take multiple
24:13.610 --> 24:14.030
courses.
24:14.030 --> 24:14.470
Right?
24:15.250 --> 24:17.440
One trainer can teach multiple courses.
24:20.170 --> 24:22.720
And there will be multiple trainers for each subject.
24:23.950 --> 24:25.720
You want to find it out?
24:25.750 --> 24:27.400
Course and course name also.
24:28.450 --> 24:29.530
You can write this course.
24:34.070 --> 24:39.040
For example, I have four side, one for side two our.
24:41.930 --> 24:44.360
I have only two courses and I have four trainings.
24:47.150 --> 24:48.960
Trainer one is teaching SQL.
24:50.620 --> 24:52.600
A trainer too is teaching power by.
24:54.230 --> 24:56.440
Again, this trainer three is sorry.
25:00.240 --> 25:01.950
Raynor three is teaching school.
25:03.230 --> 25:03.550
In.
25:06.700 --> 25:06.970
No.
25:06.970 --> 25:10.690
By using this particular table, we are relating all the three values.
25:11.570 --> 25:12.980
He student ID number one.
25:14.050 --> 25:15.880
Got trained from trainer number one.
25:16.570 --> 25:17.860
Got trained on yesterday.
25:26.320 --> 25:27.790
No, we need not to insert values.
25:28.270 --> 25:31.300
Only if a student is enrolling for the course.
25:31.720 --> 25:33.400
We will insert his values.
25:35.430 --> 25:36.540
For example, if.
25:36.540 --> 25:38.130
Student four is there.
25:38.950 --> 25:40.780
He enrolled only for one course.
25:41.050 --> 25:42.610
Student ID number for.
25:42.610 --> 25:43.510
Enrolled for.
25:45.280 --> 25:50.050
I enrolled under trainer ID number one, and he enrolled only for his details.
25:50.050 --> 25:51.460
His details are completed.
25:52.000 --> 25:53.200
Only one record for him.
25:56.140 --> 25:57.460
Is the best no brainer.
25:59.340 --> 26:00.150
Who will teach them.
26:04.660 --> 26:04.840
It's.
26:08.310 --> 26:09.140
Yeah, of course did.
26:15.060 --> 26:16.380
Only foreign key values.
26:16.740 --> 26:22.740
Yeah, it will carry only the values and it will relate multiple tables.
26:23.680 --> 26:26.440
This particular table is also called as fact table.
26:28.290 --> 26:31.140
This table is also called as fact Table.
26:33.380 --> 26:34.160
This primary.
26:34.160 --> 26:37.190
Key value tables are also called as dimension tables.
26:40.870 --> 26:41.920
Dimension table.
26:44.060 --> 26:49.860
But even if we have ten dimension tables, it will be giant.
26:49.880 --> 26:51.680
It will be related with one fact table.
26:54.880 --> 26:55.060
But.
26:58.120 --> 26:58.450
Shelton.
27:03.710 --> 27:04.180
Active.
27:08.470 --> 27:09.120
In joints.
27:09.120 --> 27:11.130
We have two types, basically.
27:12.000 --> 27:13.740
There are inner joints and outer.
27:16.650 --> 27:20.160
Inner joins and outer joins.
27:24.810 --> 27:27.060
Inner joins and outer joins.
27:28.980 --> 27:35.760
What is this inner join is this inner join will give only the matching values between the positive.
27:37.000 --> 27:39.010
It will print only matching values.
27:39.280 --> 27:40.240
In both attorns.
27:45.260 --> 27:46.700
I will show you how it works.
27:46.700 --> 27:47.180
One minute.
27:48.830 --> 27:49.490
In course.
27:49.490 --> 27:50.480
Details Table.
27:50.510 --> 27:52.550
All of you inserts one more value.
27:52.970 --> 27:54.500
Which course number three.
27:55.580 --> 27:56.080
Outside.
27:56.100 --> 27:58.250
Number three, tableaux until something.
28:04.000 --> 28:05.050
Site number three.
28:09.300 --> 28:10.140
You can take anything.
28:10.150 --> 28:10.560
Python.
28:12.090 --> 28:12.510
A double.
28:12.560 --> 28:13.760
Whatever you want, you can take.
28:15.860 --> 28:16.670
18,000.
28:22.820 --> 28:25.490
Originality is nothing but of the relationships between the.
28:28.670 --> 28:29.990
No, it is not a command.
28:30.020 --> 28:31.100
It's just the concept.
28:40.210 --> 28:42.640
I inserted one more value into course details.
28:43.660 --> 28:43.900
Here.
28:43.900 --> 28:46.750
I have four students in student detail still.
28:49.920 --> 28:52.050
I have four students in student retention.
28:53.260 --> 28:54.130
Course, 81.
28:54.130 --> 29:00.190
What is course side number one for side number one again for side number two, power.
29:02.120 --> 29:06.500
This for side number one and two are getting matched in both the tables.
29:07.550 --> 29:10.580
Do we have any matching value for course, number three here?
29:12.210 --> 29:13.950
No, we don't have any matching.
29:15.190 --> 29:21.340
If we want to print only the matching values, then we have to use the join called inner join.
29:22.650 --> 29:24.990
It will not print the details of Python.
29:26.060 --> 29:27.950
Will not print the details of Python.
29:29.160 --> 29:35.640
If you want the details of both matching values, plus unmatched values, then you have to use the join
29:35.730 --> 29:36.720
called outer join.
29:39.210 --> 29:42.750
If you want to get the details of both matching values.
29:45.340 --> 29:46.990
Plus unmatched values.
29:51.520 --> 29:52.680
Unnaturalness.
29:54.650 --> 29:56.270
Matching renders plus unmatchable.
29:56.380 --> 30:01.880
If you want to print both the details, then you have to use the single outer joins.
30:03.970 --> 30:05.110
In the inner joints.
30:05.110 --> 30:07.300
We have only one keyword called join.
30:08.480 --> 30:10.490
Giant women use only giant.
30:11.510 --> 30:12.710
Giant is the keyword for.
30:15.040 --> 30:17.200
The syntax for writing join is.
30:17.230 --> 30:18.160
Let me show you.
30:26.230 --> 30:29.460
First you have to write what are the columns that you want to print?
30:32.840 --> 30:33.590
Select.
30:34.100 --> 30:35.720
I want to print student ID.
30:39.090 --> 30:39.510
Name.
30:41.830 --> 30:42.250
Yes.
30:44.280 --> 30:44.790
Gender.
30:50.260 --> 30:50.880
Pourseyedi.
30:54.060 --> 30:54.720
Location.
30:55.990 --> 30:56.740
Yeah, of course.
30:56.920 --> 30:58.150
Let me print course name.
31:00.260 --> 31:01.070
Course name.
31:02.350 --> 31:02.920
See.
31:04.070 --> 31:05.270
On that last location.
31:08.580 --> 31:09.030
Student.
31:09.330 --> 31:09.780
Name.
31:09.780 --> 31:10.080
Age.
31:10.080 --> 31:10.590
Gender.
31:10.590 --> 31:10.980
Course.
31:11.250 --> 31:11.610
Course.
31:11.610 --> 31:11.850
Name.
31:11.850 --> 31:13.410
Fee and location.
31:13.680 --> 31:16.200
This data I have in two different tables.
31:16.890 --> 31:19.860
I have this data in two different tables.
31:20.130 --> 31:22.970
The student details are present in student details.
31:23.370 --> 31:27.030
This course, name and fee are present in course retention.
31:30.060 --> 31:30.420
Yes, sir.
31:30.660 --> 31:32.550
We have this data in two different tables.
31:33.910 --> 31:34.330
Yeah.
31:36.250 --> 31:38.440
Some student details.
31:46.350 --> 31:46.890
Select.
31:46.890 --> 31:50.250
And after that, select the column names from student details.
31:55.110 --> 31:57.630
Giant watch details.
32:05.890 --> 32:07.450
Am joining the both the tables.
32:08.560 --> 32:13.750
And you have to give condition based on which value you are joining both the tables.
32:13.870 --> 32:16.210
What is the related value in these two tables?
32:19.810 --> 32:21.220
What is the related value?
32:21.250 --> 32:22.840
Related column in both the tables.
32:25.070 --> 32:25.750
Pourseyedi.
32:27.200 --> 32:31.880
Foresight side is the foreign key value here, which is used to build relationships between both the
32:31.880 --> 32:32.300
tables.
32:33.290 --> 32:33.420
It.
32:34.560 --> 32:37.650
I am taking alias name for student details table.
32:37.740 --> 32:39.930
I am taking student details as SB.
32:42.490 --> 32:43.870
On first details ACB.
32:47.070 --> 32:49.800
After that, you have to give condition on.
32:52.270 --> 32:54.050
On on is the condition value.
32:54.310 --> 32:55.900
It will print the matching value.
32:55.990 --> 33:02.290
It will check the matching value with this on condition is used to check the matching values between
33:02.290 --> 33:05.500
both the tables on student details.
33:05.500 --> 33:05.800
Dot.
33:06.610 --> 33:08.950
Dot for side is equal to.
33:12.030 --> 33:12.390
Course.
33:12.390 --> 33:13.530
Details, Dot course.
33:17.610 --> 33:21.600
Student details that course equal to course details that course ID.
33:24.520 --> 33:28.310
Am joining the both the tables based on this particular value.
33:29.090 --> 33:32.360
I'm joining both the tables based on this particular value called.
33:34.330 --> 33:38.110
Waterside by matching course sides in both the tables.
33:38.500 --> 33:41.020
Am joining the data which is presented two tables.
33:41.470 --> 33:44.320
This is how we can print data from multiple tables.
33:44.590 --> 33:47.260
This is how we can print data from multiple tables.
33:47.470 --> 33:50.950
If I execute this particular query, I will get error.
33:53.470 --> 33:54.130
Will get there.
33:55.060 --> 33:58.990
Will get error which is called poor side is ambiguous.
33:59.950 --> 34:03.390
Course it is ambiguous while writing joins.
34:03.600 --> 34:06.420
You should remember about this particular error.
34:06.420 --> 34:06.930
Definitely.
34:08.750 --> 34:10.630
Because this error will confuse you.
34:10.640 --> 34:14.480
Most of the times query is completely correct, but you will get this error.
34:14.840 --> 34:21.980
Most of the times if I execute this particular query column for side in fields list is ambiguous.
34:24.260 --> 34:28.110
What is this particular service?
34:28.310 --> 34:28.970
Ambigious.
34:29.330 --> 34:31.700
Why only course it is ambiguous.
34:31.730 --> 34:33.170
Why not another column?
34:38.140 --> 34:40.330
So I took course completely.
34:41.410 --> 34:43.960
Yet this particular column for this column is.
34:46.950 --> 34:50.280
This course column is present in both the tables.
34:52.250 --> 34:54.290
Ambiguous means confusing?
34:54.830 --> 34:58.070
Yes, it is feeling confusing that from which table?
34:58.070 --> 34:59.360
I want to print this course.
35:01.690 --> 35:06.160
This course is present in course Details table and also in student details.
35:06.160 --> 35:06.430
Table.
35:06.760 --> 35:08.850
From which table have to print this course.
35:10.100 --> 35:11.270
You can give any table.
35:13.190 --> 35:17.870
Even if you give student student details table name, it will print course properly.
35:18.080 --> 35:21.380
Even if you give course details table name, it will print properly.
35:22.580 --> 35:24.860
As you didn't mention any table names here.
35:25.910 --> 35:29.440
Is throwing the error called course in fields, which is ambiguous.
35:30.130 --> 35:33.070
Remaining columns are okay because they are present in only one table.
35:33.610 --> 35:36.430
Only this course ID column is present in both the tables.
35:37.810 --> 35:44.740
That's why while writing joins what we have to do for each and every column, we have to mention table
35:44.740 --> 35:45.490
name also.
35:46.780 --> 35:50.530
A street art student at networks for student details.
35:50.530 --> 35:56.770
Table two dot Student Dot Name.
35:59.020 --> 36:00.210
Yesterday that age.
36:02.130 --> 36:07.290
Alias name took here by using as student details as.
36:08.660 --> 36:13.670
It's easy for all the columns present in student details we can use.
36:13.710 --> 36:13.950
Easy.
36:15.880 --> 36:20.860
For this course column, you can give either course details, table or student table.
36:23.270 --> 36:24.410
Is do not proceed.
36:24.500 --> 36:31.640
This course name is printing course details fee is present in course details and location is present
36:31.640 --> 36:32.570
in student details.
36:35.850 --> 36:37.710
We have to mention table name.
36:37.950 --> 36:38.580
Column name.
36:43.810 --> 36:46.030
Yeah, if you can name, you can give any alias.
36:47.750 --> 36:52.070
But instead of writing student details or course course details.
36:52.310 --> 36:55.340
Course writing will become more lengthy.
36:57.290 --> 36:58.360
I use just aliases.
36:59.690 --> 36:59.900
So.
37:01.060 --> 37:03.850
I print the data of both the tables together.
37:05.150 --> 37:10.670
Student ID one enrolled for fee 15,000 in Bangalore location.
37:24.590 --> 37:25.120
Shut up.
37:25.160 --> 37:26.540
This is written in short form.
37:29.840 --> 37:31.050
This is shortest query.
37:33.620 --> 37:33.800
In.
37:36.160 --> 37:38.260
I wrote in multiple lengths for readability.
37:39.690 --> 37:40.890
You can write in single line.
37:44.240 --> 37:44.930
Select.
37:44.930 --> 37:50.570
And after select, you have to mention all the column names from both the tables which you want to select.
37:52.560 --> 37:53.680
From table one.
37:53.700 --> 37:57.060
Join table two on table one.
37:57.110 --> 37:59.610
Dot Primary key is equal to table two dot foreign key.
38:01.500 --> 38:06.420
We have to give that linker column which is generated, which is acting as a relationship between both
38:06.420 --> 38:06.930
the tables.
38:12.530 --> 38:14.330
All of you write this particular query.
38:15.910 --> 38:16.300
Okay.
38:20.900 --> 38:21.080
And.
38:29.320 --> 38:30.640
But when we observed to wit.
38:33.740 --> 38:34.150
Yeah.
38:36.050 --> 38:36.560
Okay.
38:41.240 --> 38:41.400
Mm.
38:44.820 --> 38:45.360
It's showing.
38:57.130 --> 38:58.060
Version one point.
38:59.450 --> 39:01.280
The current balance is not changing.
39:02.420 --> 39:04.070
It is not changing automatically.
39:04.100 --> 39:04.880
It will not change.
39:05.300 --> 39:07.490
We didn't wrote any query to change it, right?
39:10.610 --> 39:12.830
For that, we have to write one more additional query.
39:15.710 --> 39:16.880
The query will be.
40:01.870 --> 40:02.500
Okay.
40:03.310 --> 40:07.720
We told we already discussed that this inner join will give only the matching values.
40:10.570 --> 40:13.300
This inner giant will give only the matching values.
40:13.930 --> 40:15.940
Now I want the details of Python.
40:18.810 --> 40:21.010
We have to use outer joints.
40:21.030 --> 40:23.340
We have to use outer joints.
40:25.380 --> 40:26.250
In outer joints.
40:26.250 --> 40:29.670
We have three types of joints which are called left joint.
40:32.740 --> 40:33.520
Left the giant.
40:35.190 --> 40:35.670
Right.
40:35.670 --> 40:36.180
Join.
40:38.070 --> 40:38.820
Unfreezing.
40:43.240 --> 40:46.150
Left to join, Right, join and full join.
40:47.390 --> 40:48.410
In outer joints.
40:48.410 --> 40:50.360
We have three types of joints which are called.
40:52.300 --> 40:52.670
Left.
40:52.690 --> 40:54.880
Join, right, join and full join.
41:22.500 --> 41:24.160
What is the purpose of this left?
41:27.140 --> 41:32.510
It is left to join will give all matching values from both the tables.
41:34.980 --> 41:36.510
Which means the output of inner giant.
41:39.100 --> 41:42.070
Now, Jane is giving matching values between both the tables.
41:42.070 --> 41:42.340
Right.
41:42.970 --> 41:51.430
It will give all matching values between both the tables, plus unmatched values from left table, unmatched
41:51.430 --> 41:52.960
values from left table.
41:53.410 --> 41:55.400
What is left table and what is right table?
41:55.420 --> 41:56.020
You can ask me.
41:56.320 --> 41:58.570
We are writing table one.
42:00.690 --> 42:02.490
Giant able to.
42:05.270 --> 42:12.470
This is the syntax actual syntax to join here also in normal use student details join course details.
42:12.800 --> 42:17.300
The student details is student details is in left side.
42:17.750 --> 42:19.250
We write it in single line.
42:20.370 --> 42:21.480
Student details will come.
42:21.510 --> 42:27.180
Table one, which is in left side for the join and table two is in the right side, which is course
42:27.180 --> 42:27.480
details.
42:27.690 --> 42:29.190
This will become right table.
42:30.230 --> 42:36.680
If we have it, will print all the matching values and if we have any unmatched value from table one,
42:37.010 --> 42:39.200
it will print that unmatched value also.
42:40.360 --> 42:47.770
When it comes to right join, it will print all the matching values plus unmatched value from right
42:47.800 --> 42:53.770
table, which means it will print only the matching values and unmatched values only from the right
42:53.770 --> 42:54.280
side table.
42:54.820 --> 42:57.010
In our example it is course details table.
42:57.040 --> 42:59.590
Do we have any unmatched value in course details?
43:00.100 --> 43:02.920
Yes, we have value of Python left table.
43:02.920 --> 43:07.680
We don't have any unmatched values, but in right table we have Python as unmatched value.
43:08.220 --> 43:09.950
We'll print the details of Python also.
43:11.700 --> 43:12.390
Full join.
43:12.420 --> 43:18.780
This full join will print all the matching values plus unmatched values from both the tables.
43:20.110 --> 43:21.640
From both left and right tables.
43:22.210 --> 43:25.670
It will print all the matching values and unmatched.
43:25.690 --> 43:27.880
Values from both left and right tables.
43:31.220 --> 43:31.400
Look.
43:34.000 --> 43:35.470
No, we are just printing.
43:35.470 --> 43:38.500
We are not storing the data by using giants.
43:38.500 --> 43:39.460
We can just print.
43:44.480 --> 43:47.690
For example, in the same way, no need to change any syntax.
43:48.440 --> 43:49.820
Instead of this join.
43:51.200 --> 43:51.920
Let me Right.
43:51.950 --> 43:52.580
Left join.
43:53.880 --> 43:56.430
Do we have any match values in the left table?
43:58.560 --> 44:00.180
Do we have any unmatched values?
44:00.300 --> 44:01.050
Student Details?
44:01.380 --> 44:01.890
No.
44:01.920 --> 44:04.410
It will print same this inner join output.
44:05.010 --> 44:07.110
It will print the same inner join output.
44:08.400 --> 44:09.570
I use love to join.
44:11.220 --> 44:12.880
It will print same in that journal.
44:14.280 --> 44:14.900
Same.
44:16.050 --> 44:16.860
We don't have.
44:19.390 --> 44:20.050
Left to join.
44:20.620 --> 44:24.250
If you want unmatched value from the left table we have to use.
44:24.280 --> 44:24.910
Left join.
44:26.660 --> 44:30.560
If you want unmatched value from the right side table, what you have to do.
44:33.710 --> 44:35.590
A matching value from right side table.
44:37.210 --> 44:38.320
We have to use, right?
44:38.320 --> 44:38.650
Join.
44:41.970 --> 44:44.910
Why do we have any unmatched value in course?
44:44.910 --> 44:45.570
Details Table.
44:46.200 --> 44:48.130
Yes, we have Python as unmatched.
44:48.930 --> 44:51.110
Now it will print the details of Python also.
44:54.830 --> 44:56.510
All the remaining values will be null.
45:02.030 --> 45:06.040
It will print all the matching values an unmatched value from right table.
45:07.200 --> 45:10.670
If we have any unmet value from the right side table, it will print that value out.
45:11.980 --> 45:13.000
What is Fujian?
45:14.420 --> 45:18.260
It will print all the matching values and unmatched values from both the tables.
45:21.710 --> 45:24.680
Which is what I am doing if I use full join.
45:27.200 --> 45:28.680
Losing it will throw me.
45:30.680 --> 45:32.060
A SQL syntax error.
45:33.460 --> 45:35.220
He is throwing red color into work.
45:35.490 --> 45:40.680
Even if I execute it will throw me have an error in SQL syntax corresponding.
45:44.070 --> 45:45.000
His full joint.
45:46.190 --> 45:49.220
We don't have any keyword called full join industrial.
45:50.560 --> 45:53.470
We don't have any keyword called full join in SQL.
45:53.740 --> 45:59.320
That's why if you want to get the output of full join, what you have to do is you have to write left,
45:59.320 --> 45:59.650
join.
46:00.910 --> 46:04.300
Left to join and remove the semicolon after the query.
46:07.370 --> 46:08.540
After that, right?
46:08.570 --> 46:09.200
Union.
46:10.600 --> 46:11.110
Union.
46:14.030 --> 46:14.570
At the end.
46:14.570 --> 46:15.150
Rachel.
46:18.660 --> 46:18.840
Right.
46:20.640 --> 46:23.970
We have to add both left and output and right join.
46:26.820 --> 46:27.150
Yeah.
46:29.160 --> 46:32.160
When it comes to Fulton, we don't have any keyword called Fulton.
46:33.060 --> 46:38.850
If you want the output of full join, you have to write left, Join union, right, join or right,
46:38.850 --> 46:39.660
join union, Left.
46:39.660 --> 46:39.950
Join.
46:39.960 --> 46:40.380
Anything.
46:43.090 --> 46:47.020
I exude this will get all the matching numbers on my matching numbers.
47:03.690 --> 47:03.870
Oh.
47:03.870 --> 47:04.740
Left joint Union.
47:04.740 --> 47:04.980
Right.
47:04.980 --> 47:05.640
Join or right.
47:05.640 --> 47:06.420
Join Union Left.
47:09.630 --> 47:10.040
No, no.
47:10.870 --> 47:14.730
First we have to write Leftjoin query completely after that union.
47:14.760 --> 47:16.560
After that, write Giant query Complete.
47:19.290 --> 47:25.410
But left the join query union right joint query which is completely single query.
47:30.310 --> 47:31.720
Angelidis this left joint union.
47:31.720 --> 47:31.960
Right.
47:53.820 --> 47:55.350
First we have to know the logic, right?
47:55.350 --> 47:56.910
At least to write one particular thing.
47:57.660 --> 48:00.270
We know logic from next thing we can copy paste.
48:04.740 --> 48:06.510
By tomorrow or after tomorrow.
48:06.510 --> 48:08.360
Sessions We will complete basics.
48:08.370 --> 48:09.210
All basics.
48:10.420 --> 48:12.880
These concepts will come under SQL basics.
48:14.830 --> 48:16.440
So is.
48:18.180 --> 48:18.780
This started.
48:18.780 --> 48:19.890
I will not take text.
48:19.890 --> 48:21.060
I will conduct class.
48:22.330 --> 48:27.040
Next Saturday there will be test on all the syntaxes we have to write queries.
48:28.410 --> 48:29.310
Not the theory.
48:34.640 --> 48:35.360
On festivals.
48:35.360 --> 48:36.530
We have to study more.
48:38.890 --> 48:40.780
We have to pray God and we have to study.
48:48.730 --> 48:49.210
That's.
48:58.360 --> 49:01.270
These are the inner and outer joins.
49:01.390 --> 49:03.580
We have one more type of joins.
49:06.170 --> 49:08.390
No more giants that the Giants will come.
49:08.510 --> 49:09.730
These two are very easy.
49:13.060 --> 49:16.690
One thing I will explain to you, one thing I will give you as a task.
49:17.720 --> 49:20.270
Try by tomorrow if you don't get the output.
49:21.820 --> 49:22.840
We can solve it tomorrow.
49:27.330 --> 49:29.940
After that, we have something called miscellaneous joints.
49:30.420 --> 49:33.000
No one named them left and right joint.
49:33.030 --> 49:33.930
No one named them.
49:34.960 --> 49:39.130
That's why we have miscellaneous journals which are called Cross Joint.
49:41.400 --> 49:42.420
Cross join.
49:45.540 --> 49:46.430
Wonderful stuff.
49:51.750 --> 49:53.370
Ross Self Self-join.
49:59.250 --> 50:03.540
This cross joint is also called as Cartesian product.
50:08.920 --> 50:10.330
Cartesian product.
50:13.640 --> 50:15.860
What is the purpose of using this cross?
50:15.860 --> 50:18.130
Join this cross.
50:18.140 --> 50:21.620
Join will give all the combination between both the parents.
50:22.250 --> 50:25.520
It will give all combinations between both the tables.
50:32.300 --> 50:34.580
All combinations between both tables.
50:44.710 --> 50:47.170
For example, we have four students.
50:57.360 --> 51:01.470
I have four students and am providing three courses.
51:11.780 --> 51:13.760
These are the three courses I'm providing.
51:14.330 --> 51:17.480
I have four students and I am providing three courses.
51:19.220 --> 51:21.680
All combinations means it will take all.
51:21.680 --> 51:24.640
It will give all the combinations between both the tables will.
51:26.430 --> 51:28.220
I'm choosing this one condition.
51:29.150 --> 51:31.250
I'm choosing power is one combination.
51:31.910 --> 51:34.190
I'm choosing Python is one combination.
51:36.670 --> 51:39.130
Some are choosing is one combination.
51:39.400 --> 51:42.910
Some are choosing one combination, some are choosing.
51:42.910 --> 51:44.230
Python is one combination.
51:46.170 --> 51:48.390
John Choosing school is one combination.
51:48.420 --> 51:50.820
John Choosing power is one combination.
51:51.210 --> 51:53.250
John Choosing Python is one combination.
51:54.860 --> 51:56.990
Peter Choosing SQL is one combination.
51:57.200 --> 51:59.330
Peter Choosing power is one combination.
51:59.810 --> 52:01.700
Peter Choosing Python is one combination.
52:02.180 --> 52:05.690
These are all the possible combinations between these two tables.
52:07.480 --> 52:09.270
How many possible combinations are there?
52:09.280 --> 52:09.880
Completely.
52:13.220 --> 52:14.120
For all.
52:15.190 --> 52:16.000
For each person.
52:16.000 --> 52:18.580
There are three possible subjects.
52:18.760 --> 52:19.990
Four people are there.
52:20.980 --> 52:22.330
Total total combinations.
52:23.640 --> 52:23.820
Oh.
52:25.170 --> 52:26.580
Well, yeah.
52:26.670 --> 52:27.560
Total to all comers.
52:27.570 --> 52:28.560
What you said is correct.
52:30.550 --> 52:32.620
How some person told other.
52:36.660 --> 52:39.690
Why it is called Cartesian product is in the output.
52:39.690 --> 52:45.900
You will get the product of number of records present in table one into number of records present in
52:45.930 --> 52:46.470
table two.
52:46.830 --> 52:50.310
Here I have four records, details of four people here.
52:50.310 --> 52:54.960
I have three courses, records of three courses, four into three.
52:54.990 --> 52:56.700
You will get total records in the output.
52:57.680 --> 53:03.560
You will get to all records in the output will give all the possible combinations between both the tables.
53:07.060 --> 53:10.420
We'll give all possible combinations between both the tables.
53:16.860 --> 53:18.270
Syntax is very easy.
53:20.120 --> 53:21.290
Syntax is very easy.
53:22.710 --> 53:23.370
Select.
53:25.350 --> 53:26.310
Star from.
53:29.290 --> 53:30.310
Student details.
53:33.910 --> 53:34.990
Ramaphosa is.
53:41.230 --> 53:43.900
Select star from Student Details Campus News.
53:46.360 --> 53:46.840
Yeah.
53:47.680 --> 53:49.700
If I execute this particular query.
53:50.850 --> 53:53.700
And yet course details.
53:56.890 --> 53:57.310
Spending.
54:02.710 --> 54:03.940
Rom choosing python.
54:04.420 --> 54:05.440
Rom Choosing power.
54:05.950 --> 54:07.270
Rom Choosing SQL.
54:08.650 --> 54:09.400
After that.
54:09.400 --> 54:10.630
Peter Choosing Python.
54:10.780 --> 54:12.040
Peter Choosing power being.
54:13.250 --> 54:16.790
Like that for each student, you will get all the possible combinations.
54:19.770 --> 54:19.910
Mm.
54:22.120 --> 54:22.450
What?
54:25.720 --> 54:25.860
Mm.
54:30.710 --> 54:35.600
Known for writing, for getting all the combinations you have to write Select Star from table one,
54:35.600 --> 54:36.200
comma table.
54:36.890 --> 54:38.030
We'll give cross join.
54:40.740 --> 54:41.220
Okay.
54:42.500 --> 54:46.490
Now we have most important interview question which is also.
54:48.630 --> 54:51.750
Project to to get all the combination values.
54:54.370 --> 54:57.670
For example, if you are making any portal business.
54:58.610 --> 55:01.280
Purtell because you are creating some database for Portal.
55:02.450 --> 55:05.990
You have to give all combinations for food items.
55:07.790 --> 55:09.620
For example, you have for breakfast.
55:15.320 --> 55:15.840
Improving.
55:18.860 --> 55:19.770
The mathematician.
55:21.780 --> 55:27.120
You are taking, you are having for breakfast and you are having 6 or 7 types of curries.
55:54.810 --> 55:55.320
Like that.
55:55.320 --> 55:57.150
We have multiple careers.
55:58.560 --> 55:59.700
One person came.
56:01.050 --> 56:01.920
He chose Italy.
56:02.640 --> 56:03.630
He can take any.
56:04.740 --> 56:05.310
Don't tell.
56:05.310 --> 56:07.110
That will give only samba for Italy.
56:08.700 --> 56:10.200
It is optional for him.
56:10.920 --> 56:13.440
We have to give all the possible combinations.
56:13.890 --> 56:17.330
He can choose anything into chapati.
56:17.340 --> 56:19.140
He can use sambar into dosa.
56:19.140 --> 56:21.000
He can use sambar based on his taste.
56:22.800 --> 56:23.270
In Tokyo.
56:23.370 --> 56:24.300
He can eat sambar.
56:26.800 --> 56:27.460
Into Italy.
56:27.470 --> 56:28.360
You can eat chicken.
56:29.670 --> 56:30.990
You might have different tastes.
56:33.030 --> 56:33.900
You can't tell, right?
56:35.070 --> 56:35.430
You can't.
56:35.790 --> 56:37.320
Don't take chicken with Italy.
56:37.550 --> 56:38.310
Will not taste well.
56:38.850 --> 56:41.550
Only Italian puree, chicken and puree are good.
56:42.120 --> 56:45.420
You can't tell like that because he is his customer.
56:45.450 --> 56:46.320
Your customer.
56:46.530 --> 56:47.850
You should not lose him.
56:49.580 --> 56:51.410
We have to give all the possible combinations.
56:51.410 --> 56:52.330
Whatever you want.
56:52.520 --> 56:52.990
He believed.
58:22.270 --> 58:27.930
This grass giant is used to build all possible combinations between both arrays.
58:30.110 --> 58:32.390
After that, we have something called Self-join.
58:36.520 --> 58:40.690
There will be a -- sure question from giants in Italy.
58:41.680 --> 58:46.280
One question is can form from giants enter any interview?
58:46.480 --> 58:48.940
If you are if you mention that it is.
58:51.630 --> 58:51.870
Yeah.
58:54.830 --> 58:55.970
In an interview.
58:56.450 --> 59:01.640
If you mention in your resume, there will be a different question from Giants.
59:04.150 --> 59:05.770
80% of the time.
59:06.070 --> 59:08.470
They will ask you to write this self-join.
59:11.090 --> 59:12.020
Self-join.
59:13.000 --> 59:16.270
Joining the same table with itself is called self join.
59:18.500 --> 59:19.310
Joining.
59:21.390 --> 59:22.560
Same table.
59:26.200 --> 59:27.280
With itself.
59:31.930 --> 59:33.850
You are joining the same table with itself.
59:33.880 --> 59:39.910
You will not have two tables, a giant single table, which itself will give you an example.
59:41.790 --> 59:45.510
You have an employees table where you have employee ID.
59:48.440 --> 59:49.160
Employing him.
59:52.810 --> 59:55.480
Employee ID Employee Name manager.
59:59.730 --> 1:00:02.370
Employee ID Employee Name manager.
1:00:03.610 --> 1:00:05.620
You have one table with all these columns.
1:00:06.180 --> 1:00:08.200
I am storing the data of Microsoft.
1:00:09.720 --> 1:00:10.250
Employed.
1:00:10.290 --> 1:00:11.400
One is he gets.
1:00:15.780 --> 1:00:19.890
As he is the CEO of the company, he don't have any further manager.
1:00:20.520 --> 1:00:22.290
That's why manager value is known.
1:00:24.900 --> 1:00:25.350
Okay.
1:00:25.830 --> 1:00:27.000
After that second.
1:00:28.640 --> 1:00:29.750
Under Bill Gates.
1:00:30.530 --> 1:00:32.570
Google and Microsoft are merging both.
1:00:34.510 --> 1:00:34.780
That's.
1:00:36.300 --> 1:00:37.170
Under Bill Gates.
1:00:37.170 --> 1:00:39.450
There are two employees whose name is Raymond Some.
1:00:42.780 --> 1:00:43.440
I'm on some.
1:00:45.070 --> 1:00:48.550
Now Ram is working under Bill Gates.
1:00:49.090 --> 1:00:52.500
The employee of Bill Gates will become manager for Ram.
1:00:54.330 --> 1:00:56.730
Employee of the year will become manager for.
1:00:58.250 --> 1:00:58.910
Under Bill Gates.
1:00:58.910 --> 1:00:59.510
One more employee.
1:00:59.510 --> 1:01:00.230
Is there someone?
1:01:02.400 --> 1:01:05.710
Working under presents under Santa.
1:01:05.730 --> 1:01:08.370
They are two employees, John and Peter.
1:01:15.670 --> 1:01:16.540
John and Peter.
1:01:18.140 --> 1:01:18.650
Manager.
1:01:18.650 --> 1:01:19.520
It is three.
1:01:21.270 --> 1:01:21.780
Okay.
1:01:21.780 --> 1:01:22.980
This is one single table.
1:01:24.680 --> 1:01:25.700
Who is the manager for?
1:01:27.970 --> 1:01:29.860
Bill Gates, who is the manager for John.
1:01:31.070 --> 1:01:31.310
I'la.
1:01:32.340 --> 1:01:33.330
We have complete clarity.
1:01:33.330 --> 1:01:33.600
Right?
1:01:34.690 --> 1:01:38.110
Got complete clarity on this particular table right in the output.
1:01:38.110 --> 1:01:40.750
I want the employee ID.
1:01:42.710 --> 1:01:43.570
Employee name.
1:01:48.430 --> 1:01:49.360
Unmanageable.
1:01:56.590 --> 1:01:59.160
One management employee ID.
1:02:00.550 --> 1:02:02.380
The employee name and manager.
1:02:04.320 --> 1:02:09.090
In the output you want to print employee ID, employee name and manager.
1:02:10.170 --> 1:02:13.770
Must create this particular table with the name of employee details.
1:02:14.650 --> 1:02:18.370
And enter the insert this particular data into the table.
1:02:18.580 --> 1:02:22.810
After that, write a join you can use inner join or outer join query.
1:02:22.990 --> 1:02:23.920
Same query.
1:02:27.230 --> 1:02:29.780
No need of using using any nonsense.
1:02:30.750 --> 1:02:34.000
They are trying to create a table without any constraints.
1:02:35.190 --> 1:02:35.850
After that.
1:02:37.250 --> 1:02:38.480
The output you want to fetch.
1:02:38.510 --> 1:02:41.090
Employee ID name, employee name and manager name.
1:02:42.190 --> 1:02:43.970
Want to fetch these three outputs.
1:02:47.500 --> 1:02:48.090
This is the task.
1:02:51.110 --> 1:02:52.520
No burglar Chargeability.
1:02:52.550 --> 1:02:55.460
Please only use your brain.
1:02:55.610 --> 1:02:57.860
Even if you don't get output, you will learn something.
1:03:00.250 --> 1:03:02.290
Just normal inner giant or outer giant.
1:03:03.470 --> 1:03:05.280
No change in syntax of the join.
1:03:06.820 --> 1:03:07.120
Yeah.
1:03:15.410 --> 1:03:16.670
How to print Employee ID.
1:03:16.700 --> 1:03:18.200
Employee Name Manager.
1:03:18.200 --> 1:03:18.560
Name.
1:03:19.100 --> 1:03:19.940
Not manager.
1:03:22.580 --> 1:03:22.920
Manager.
57917
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.