Gates VVang
Gates VVang

Reputation: 113

SQL or short cuts?

SELECT * FROM nobel
WHERE winner = 'Theodore Roosevelt' or winner = 'Woodrow Wilson' or winner = 'Jed Bartlet' or winner = 'Jimmy Carter';

Is there a way to shorten this? Perhaps a way to use regex?

Upvotes: 11

Views: 373

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269803

You want the in operator:

SELECT n.*
FROM nobel n
WHERE n.winner IN ('Theodore Roosevelt', 'Woodrow Wilson', 'Jed Bartlet', 'Jimmy Carter');

Upvotes: 25

Related Questions