SQL之条件查询(高级数据过滤)

1、组合WHERE子句

  1.1、AND操作符 

1 select
2 col_name
3 from
4 table_name
5 where
6 col_name = 'str'
7 and
8 col_name2 = 'str';

  1.2、OR操作符

1 select
2 col_name
3 from
4 table_name
5 where
6 col_name = 'str'
7 or
8 col_name2 = 'str';

2、IN操作符

1 select
2 col_name
3 from
4 table_name
5 where
6 col_name
7 in 
8 ("str", "str");

3、NOT操作符

  where子句中的NOT操作符有且只有一个功能,就是否定其后所跟的任何条件

1 select
2 col_name
3 from
4 table_name
5 where
6 not
7 col_name = "str";

 

热门相关:最强狂兵   薄先生,情不由己   大神你人设崩了   寂静王冠   第一神算:纨绔大小姐