SELECT id, name, city
FROM people
WHERE title = 'Manager' OR city = 'Boston' OR HireDate > '1/25/04'
How can I rewrite this SQL statement to not use OR statements in the WHERE clause and make it as efficient as possible? Its an interview question.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Suthish NairRank #92 · 22.8K reputationPosted Feb 11, 2011, 8:29 PM EST
Justin N18 reputationPosted Feb 12, 2011, 7:39 AM EST
Assuming a large table with indexed search fields, rewrite the given query to not use OR statements in the WHERE clause. Try to make it as efficient as possible.
SELECT id, name, city
FROM people
WHERE title = 'Manager' OR city = 'Boston' OR HireDate > '1/25/04'
SELECT id, name, city
FROM people
WHERE title = 'Manager' OR HireDate > '1/25/04'
this is the exact question