数据库基本操作3——筛选where

一,语法

select 查询列表

from 表名

where 筛选条件

二,筛选条件的分类

1,简单条件运算符

> < = != >= <= <=>安全等于 <>不等于

示例:select * from employee where salary>10000

2,逻辑运算符

&& and

|| or

! not

示例:select * from employee where salary>10000 and salary<20000

3,模糊查询

like

示例:select * from employee where name like '%a%';(name中包含a的显示出来)

select * from employee where name like '__a%';(name中第三个字母是a的显示出来

注:%匹配任意个字符,_匹配任意单个字符,可以用 \ 进行转义

between and

示例:select * from employee where salary between 10000 and 20000

in

示例:select * from employee where salary in {10000,11000,12000};

is null(用来判断null值,=不能判断null值,<=>可以判断null值)

is not null

猜你喜欢

转载自blog.csdn.net/weixin_44841312/article/details/105855965