sqlzoo.net刷题
只发后面提升题目的题解,前面的太简单,写下来也没有意义
12.查找尤金•奧尼爾EUGENE O'NEILL得獎的所有細節 Find all details of the prize won by EUGENE O'NEILL
select * from nobel where winner ='EUGENE O\'NEILL'
题目推荐用两个‘符号来转义
个人还是推荐linux系统常用的转义符号\,这个基本上是类unix的传统
13.列出爵士的獲獎者、年份、獎頁(爵士的名字以Sir開始)。先顯示最新獲獎者,然後同年再按名稱順序排列。
这个对显示出来的字段有顺序要求,不能直接 select * from 否则会出错
select winner,yr,subject from nobel where winner like 'Sir%' order by yr desc ,winner asc
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.
这个题目没有中文,翻译的大概意思是 按照获奖的科学领域跟获奖者的名字来排序,但是 化学和物理要被排在最后
SELECT winner, subject FROM nobel where yr=1984 ORDER BY subject IN ('Physics','Chemistry'),subject asc,winner asc
这里分析一下,以后也用得上,关键在order by subject IN ('Physics','Chemistry') ,subject asc,winner asc
后两个比较容易理解 字段名加上asc表示按正常排序,难点在 subject in (xxx)这个表达式,
排除后两个表达式,这是一个分组排序,
subject in(xxx)为0的分成一组 排序
subject in(xxx)为1的分成一组 排序
得到结果连接起来就是新的排序表
sqlzoo.net刷题的更多相关文章
- sqlzoo.net刷题5
List the continents that have a total population of at least 100 million. 这题考察的是使用集聚函数生成表之后,如何过滤 一般我 ...
- sqlzoo.net刷题4
SELECT name, continent FROM world a WHERE population > ( FROM world b WHERE a.continent = b.conti ...
- sqlzoo.net刷题3
Find the continents where all countries have a population <= 25000000. Then find the names of the ...
- sqlzoo.net刷题2
Find the largest country (by area) in each continent, show the continent, thename and the area: 找到每个 ...
- LeetCode刷题系列
LeetCode 我们工作面试和提高自身数据结构和算法能力的时候往往需要刷刷题,我选择LeetCode是通过一个留学论坛了解的.专业,覆盖语种全面. 提前说说刷题的心得: 尽量手写代码,少使用IDE的 ...
- ife任务刷题总结(一)-css reset与清除浮动
本文同时发布于本人的个人网站www.yaoxiaowen.com 百度创办的前端技术学院,是一个面向大学生的前端技术学习平台.虽然只有大学生才有资格报名,提交代码进行比赛排名.但是这并不妨碍我们这些初 ...
- 刷题ING...
我用codeVS刷题.. 努力准备!!
- XidianOJ 1020 ACMer去刷题吧
题目描述 刷题是每个ACMer必由之路,已知某oj上有n个题目,第i个题目小X能做对的概率为Pi(0<=Pi<=1,1<=i<=n) 求小X至少做对k道题的概率 输入 第一行输 ...
- 【BZOJ-4590】自动刷题机 二分 + 判定
4590: [Shoi2015]自动刷题机 Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 156 Solved: 63[Submit][Status ...
随机推荐
- HTML5&CSS3经典动态表单-2
上一个demo效果没出来!实际如下 代码没问题.不知道为啥,展示的demo里光标获取焦点的时候不会有如下效果
- FEE Development Essentials
FEE Development Essentials JS Basic function call() and apply() func1.bind(thisObj,arg1...argn) Cust ...
- AX2012 R3 Data upgrade checklist sync database step, failed to create a session;
最近在做AX2012 R3 CU9 到CU11的upgrade时 (用的Admin帐号), 在Date upgrade 的 synchronize database 这步 跑了一半,报出错误 说“fa ...
- MS10-046漏洞测试
这次用到MS10-046这个远程执行漏洞(Windows快捷方式LNK文件自动执行代码漏洞攻击) 命令: 1. msfconsole //启动MSF Metasploit 2. sear ...
- [ html canvas getImageData Object.data.length ] canvas绘图属性 getImageData Object.data.length 属性讲解
<!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...
- SharePoint2013 - 移动文档
In SharePoint 2010, the easiest way to transfer documents from one library to another involved using ...
- centos如何安装软件
背景 之前用的linux操作系统移植都是ubuntu,没有用过redhat版本的linux,最近开始想学习redhan版本的linux,就从centos开始.在安装完centos以后,第一个碰到的问题 ...
- iOS 新窗口在最上层
有的时候需要弹出一个UIView 在整个视图的最上方,使用 [self.view addsubview : view] 一般就可以了,但是这样不严谨,因为这是一个tableview,那么这个view ...
- C标准库<signal.h>实现
本文地址:http://www.cnblogs.com/archimedes/p/c-library-signal.html,转载请注明源地址. 背景知识 signal.h是C标准函数库中的信号处理部 ...
- iOS--九宫格奥秘(UIView)(arc4random)
下面程序主要实现,九宫格的模型,每个小UIView的颜色随机产生的,用到了 arc4random函数: ; ; ; ; ; i<; i++) { ; j<; j++) { UIView * ...