WEBVTT

00:00.450 --> 00:00.810
All right.

00:00.810 --> 00:08.640
So we're here to create that connection between the database and so you know between the police and

00:08.710 --> 00:09.600
white and code.

00:09.810 --> 00:12.770
So what we can do is we can create a new package.

00:12.780 --> 00:20.220
Let's do that let's say in no so we already have sorry we already have to package out here in databases.

00:20.310 --> 00:22.440
But we're here let's say a new trial.

00:22.460 --> 00:27.330
We can just open it up and say this is for connecting

00:30.300 --> 00:33.030
to escalate.

00:33.130 --> 00:33.410
Right.

00:33.450 --> 00:39.370
So we can have that and we can you know we can just work on it.

00:39.540 --> 00:44.020
We just will we'll work on this quite naturally or we can just close it up.

00:44.340 --> 00:44.800
Correct.

00:44.790 --> 00:51.600
So in this particular connecting to escalate what we need to do is before the Fall need to import the

00:51.600 --> 00:53.580
escalatory library.

00:53.640 --> 00:55.680
So I hope we do that along with me.

00:55.680 --> 00:57.950
So first you pulled the escalatory.

00:58.080 --> 01:03.470
And then escalated three dot talked.

01:03.630 --> 01:09.140
You need to use this connect which means to connect to a it later.

01:09.150 --> 01:12.760
Now if the data exists well and good it will connect to that same database.

01:12.990 --> 01:16.110
If it doesn't it will create a new one.

01:16.140 --> 01:27.020
Let's get it up with cholesterol it or let me created this I'm creating you know the results of a school.

01:27.150 --> 01:30.460
OK discretely so I can create.

01:30.520 --> 01:37.430
So because I'm connecting I'm going to get a connection which I need to use whenever I want.

01:37.480 --> 01:45.430
Let me say this connection help will help me to get something called a CASA so you can have a look.

01:45.430 --> 01:52.960
So a connection Dacosta this Koso will help me whenever this particular Koso which I get from a particular

01:52.960 --> 01:58.930
connection will help me whenever I want to point to a particular point in the table if I want to point

01:58.930 --> 02:01.430
everything then I get everything to be pointed.

02:01.600 --> 02:06.010
So this goes there's something there which guides me to all the entire database.

02:06.100 --> 02:06.760
Right.

02:06.850 --> 02:13.780
Or if you want to execute a particular staying you want to execute a particular queries then the cursor

02:13.780 --> 02:19.670
is used for executing it by writing cursor dot cursor dot execute.

02:19.810 --> 02:21.320
So that's where you're right.

02:21.550 --> 02:26.550
This particular cursor comes in a user you have to execute queries that we need to fire.

02:26.560 --> 02:31.900
So let's say for example in school I want to create a database I want to create a table of surance and

02:31.900 --> 02:33.730
I want to create a table of teachers.

02:33.970 --> 02:42.320
So what I need to do is I need to have a query so every school command is called a secretary right.

02:42.360 --> 02:47.540
So I'm going to have a terrible string so that it's a multi-line string.

02:47.550 --> 02:50.730
Ok so I'm going to say we here create

02:54.510 --> 03:01.070
create table student write create table student.

03:01.730 --> 03:04.200
Oh we're sorry.

03:04.680 --> 03:10.040
So a student will have a role limbo will have a name Chenda.

03:10.290 --> 03:11.190
OK.

03:11.260 --> 03:21.830
And let's say gender and some general let's say it has DRP.

03:21.880 --> 03:22.570
That's the data.

03:22.610 --> 03:28.190
But so there's something which every student to now will have.

03:28.190 --> 03:34.370
So you create this but then when you say that you also need to say what though what are the types of

03:34.370 --> 03:38.250
the what are the data types of each of them role number is going to be in teacher.

03:38.660 --> 03:39.130
Right.

03:39.130 --> 03:42.830
One number is going to be one in Teacher Name is going to be RADICH at

03:46.180 --> 03:47.920
20.

03:47.920 --> 03:50.200
Gender is going to be again a lot of care.

03:50.260 --> 03:58.200
But Lancair which consists of only one and dear Beacon's is still the right.

03:58.210 --> 04:01.250
Our teacher the kind we can use any one of them.

04:01.600 --> 04:04.800
So deal becomes is to date.

04:04.810 --> 04:07.620
So there's a query we have fired the QUERIDO.

04:07.750 --> 04:09.540
You've just written that in a string.

04:09.610 --> 04:16.650
This particular query of course needs to every query and will complete with the semi-colon.

04:16.660 --> 04:19.500
Now this particular query we need to fire we need to execute.

04:19.500 --> 04:27.300
So when you say cursor execute Kraddick you say that course Rexy could query.

04:27.540 --> 04:35.460
And also after you execute a particular query you can create another query for you know one for Student

04:36.060 --> 04:37.570
1 for a teacher.

04:37.650 --> 04:40.480
OK so I create a table.

04:40.730 --> 04:41.370
One is

04:44.130 --> 04:48.250
let me create in students students and teachers.

04:48.300 --> 04:52.900
This time they will not have a roll number but they will have an ID.

04:53.310 --> 04:55.800
They will have a name they love and they love it.

