WEBVTT

00:07.850 --> 00:11.660
I'll call you back again for another video lecture on PostgreSQL.

00:11.660 --> 00:17.570
And in this video, let's go ahead and learn how to delete one more of this item.

00:17.570 --> 00:23.960
And we're going to reset this item to start sequentially from 1 to 3.

00:23.960 --> 00:25.070
And so on.

00:25.100 --> 00:28.460
Now let's go ahead and delete the last one which is Sarah.

00:28.460 --> 00:30.140
So we can be able to add.

00:30.170 --> 00:34.580
And it's going to continue for 123456 and so on.

00:34.580 --> 00:39.080
Now go ahead and delete it because we have learned how to use the delete keyword.

00:39.080 --> 00:42.260
So delete from.

00:45.200 --> 00:46.070
Students.

00:46.100 --> 00:55.610
And we're going to delete our where the students underscore ID is equal to four.

00:55.640 --> 00:58.610
And let's go ahead and hit enter.

00:58.610 --> 00:59.810
And that is deleted.

00:59.840 --> 01:02.320
Go right in here and let's check it out.

01:02.320 --> 01:04.780
And the ID four is gone.

01:04.990 --> 01:11.920
Now, if I should go ahead and enter another, uh, student that is going to start from six.

01:11.950 --> 01:12.550
All right.

01:12.580 --> 01:13.840
Let's go ahead and see.

01:13.840 --> 01:18.970
I want to add, uh, maybe another student.

01:19.000 --> 01:20.350
Let's go ahead and check it out.

01:21.310 --> 01:24.850
So I'll go back here or I will start from here and one of them.

01:24.850 --> 01:26.200
So let me go ahead and use this.

01:26.200 --> 01:32.590
So I'm going ahead and say insert into students.

01:32.590 --> 01:35.530
And I'm going to specify the columns.

01:35.560 --> 01:38.980
That is the first underscore name.

01:38.980 --> 01:42.730
And uh last underscore name.

01:42.730 --> 01:45.760
Because these are not going to be null.

01:45.760 --> 01:50.230
And in the next one we have is our enrolled date and email.

01:50.230 --> 01:57.520
So let's go ahead and say enroll underscore date and email.

01:57.550 --> 01:57.940
All right.

01:57.940 --> 01:59.560
So go ahead and close this.

01:59.770 --> 02:02.020
And then we're going to add values.

02:02.020 --> 02:03.910
So the next one is the values.

02:03.910 --> 02:05.920
So I'm going to say the values.

02:05.920 --> 02:08.200
So I want to give the value of the first name.

02:08.200 --> 02:14.770
When we say the first name is going to be George and the next one is going to be Steve.

02:14.800 --> 02:18.070
Remember it's going to be under the quotation mark.

02:19.840 --> 02:27.340
And uh, the erode date is going to be 2092.

02:28.180 --> 02:28.480
Okay.

02:28.510 --> 02:30.130
So it's going to be date.

02:30.250 --> 02:31.600
Enter the date.

02:31.600 --> 02:39.580
And there was a 2092 and ten maybe 27.

02:40.930 --> 02:42.640
And the next one is the email.

02:42.670 --> 02:50.920
So I'm going to say this is uh Steve at uh yahoo.com.

02:51.730 --> 02:52.120
All right.

02:52.120 --> 02:57.490
So and this email should also be inside the quotation.

02:57.490 --> 03:02.700
So G Steve at Law.com.

03:04.890 --> 03:07.530
All right, now we'll go ahead and close this.

03:08.130 --> 03:12.870
I'll put a semicolon at the end, and now I can go ahead and hit enter.

03:12.870 --> 03:14.130
And we have a sorted list.

03:14.160 --> 03:15.690
Now let's go ahead and check this out.

03:16.740 --> 03:22.290
So you can see that this started from six because we've deleted a four and five.

03:22.440 --> 03:31.500
And the six or the third one was actually deleted when it wanted to insert in a row, which doesn't

03:31.500 --> 03:36.540
have, uh, the email or the ID.

03:37.080 --> 03:43.800
Now let's go ahead and say I'm going to reset this so that it can start from one, two and three instead

03:43.800 --> 03:47.220
of jumping to 6 or 7 if I insert another one.

03:47.220 --> 03:50.010
So go ahead and delete this last one now.

03:50.010 --> 03:53.670
So first of all let me go ahead and use the delete keyword.

03:53.670 --> 04:00.390
So delete uh from to go ahead and say delete from students.

04:03.360 --> 04:06.450
And um, where the ID.

04:10.230 --> 04:16.230
We are students underscore ID is equal to six and hit enter.

04:16.230 --> 04:18.480
And now let's go back and check it out.

04:18.690 --> 04:19.860
We have deleted it.

04:19.890 --> 04:26.100
Now if we want to set this what I need to do is I'll go back here and I'm going to show this request.

04:26.130 --> 04:28.560
Now this is what is giving the problem.

04:28.560 --> 04:33.720
This is because it's doing this based on the numbers that have been added.

04:33.720 --> 04:39.420
So if you add multiple times which you always go back, what I'm going to make this to start from the

04:39.450 --> 04:41.370
number which is the highest number.

04:41.370 --> 04:42.180
And that is two.

04:42.210 --> 04:44.190
Or if it is three or 4 or 5.

04:44.190 --> 04:48.990
So we want to select the maximum number to start from the maximum number of variables on the database.

04:48.990 --> 04:58.500
And if I want to do that or I need to do is to reset the PostgreSQL table sequence which is this the

