Recently I have started learning Oracle-sql
. I know that with the help of DELETE
command we can delete a particular row(s). So, Is it possible to delete entire data from a particular column in a table using only DELETE
command. (I know that using UPDATE
command by setting null values to entire column we can achieve the functionality of DELETE
).
Right-click on the table and go to Design. It shows all column of a particular table. Right-click on the left-hand side of a column and you get option Delete Column. Click on it to delete a column.
DELETE
The DELETE statement removes entire rows of data from a specified table or view
If you want to "remove" data from particular column update it:
UPDATE table_name
SET your_column_name = NULL;
or if column is NOT NULL
UPDATE table_name
SET your_column_name = <value_indicating_removed_data>;
You can also remove entire column using DDL:
ALTER TABLE table_name DROP COLUMN column_name;
Use Invisible Type, which is from an oracle 12cR2.
ALTER TABLE LOG1
MODIFY operation INVISIBLE
It is a better than drop of a particular column.If you need to visible you can get back by altering with an VISIBLE
of a column name.
In SQL, delete
deletes rows not columns.
You have three options in Oracle:
NULL
using update.The last two use alter table
:
alter table t drop column col;
alter table t set unused (col);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With