mysql数据库语法学习----4

#isnull()函数
select ISNULL(a.commission_pct),commission_pct from employees a; --判断结果时候为空,为空的话就显示1,类似于true,不为空的话就显示0,类似于false

 

#这样写导致查询出来的结果都是不规则的,所以会报错
select distinct department_id,distinct salary from employees;
#这样写是对的,但是department_id会显示重复的数据
select distinct department_id, salary from employees;

猜你喜欢

转载自www.cnblogs.com/dongyaotou/p/12300007.html
今日推荐