题解 | #Where in 和Not in#

Where in 和Not in

https://www.nowcoder.com/practice/0355033fc2244cdaa09b2bd6e794c762

以下两个都可:

select device_id,gender,age,university,gpa from user_profile where university IN ("北京大学","复旦大学","山东大学");

select device_id,gender,age,university,gpa from user_profile where university NOT IN ("浙江大学");

最开始是用了where university="北京大学" AND university="复旦大学" AND university="山东大学"

会报错,所以是因为AND连接的条件不能是同一字段的?同一字段的多个要求就需要用到where 字段 IN("")或者where 字段 NOT IN("")?

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务