04:55.850 --> 04:56.660
Yes.

04:57.060 --> 05:07.030
So these are a few things so I'll execute that to curse or not execute and let me just fire a few.

05:07.320 --> 05:11.710
Let me just fire a few commands where I need to keep batting.

05:11.880 --> 05:17.410
I need to keep adding different students and teachers one after the other.

05:17.430 --> 05:21.060
So let me say I just create new craze.

05:21.330 --> 05:33.610
So let me say Querrey is you know insert into students and so did the students.

05:33.660 --> 05:44.630
Well let me say I just want to insert a rule number you know named and gender for now I don't want their

05:44.870 --> 05:47.060
well currently in the industry.

05:47.070 --> 05:55.510
And so all of these values are going to be let's say 12 Qamar x y z.

05:55.700 --> 05:56.790
Now that's in a double code.

05:56.790 --> 06:03.050
That's why you need to have a triple core each of single over here as you can see each of these are

06:03.050 --> 06:07.930
symbols so so that I can have a double code inside because the name strings and everything and an Escuela

06:08.030 --> 06:10.220
requires a double code inside.

06:10.340 --> 06:12.160
Otherwise you wouldn't be able to escape it.

06:12.260 --> 06:12.850
Right.

06:12.910 --> 06:23.750
So unless you put a backslash and Chander let's say the first one is male and we can close that values.

06:24.090 --> 06:27.020
And of course put a semi-colon.

06:27.450 --> 06:29.910
Of course after that you need to execute it.

06:30.360 --> 06:32.380
So let's execute this query.

06:32.700 --> 06:41.370
And from now on you can just copy both of these and keep executing them again and again for around 5

06:41.370 --> 06:42.590
6 times.

06:42.930 --> 06:44.750
Each of them over here.

06:44.760 --> 06:46.290
This is sturgeons.

06:46.470 --> 06:56.980
So all values roll number one can be 45 another can be 50 for this we can have 4 teachers straight.

06:57.000 --> 07:00.570
So we can have teachers here teachers

07:03.350 --> 07:09.560
teachers are going to have the name and gender ID name and gender.

07:09.560 --> 07:13.520
So this is what teachers are going to have.

07:13.550 --> 07:17.590
So we are going to copy paste that for four teachers.

07:17.610 --> 07:18.220
Right.

07:18.500 --> 07:24.960
So that's about students and teachers So here we have all the students being added.

07:25.010 --> 07:27.280
The other one is an exercise student.

07:27.290 --> 07:42.520
Another is a BQ you are there is a ABC OK and of course you're having one female or two females in teachers

07:42.530 --> 07:47.350
you have you have a male sir.

07:47.690 --> 07:51.730
You know you have a female teacher and again you have a male teacher.

07:52.100 --> 08:07.120
So let's say you have you know x x u b w x y or something like that x y are not x you receive the q

08:07.110 --> 08:10.040
r r SD.

08:10.160 --> 08:12.890
And let's have this as DPF.

08:13.100 --> 08:16.640
So you have these teachers being inserted.

08:16.640 --> 08:21.220
Each of them have a different word ID 12 13 and 14.

08:21.560 --> 08:23.980
OK so you're going to execute each of them.

08:23.990 --> 08:29.330
But after you execute you need to come in that whatever has been done to this particular connection

08:29.330 --> 08:35.550
needs to be committed or else the changes will be made connections that come at and after you do connection

08:35.540 --> 08:42.250
that come out you can do a connection that close OK.

08:42.380 --> 08:47.200
So this is quite quite a part about dealing with databases.

08:47.210 --> 08:49.730
It's nice you can run this out when you run it.

08:49.940 --> 08:55.090
Will be executed if you would like to have a look see that is a school for DP which is already open

08:55.090 --> 08:57.280
in the database.

08:57.320 --> 08:59.300
You know in the databases folder.

08:59.510 --> 09:06.950
So where does the database folder the side it it resides in the colon by Chelm project's colon databases.

09:06.950 --> 09:10.880
So if you want to open them you need to go to it's now in C.

09:11.060 --> 09:13.660
So any change Eric treated the colon

09:16.150 --> 09:19.430
colon data colon.

09:19.450 --> 09:20.470
What does that equal.

09:20.470 --> 09:29.010
And quite some projects ops by chum projects slash

09:31.490 --> 09:32.750
databases.

09:32.940 --> 09:39.380
So data bases right into the system.

09:39.680 --> 09:44.330
OK so let me just enter into just my chum projects.

09:44.390 --> 09:46.510
Let me see did I was not there.

09:51.080 --> 09:55.760
OK so you have entered all in that there is one more Peacham projects.

09:55.770 --> 10:00.450
So you need to go into quite some projects yet again.

10:00.730 --> 10:02.870
OK so are there.

10:02.870 --> 10:10.470
So is there something simple one it wants to fight and frailty is this.

10:10.510 --> 10:11.420
Oh yes yes.

10:11.440 --> 10:17.320
There is an advanced bited Fridays a CD had von Spuyten for I ot our

10:21.860 --> 10:26.590
well there are no directory's as such.

10:26.630 --> 10:28.520
We need to deal with them.
