这个select题目语句怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/11 19:06:16
我现在在看ASP互动教程,可是有一道题目不会做导致接下去的两节也不能看了。是一个关于select的题目,我把题目和自己的答案贴一下吧,请高手帮帮忙。
请写出在class表中查找满足如下条件的记录的SQL语句:
1、返回字段c_name,c_stu
2、返回记录数:前5条
3、查询条件:c_stu 值大于30并且c_type值为真,并且c_name字段中有“二班”两个字
4、查询结果按c_stu正排序,按c_type倒排序(注在正排序时请不要省略排列关键字)

我的答案是这样的:
select top 5 c_name,c_stu from class where c_stu>30 and c_type=ture and c_name like '二班' order by c_stu asc,c_type desc

可是我试了好多次都不行,不知道到底怎么做的这道题。

如下:
select top 5 c_name,c_stu
from class
where c_stu>30 and c_type= true and c_name like '二班'
order by c_stu asc,c_type desc
看见了你的单词写错了,是true,而不是:ture!
另外,列名一定要跟数据库对应好。

补充
是like '%二班%'