We can use DROP COLUMN with ALTER tag to delete a column from a table.
Considering the below table. We can see that there are two columns that contain NULL values.
To remove those columns that contain NULL values, refer below:
1. Oracle Drop Single Column
Syntax:
ALTER TABLE table_name
DROP COLUMN column_name ;
Example:
ALTER TABLE Stu
DROP COLUMN lname;
Output:
After running the Select command we will get the output as follows:
2. Oracle Drop Multiple Columns
Syntax:
ALTER TABLE table_name
DROP( column1, column2);
Example:
ALTER TABLE Stu
DROP( max_Marks,lname);
Output:
The final table with which we are left is shown below, you can observe column max_Marks and lname does not exist in table now.