I have a table with several columns. Columns 1and 2 can contain any of four alpha values: set={A,B,C, D}.
I want to check if each column to see if they contain either of two values from the set. So I want to simplify this statement:
SELECT * FROM MUTATION-TABLE WHERE (COLUMN1 = "A") OR (COLUMN2 = "A") OR (COLUMN3 = "A")
OR (COLUMN1 = "B") OR (COLUMN2 = "B") OR (COLUMN3 = "B").
Is there a way to simplify this statement. As I add more columns, there will be more mutations to check. I can see the SQL statement getting long/repetitive.
If you only have two values to but lots of columns, then switch to
INand check for your constant values in a set of columns:And with more columns:
The queries should be the same as far as the database is concerned but this version might be more readable.