IN 与 = 的异同
- 相同点:均在WHERE中使用作为筛选条件之一、均是等于的含义
- 不同点:IN可以规定多个值,等于规定一个值
IN
SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...);
=
SELECT column_name(s) FROM table_name WHERE column_name=value1;
Atalanta
IN 与 = 的异同
IN
SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...);
=
SELECT column_name(s) FROM table_name WHERE column_name=value1;
盛夏之雪666
in 与 = 的转换
select * from Websites where name in ('Google','菜鸟教程');
可以转换成 = 的表达:
select * from Websites where name='Google' or name='菜鸟教程';