Reputation: 331
How can I drop a table in oracle, but I want to use a where condition in the query; for example:
drop table employees where employee_id='100';
Is this possible or not?
Upvotes: 2
Views: 835
Reputation: 697
If you need to drop a table there is no need of checking some conditions.
If you need to specify where clause you are probably looking for deleting some rows. Better use delete.
Using condition to check for dropping a table is a new thing and i am gonna try it now.
Upvotes: 2
Reputation: 52853
You're not looking to DROP
the table; dropping the table removes the entire table and all data therein.
It appears as though you want to remove some rows from the table. If this is the case you should use the DELETE
statement:
delete from employees where employee_id = 100;
It might be worth investigating some basic functionality or taking a course before continuing.
Incidentally, 100 is a number. Using '
implies that it's a string. If the datatype of the column EMPLOYEE_ID is a number you don't need to quote it.
Upvotes: 11