You can use the IN
predicate, like so:
SELECT * FROM table WHERE 123 IN(col1, col2, col3, col4);
SQL Fiddle Demo
it’s the opposite version of IN.
No it is not, It is the same as using the OR
s the way you did in your question.
To clarify this:
The predicate IN
or set membership is defined as1:
Where the Value Expression
can be either 2:
So it is fine to do it this way, using the value expression 123
, which is a literal.
1, 2: Images from: SQL Queries for Mere Mortals(R): A Hands-On Guide to Data Manipulation in SQL