04:58.500 --> 04:59.220
workplace?

04:59.250 --> 05:05.130
And if I want to do that, I'll go right in here and I'm going to say select.

05:06.090 --> 05:08.160
Then I want to set the value.

05:08.160 --> 05:11.970
And then I'll go ahead and copy this.

05:13.230 --> 05:14.070
Copy this.

05:14.250 --> 05:18.210
And I'm going to put that inside quotation mark.

05:18.270 --> 05:19.320
Then put a comma.

05:20.310 --> 05:26.400
Then I'll go ahead and select from the maximum.

05:26.400 --> 05:37.950
So select from the maximum ID because that is very very important from students.

05:37.980 --> 05:38.820
All right.

05:38.850 --> 05:43.620
And now you go ahead and uh close this.

05:43.650 --> 05:45.210
Put a semicolon at the end of this.

05:45.210 --> 05:46.650
And let's hit enter.

05:46.650 --> 05:49.890
And it says caller ID does not exist.

05:49.920 --> 05:50.340
All right.

05:50.370 --> 05:55.950
So this is supposed to be uh, students underscore ID and I just said ID.

05:56.340 --> 05:56.970
All right.

05:57.000 --> 06:02.900
Now go ahead and do that again or I need to do.

06:02.930 --> 06:03.290
Okay.

06:03.320 --> 06:13.040
Let's go ahead and select a set vowel and the core head under.

06:13.070 --> 06:16.460
Push this which we copied before and put a comma.

06:16.700 --> 06:32.840
And I'm going to say select a maximum from students not just ID from students underscore ID all right.

06:33.110 --> 06:37.010
Students underscore ID from students.

06:37.100 --> 06:38.960
And now plus semicolon at the end.

06:38.990 --> 06:41.270
Now let's go ahead and check out this.

06:41.270 --> 06:43.490
Now set interval two.

06:43.520 --> 06:44.240
All right.

06:44.270 --> 06:46.640
Now we have set this interval.

06:46.670 --> 06:55.250
What we need to do is let's go ahead and uh enter again and went to and set this value again.

06:55.250 --> 06:58.780
So we're going to copy this value which we deleted previously.

06:58.780 --> 07:01.660
And I'll go back in here and press that.

07:02.080 --> 07:05.860
Hit enter and I'll copy the second value right in here.

07:08.650 --> 07:10.840
And I'll go right in here.

07:10.870 --> 07:11.770
And paste that.

07:11.770 --> 07:13.570
Now let's go ahead and hit enter.

07:13.570 --> 07:15.520
And now with inserted this go.

07:15.550 --> 07:16.450
Back right in here.

07:16.450 --> 07:18.310
And now execute this.

07:18.310 --> 07:22.480
And now you can see that Steve is now studying from.

07:22.510 --> 07:25.150
Three and no longer 6 or 7.

07:25.150 --> 07:28.030
So for now always if I add numbers it's going to.

07:28.060 --> 07:30.070
Start from 345 know.

07:30.070 --> 07:31.900
So let's go ahead and add one more number.

07:31.930 --> 07:37.060
So I'm going to copy this I'm going to copy the first one then.

07:37.150 --> 07:45.010
And I'm going to leave the last one now I'm going to set my values to different values okay.

07:45.040 --> 07:51.700
So let me say we have the first name to be zindar.

07:54.580 --> 07:56.410
So the first name is Zindar.

07:56.650 --> 08:00.970
And, uh, the last name is, uh.

08:01.000 --> 08:02.020
Hello.

08:02.200 --> 08:06.460
And, uh, the next one is the dates.

08:06.490 --> 08:08.650
So the dates is.

08:08.680 --> 08:13.180
Equal to 2091.

08:13.360 --> 08:13.960
All right.

08:13.990 --> 08:22.810
And, uh, we say 505 is the month, and, uh, 20 is the day.

08:23.800 --> 08:29.710
So right on the plus this, I thought this is supposed to be inside the quotation.

08:30.220 --> 08:37.840
And let me say 20, 91, zero 520.

08:38.140 --> 08:45.670
So put a comma and uh, we're going to leave the email or we go back and delete this email because we

08:45.670 --> 08:47.680
added this column because we added a column.

08:47.680 --> 08:51.460
Let's go ahead and said email is going to be Zen.

08:54.250 --> 08:55.630
Zen.

08:55.810 --> 09:02.170
Hello at, uh, zoho.com.

09:03.340 --> 09:03.730
All right.

09:03.760 --> 09:05.680
Go ahead and close this up.

09:05.680 --> 09:09.340
Put a semicolon at the end of this square here and hit enter.

09:09.340 --> 09:12.100
And we have entered that.

09:12.130 --> 09:15.130
Now come back in here and execute this.

09:15.130 --> 09:22.330
And you can see we have this situation and this is now three and four.

09:22.330 --> 09:23.620
So I hope that is cool.

09:23.620 --> 09:25.600
So go ahead and reset this.

09:25.630 --> 09:31.390
If you have not programmed maybe you have deleted something and it's moving from the next one.

09:31.390 --> 09:37.000
You go ahead and set the interval to start from the maximum ID on the table.

09:37.030 --> 09:37.870
I hope that is cool.

09:37.870 --> 09:39.850
So check it out and practice with it.

09:39.880 --> 09:43.180
If you have any questions, go ahead and use the question and answer section.

09:43.180 --> 09:45.730
And I'm going to get back to you as soon as possible.

09:45.760 --> 09:49.510
Thank you so much and I'm good to see you in the next video lecture.
