1
00:00:00,090 --> 00:00:07,560
We can use the same alter table statement to drop a column using altar table table name, drop column,

2
00:00:07,560 --> 00:00:09,030
and then a column name.

3
00:00:09,710 --> 00:00:17,480
And just like with AD where the column portion that is optional, the word column, of course the column

4
00:00:17,480 --> 00:00:19,870
name is required, but the word column is optional.

5
00:00:19,880 --> 00:00:26,600
If we look at drop keep going drop column, that is also optional.

6
00:00:26,840 --> 00:00:29,540
But I like to put it in there once again to be clearer.

7
00:00:29,990 --> 00:00:37,100
So let's drop the column from companies, This phone column right now, let's drop that.

8
00:00:37,250 --> 00:00:45,560
So it's as simple as alter table companies drop column phone, and that just has to be the name.

9
00:00:45,980 --> 00:00:48,890
It can fit on one line here that has to be the name of a column.

10
00:00:50,390 --> 00:00:50,870
All right.

11
00:00:50,870 --> 00:00:56,240
So if I describe companies, we should see no trace of the phone column anymore.

12
00:00:56,240 --> 00:00:58,400
It's just name, address, employee count.

13
00:00:58,400 --> 00:01:02,120
If I select star from companies, it's entirely gone.

14
00:01:02,540 --> 00:01:05,660
Now, that was a column full of null values.

15
00:01:06,050 --> 00:01:11,360
What if I dropped like, the name column or the address column or employee count?

16
00:01:11,360 --> 00:01:11,900
Let's do that.

17
00:01:11,900 --> 00:01:13,910
Employee count has values in it.

18
00:01:13,910 --> 00:01:14,990
It's not empty.

19
00:01:15,350 --> 00:01:17,000
Let's do drop.

20
00:01:17,770 --> 00:01:20,530
Column employee count.

21
00:01:20,530 --> 00:01:22,660
And of course, this has to be spelled exactly right.

22
00:01:22,660 --> 00:01:22,840
Right.

23
00:01:22,840 --> 00:01:24,820
If I misspell it, it can't find it.

24
00:01:24,820 --> 00:01:25,870
It gets me an error.

25
00:01:26,020 --> 00:01:31,210
But if I do employee count that had values in it.

26
00:01:31,210 --> 00:01:38,050
But my SQL doesn't care in the same way that when I drop a table or I drop an entire database, if there's

27
00:01:38,050 --> 00:01:39,550
stuff in there, it's gone.

28
00:01:39,970 --> 00:01:41,980
So same thing when I drop a column.

29
00:01:41,980 --> 00:01:48,790
Now, if I select star from companies, which really did drop those two columns, they are gone.

30
00:01:49,300 --> 00:01:51,820
So that's how we can use Ultra Table to drop columns.

31
00:01:51,820 --> 00:01:53,950
But there's even more we can do with it coming up.

