SQL或捷径?

时间:2015-03-22 19:23:22

标签: sql

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

有没有办法缩短这个?也许是一种使用正则表达式的方法?

1 个答案:

答案 0 :(得分:24)

您需要in运算符:

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