纯小白解题思路(轻喷)
题库链接:SELECT from Nobel Tutorial - SQLZOO
原题如下:
14.The expression subject IN ('Chemistry','Physics') can be used as a value - it will be 0 or 1.
Show the 1984 winners and subject ordered by subject and winner name; but list Chemistry and Physics last.
解题思路:
1、首先查询一下subject IN ('Chemistry','Physics')运行后是什么结果
(虽然原题已给提示,但自己还要缕清思路)
代码如下:
select winner,subject,subject in ('chemistry','physics') from nobel
where yr='1984'
查询结果:

本文介绍了如何使用SQLZoo中的一个练习题来理解`ORDER BY`语句与`subject IN ('Chemistry', 'Physics')`表达式的用法。通过查询示例,解释了当`subject`属于'Chemistry'或'Physics'时返回1,否则返回0的逻辑,并展示了如何结合`ORDER BY`进行升序排序,以将'Chemistry'和'Physics'排在其他学科之后。"
123788851,10034881,Yandex邮箱:应用专用密码设置指南,"['邮件服务', '邮箱设置', '网络安全', '外贸邮箱', '俄罗斯市场']
最低0.47元/天 解锁文章
3699

被折叠的 条评论
为什么被折叠?



