最简单的SQL语句

来源:百度知道 编辑:UC知道 时间:2024/06/05 14:57:31
要查询class表中字段c_stu值大于50,或者小于20的记录,并返回c_name和c_stu字段,一个如何些SQL语句?

select c_name, c_stu from class where c_stu>50 or c_stu<20

楼上这个可不对了。。c_stu between 50 and 20的意思是c_stu>=20 and c_stu<=50,正好和原意相反!

用between更恰当一些
select c_name, c_stu from class where c_stu between 50 and 20