desc降序,
asc升序
#升
select skamount from BO_ACT_1660786219585 order by skamount asc
#降
select skamount from BO_ACT_1660786219585 order by skamount desc
#限制
select skamount from BO_ACT_1660786219585 order by skamount desc limit 0,2
#去重
select distinct skamount from BO_ACT_1660786219585
#模糊查询
select * from BO_ACT_1660786219585 where billtype like '%预%'
#插入
INSERT into BO_ACT_1660786219585(ID,billtype) values("22","sharong")
#更新
update BO_ACT_1660786219585 set ID='33' where ID = '22'
#删除
delete from BO_ACT_1660786219585 where id ="33"
#左连接
select * from BO_ACT_1660786219585 left join BO_ACT_1661931854870 on BO_ACT_1660786219585.billtype = BO_ACT_1661931854870.SKTYPE
#右链接
select * from BO_ACT_1660786219585 RIGHT JOIN BO_ACT_1661931854870 on BO_ACT_1660786219585.billtype = BO_ACT_1661931854870.SKTYPE
#内连接
select * from BO_ACT_1660786219585 INNER JOIN BO_ACT_1661931854870 on BO_ACT_1660786219585.billtype = BO_ACT_1661931854870.SKTYPE
聚合函数
#sum函数
select SUM(skamount) from BO_ACT_1660786219585
#计算个数
select billtype,COUNT(skamount) from BO_ACT_1660786219585 GROUP BY billtype where skamount>780
#求平均值 分组,每个组内的平均值
select billtype,AVG(skamount) from BO_ACT_1660786219585 GROUP BY billtype
#having一般跟在group by后面、条件可以是聚合函数。where条件必须是行。
GROUP BY billtype
HAVING 条件
左连接
Left join
Right join
Full join