谁来教我做一个简单的SQL题?

来源:百度知道 编辑:UC知道 时间:2024/05/31 13:11:34
请写出在class表中查找满足如下条件的记录的SQL语句:
1、返回字段c_name,c_stu
2、返回记录数:前5条
3、查询条件:c_stu值大于30,并且c_tpye值为真,并且c_name字段值中有“二班”两字
4、查询结果按c_stu正排序,按c_tpye倒排序

1.SELECT c_name,c_stu FROM class
2.SELECT TOP 5 * FROM class
3.SELECT * FROM class WHERE c_stu>30 and c_type=true and c_name LIKE '%二班%'
4.SELECT * FROM class ORDER BY c_stu,c_tpye 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,c_type desc

select c_name,c_stu
from class
where c_stu>30 and c_type=true and c_name like '%二班%'
order by c_name asc, c_type desc limit 5;

1.SELECT c_name,c_stu FROM class ;
2.SELECT * FROM class where rownum<6;
3.SELECT * FROM class WHERE c_stu>30 and
c_type=true and c_name LIKE '%二班%';
4.SELECT * FROM class ORDER BY c_stu asc,c_tpye desc

select top 5 from class where select c_name,c_stu from class where c_stu>30 and c_tpye=true and c_name like'%二班%' order by c_stu asc,c_tpye desc