SQL DROP TABLE
We will discuss in this tutorial, how can we drop a column and table?
Where not only the column but also we can drop the table also, let me just show you how can we use this drop column?
We will not have something called a drop table, where drop table command is different and drop a column is different. So this is where I wanted to show you the differentiation before I am going to show you. How can we drop a table? I wanted to show you. How can we drop a column?
How can we drop a column?
Syntax:
ALTER TABLE table_name
DROP COLUMN column_name;
Example:
select * from users;Once you select all the columns from the users table you could see even mobile is there but I wanted to intentionally drop the mobile column to drop a column. I’m going to use the same alter command.
Output:

In users drop column, give your column name which is a mobile as my column name.
alter table users drop column mobile;select * from users;Output:

The table is successfully altered. There was no column name mobile over here.
How can we drop a table?
For this we will create a new table and I will show you whether the table was dropped or not.
Example:
create table test( id number,
name varchar2(10))

The table called test is already there now. So now what I wanted to show you is whenever we wanted to drop this one drop table.
Output:

Syntax:
drop table test;When I use the above command you can see there is no Test table. It has been dropped.

One more important point that I wanted to discuss here is when this table has a dependency. You will get hit with an error not only here but also here when you wanted to drop a column you need to ensure that whether it is having any sort of dependencies or not.
What do you mean by a dependency?
When you have a foreign key column or a primary key column, which is associated with column name in another table.