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";

 

posted on 2022-09-30 16:29  默玖  阅读(58)  评论(0编辑  收藏  举报

导航