1.聚合 其它:GROUP_CONCAT.avg.sum.count.max.min SELECT typeid,GROUP_CONCAT(goodsname) FROM `goods` GROUP BY typeid 2.日期函数 ... SELECT LENGTH('abc') SELECT CONCAT('a','b') -- ab SELECT CONCAT_WS(',','a','b') -- a,b SELECT *,CONCAT(NAME,sex),NAME+sex FROM st…
集合,set(),记住: 1个特点:去重,把列表变成集合,达到自动去重操作,无序 5个关系:测试两个列表的交差并子反向差集 方法: | add(...) 常用,已存在元素去重不生效 | Add an element to a set. | This has no effect if the element is already present. >>> list1=[3,2,1,1,2,3,4,5] >>> set(list1) {1, 2, 3,…
mysql 基础三 阶段一 mysql 单表查询 1.查询所有记录 select * from department; select * from student; select * from student_detail; 2.查询选中列记录 select s_name from student; 3.查询指定条件下的记录 select s_name from student where s_id>2; 4.查询后为列取别名 select s_name as 姓名 from stude…