How to delete several values in SQL?

oracle, sql

Solution

You can use the SQL `IN` keyword. For example:

DELETE FROM my_table WHERE id IN (23, 17, 64) AND year=2012 AND value=16

Note: Oracle has a limit of 1,000 items in a list.

Problem

I know how to delete a set of rows with a statements like these: ``` DELETE FROM my_table WHERE id=23 AND year=2012 AND value=16 DELETE FROM my_table WHERE id=17 AND year=2012 AND value=16 DELETE FROM my_table WHERE id=64 AND year=2012 AND value=16 ``` But I would like to combine the above three statements into a single DELETE where id is either 23, 17, or 64. What is the syntax for doing this in Oracle SQL?

Original source