PHP小白数据库查询方法

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; #取两条数据

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值