牛客网例题练习

SQL中使用where过滤空值

有三种方法:

  • Where 列名 is not null
  • Where 列名 != ‘null’
  • Where 列名 <> ‘null’

牛客网例题:
https://www.nowcoder.com/practice/08c9846a423540319eea4be44e339e35?tpId=199&tqId=1971218&ru=%2Fta%2Fsql-quick-study&qru=%2Fta%2Fsql-quick-study%2Fquestion-ranking

select device_id,gender,age,university from user_profile where age is not null

Where in 和Not in

现在运营想要找到学校为北大、复旦和山大的同学进行调研,请你取出相关数据。
https://www.nowcoder.com/practice/0355033fc2244cdaa09b2bd6e794c762?tpId=199&tqId=1971219&ru=%2Fexam%2Fcompany&qru=%2Fta%2Fsql-quick-study%2Fquestion-ranking&sourceUrl=%2Fexam%2Fcompany

select device_id,	gender,	age	,university	,gpa from user_profile where university="北京大学" or university="复旦大学" or university="山东大学"

# 使用not in 
select device_id,	gender,	age	,university	,gpa from user_profile where university not in ('浙江大学')


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值