WEBVTT

00:07.790 --> 00:11.240
I welcome you back again to the lecture on PostgreSQL.

00:11.240 --> 00:14.570
And let's go ahead and learn how to drop the database.

00:15.470 --> 00:15.770
All right.

00:15.800 --> 00:17.990
So what is a database called students.

00:17.990 --> 00:20.420
And we can actually drop that database.

00:20.420 --> 00:30.290
But this is a very dangerous command in PostgreSQL or in any SQL development or in database.

00:31.100 --> 00:38.060
Why is that a dangerous command is because something you've worked for over a long time can be deleted

00:38.090 --> 00:39.620
within a twinkle of an eye.

00:39.740 --> 00:46.310
So if we want to drop a database, you should always know that the database you want to drop is a database

00:46.310 --> 00:47.480
you don't need.

00:47.480 --> 00:50.450
So if it's a database that you need, you don't.

00:50.450 --> 00:55.490
Kohat just drop that because you're going to lose every information there.

00:55.490 --> 01:05.240
So imagine you have a database, uh, which contains millions of data, login details, passwords and

01:05.360 --> 01:07.580
email addresses and so many more.

01:07.580 --> 01:09.800
And you mistakenly drop that database.

01:09.830 --> 01:16.960
You cannot get that again, except you have a bug of some way which you can actually retrieve and work

01:16.960 --> 01:17.380
on.

01:17.410 --> 01:20.140
So let me go ahead and show you how to drop a database.

01:20.170 --> 01:24.160
Now go over here and let's go ahead and list all our database.

01:24.160 --> 01:30.220
So whenever you write backward slash L it means backward slash list.

01:30.220 --> 01:34.120
And if you click on that you're going to see every database you have.

01:34.150 --> 01:39.520
Now if I want to drop a database all I need to do is go ahead and save drop.

01:39.520 --> 01:41.920
And I'm going to see database.

01:41.920 --> 01:44.320
Then I'm going to give the name of the database.

01:44.320 --> 01:45.640
So overriding day.

01:45.640 --> 01:47.800
And I'm going to select student.

01:47.800 --> 01:50.020
And then put a semicolon at the end.

01:50.020 --> 01:52.150
And go ahead and hit enter.

01:52.300 --> 01:54.280
And your database will drop.

01:54.310 --> 01:54.880
All right.

01:54.880 --> 02:01.120
So that is coming off in a very soon it's going to drop he says error database student is being accessed

02:01.120 --> 02:02.110
by other users.

02:02.170 --> 02:05.230
That is one other session is in the database.

02:05.260 --> 02:05.740
All right.

02:05.740 --> 02:08.110
What I want is that I have my admin.

02:08.110 --> 02:15.580
And all I need to do is I can actually go ahead and close the admin, and then I'll open it up again,

02:15.580 --> 02:22.750
and then the database will be dropped because I'm running admin and I'm running the show as well.

02:22.750 --> 02:25.410
So go ahead and, uh, close this.

02:25.440 --> 02:26.760
Let's go ahead and close this.

02:26.760 --> 02:30.810
And it says, do you want to quit the application?

02:30.840 --> 02:31.620
Yes.

02:31.620 --> 02:35.550
And now let's completely go ahead and drop this database again.

02:35.550 --> 02:46.980
So go ahead and say drop that, uh, base and the student employee semicolon and go ahead and uh you

02:46.980 --> 02:48.900
can see drop database.

02:48.900 --> 02:55.380
So whenever you're using Pgadmin and uh SQL shell, these are two different applications.

02:55.380 --> 03:00.750
You either use the graphical interface, the application that is the admin is a graphical interface

03:00.750 --> 03:04.890
application where we can be able to actually do exactly the same thing we are doing right in here.

03:04.920 --> 03:06.930
I'm going to show you one example on that.

03:06.930 --> 03:12.060
So as time goes on, we're going to see an example of how to use the admin graphical user interface

03:12.060 --> 03:13.410
to write queries.

03:13.440 --> 03:14.070
All right.

03:14.100 --> 03:20.820
Now I'm going to also maintain the use of uh SQL in this course because that is one of the defaults

03:20.820 --> 03:26.070
that is most lovable that people use in writing PostgreSQL queries right now.

03:26.070 --> 03:33.120
If you go ahead and open Pgadmin over here, you can see I have only one and I have only Postgres that

03:33.120 --> 03:33.540
is here.

03:33.810 --> 03:34.530
All right.

03:34.530 --> 03:40.770
So the student database has been dropped and I can go back and create that database again.

03:40.800 --> 03:53.970
Go ahead and uh c create database and uh just to the inspiration icon and, and and I'm going to click

03:53.970 --> 03:55.740
on this and it creates a database.

03:55.740 --> 04:01.440
So you can see that why I open up this I was able to create a database because I'm doing a simple action

04:01.440 --> 04:03.030
that is acceptable.

04:03.060 --> 04:08.400
But what I wanted to drop this database, it let me know that this database is open somewhere showing

04:08.400 --> 04:10.680
that that command is very, very dangerous.

04:10.710 --> 04:15.240
Now I can go over here and refresh this and I'm going to see students.

04:15.420 --> 04:16.110
You see that.

04:16.110 --> 04:18.900
And the students database has been created again.

04:18.900 --> 04:23.310
So go ahead and uh create a third database and drop it.

04:23.310 --> 04:27.120
So you can actually learn how to drop a database in PostgreSQL.

04:27.120 --> 04:28.890
And that is very interesting.

04:28.890 --> 04:33.510
So if you have any question under this course, had I use the question and answer section, and I'm

04:33.510 --> 04:35.940
going to get back to you as soon as possible.

04:35.970 --> 04:36.930
Thank you so much.

04:36.930 --> 04:40.080
And I'm going to see you in the next video lecture.
