SELECT * FROM nobel
WHERE winner = 'Theodore Roosevelt' or winner = 'Woodrow Wilson' or winner = 'Jed Bartlet' or winner = 'Jimmy Carter';
有没有办法缩短这个?也许是一种使用正则表达式的方法?
答案 0 :(得分:24)
您需要in
运算符:
SELECT n.*
FROM nobel n
WHERE n.winner IN ('Theodore Roosevelt', 'Woodrow Wilson', 'Jed Bartlet', 'Jimmy Carter');