破题累死我了,网上另外一份答案写的也不错
(链接:http://blog.youkuaiyun.com/cygeek_dut/article/details/13090743)
但是他有的地方显然写麻烦了,而且对于第五个问那份答案好像理解错了题意,我仔细研究了下,写了份原创的,如果改一下缩进和变量名什么的,应该比网上这份仁兄的答案短一点。
我还真头一次知道sql原来可以写的这么跳,写的如此花哨。。简直是秀操作。。。 orz
当然也有可能存在有问题的地方,欢迎指正交流~!
我这里直接贴代码了,题目数据库数据的构建之类的请参考上面提到的那份答案
第一题:
1. Find the sections which have the minimum enrollment among sections registered by students. For each section as such, information displayed should involve:
l Identifier of section(i.e. the primary key for section) l Course name corresponding to the section l Enrollment of the section('enrollment' is the alias for the number of students who registered for the section) l TOP keyword in SQL Server is denied.