PHP原生数据库查询方法
select * from class where cid>4; # cid大于4
select * from class where cid<4; # cid小于4
select * from class where cid!=3; # cid不等于4
select * from class where cid<>3; # cid不等于4(这种更适合)
select * from class where cid<=4; # cid小于等于4
select * from class where cid>=4; # cid大于等于4
select * from class where cid=4 and cname=‘1905D’; #两边都要对才对
select * from class where cid<2 and cname=‘1904A’;
select * from class where cid=3 or cname=‘12213’;#一边对就对
select * from class where cid>2 or cname=‘123’;
select * from class where cid between 2 and 4; #2~4的之间
select * from class where cname like ‘%1904%’; #是1904的全部
select * from class where cname like ‘%E’; #结尾为E的
select * from class where cname like ‘2%’; #开头为2的
select * from class where cid in(1,2,3,4); #选定1,2,3,4
select * from class order by cid desc; #从大到小 降序
select * from class order by cid asc; #从小到大 升序
select * from class limit 0,4; #取两条数据