hc学习平台

 找回密码
 立即注册
搜索
热搜: 活动 交友 javakc
 › zhangjiafu › 日志

逻辑函数:根据教材中的user表、card表、transInfo表进行查询

2021-01-07 12:37:05 查看(759) 回复(0)

功能要求如下:

  1. 展示user表的数据信息,要求credit>300显示优质客户,credit>200显示中等客户,credit<200显示一般客户
  2. 展示user表的数据信息,要求将city字段值,转换后显示,北京->首都,上海->魔都,深圳->特区,其他->省会
  3. 展示user表的数据信息,如果有英文名,展示其英文名;没有英文名,展示“无”
  4. 展示user表的数据信息,要求展示人员出生年代,比如1979年出生的,显示为“70后”;1985年出生的,显示为“80后”;1993出生的,显示为“90后”

select *,(case when credit>300 then '优质客户' when credit>200 then '中等用户' else'一般用户' end )  客户分类 from user

select * ,(case city when '北京' then '首都' when '上海' then '魔都' when '深圳' then '特区' else '省会' end) 城市 from user

select *,ifnull(ename,'无') from user

select *, substring(personId,7,4) x from user


select *,(case when x>='1990' then '90后' when x>'1980' then '80后' when x>'1970' then '70后' else '00后' end) from (select *,substring(personId,7,4) x from user) a


评论 (0 个评论)

facelist

全部作者的其他最新日志



站点统计|举报|Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, , Processed in 0.195171 second(s), 9 queries .

Powered by javakc! X1.0

© 2004-2014 javakc

f1208.com 备案号:京ICP备14030918号-1

返回顶部