- SELECT ...FROM...
- SELECT * FROM...
- SELECT x1 as y1,x2 y2,x3 y3 FROM...
- SELECT distinct x1 FROM ...
- SELEXT X1, X2, X3,X2/X3 Y1 FROM ...
- SELECT...FROM ...WHERE ...
- SELECT...FROM...WHERE X1 LIKE "%t_" (%任意个字符,_单个字符)
- SELECT...FROM...WHERE...ORDER BY X1 ASC,X2 DESC (asc 升序,DESC 降序)
- SELECT...FROM ...WHERE...ORDER BY X1 IN ('a1','a2') (in用法,a1,a2排最后;not in)
- SELECT...FROM...ORDER BY...LIMIT 3
- SELECT ...FROM ...ORDER BY ...LIMIT 3,4 (区第4至7行)
- SELECT SUM(X1) FROM ... WHERE...
- 函数:SUM, AVG, MAX MIN
- SELECT X1,X2,COUNT(X3) FROM ...GROUP BY X1
- SELECT X1,COUNT(X2) FROM ...GROUP BY X1 HAVING ...
- round(x,y); concat(s1,s2); replace(s,s1,s2); left(s,n); right(s,n); substring(s,n,len); cast(x as type) year(),month(),day(),date_add(x1,interval 2 day);case when x1 then y1 when x2 then y2 else x3 end
- rank()over(partition by 排序范围,order by x1)
- lag(x1,1) over(order by x2)
- select... from x1 join x2 on x1.a1=x2.a2
- select... from x1 right join x2 on x1.a1=x2.a2
SQL学习笔记
最新推荐文章于 2024-09-10 14:35:22 发布