条件表达式筛选:
简单的条件运算符: > ,<, =, !=,<>,>=,<=
逻辑表达式筛选:
逻辑运算符
&&, || ,! ,
and, or ,not
模糊查询:
like
between and
in
is null
mysql中的+号只有一个功能:运算符功能(一定是可以运算的才能是使用)
select 100+12 #都为整型可以进行运算
select '123'+10 #试图把'123'转换成整型
select '123'+10 #试图把'jay'转换成整型,若成功则继续进行计算,不行的一方变为0;
select 'null'+10 #只要有null 则为null
取别名:
1.可以使用 AS关键字
select 100 AS "out_put"
2.空格隔开
select 100 out_put
拼接字符串显示
select concat('firstname','lastname') AS "out_put" from userinfo
#以/为分割符号
select concat('firstname','/','lastname') AS "out_put" from userinfo
去重:
查询员工部门 在员工信息表内
select distinct department from employee
着重标记
#标记为非关键字而是普通字串
select `name` from userinfo
在DBMS中使用sql语句时先在顶部写上
#使用的数据库名
use userDB
查询的列表可以是:
①表中的字段
②常量值
③表达式
④函数
查询的结果可以是一个虚拟的表格