用户组 
易积分5541
热心99
好评17

|
查询 主讲人: 幻令
> 最近有点忙,隔了好几天才更新这一章
select 查询
查询出数据
select * from `table` where `id`<5;
php中使用
在php中的话,用mysqli_query执行语句,返回一个结果集,然后用fetch系的取出结果数据
$result=mysqli_query("select * from `table` where `id`<5;");
while($row=mysqli_fetch_array($row)){
print_r($row);
}
count() 数量
统计表中的记录数量
select count(*) from `table` where `id`<5;
其他函数
sum,min,max
join 联合查询
多个表一起查询
select * from `table` as `a` join `table2` as `b` on a.id=b.id where `id`<5;
join有多种方式,left join,right join,inner join
limit 限制
经常用来实现分页
limit 开始,长度
order 排序
自然就是按照某一规律排序啦
order by 列名1[,列名2] [排序方式]
group 分组
按照某一个数据,来进行分组
group by 列名
链接:https://pan.baidu.com/s/19P6nJ1GoNUj6JdLt5FaB-A 密码:qand
https://www.bilibili.com/video/av26428434/?p=19
|
|