The DELETE statement is used to delete rows from an Oracle table. Syntax: DELETE FROM table_name [WHERE condition]; DELETE can delete all rows, delete rows based on conditions, or use subqueries to delete rows; note that DELETE cannot be undone, please back up the data before execution, and it may take a long time to complete for large tables operate.
DELETE statement in Oracle
What is the DELETE statement?
The DELETE statement is used to delete rows from an Oracle table.
Syntax:
<code>DELETE FROM table_name [WHERE condition];</code>
Where:
table_name
: The name of the table from which rows are to be deleted. WHERE condition
(optional): Condition clause used to specify which rows to delete. How to use DELETE statement?
<code>DELETE FROM table_name;</code>
<code>DELETE FROM table_name WHERE condition;</code>
For example, to delete all rows with a salary less than 10,000 from the employees
table, you can use the following statement:
<code>DELETE FROM employees WHERE salary < 10000;</code>
The DELETE statement can be used with a subquery to delete rows based on conditions in other tables. For example, to delete orders from the orders
table that do not have any shipped status, you would use the following statement:
<code>DELETE FROM orders WHERE order_status NOT IN (SELECT order_status FROM order_statuses WHERE is_shipped = 1);</code>
Note:
The above is the detailed content of How to use delete in oracle. For more information, please follow other related articles on the PHP Chinese website!