91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

sql collapse函數的高級用法有哪些

sql
小樊
81
2024-07-26 21:18:10
欄目: 云計算

  1. 使用聚合函數進行分組
SELECT name, SUM(score) as total_score
FROM students
GROUP BY name
  1. 使用條件進行分組
SELECT 
    name,
    SUM(CASE WHEN subject='Math' THEN score ELSE 0 END) as math_score,
    SUM(CASE WHEN subject='English' THEN score ELSE 0 END) as english_score
FROM students
GROUP BY name
  1. 使用聚合函數進行排序
SELECT name, SUM(score) as total_score
FROM students
GROUP BY name
ORDER BY total_score DESC
  1. 使用聚合函數進行篩選
SELECT name, SUM(score) as total_score
FROM students
GROUP BY name
HAVING total_score > 200
  1. 使用窗口函數
SELECT name, score, SUM(score) OVER (PARTITION BY name) as total_score
FROM students

0
凤台县| 临海市| 望江县| 万全县| 修武县| 兴安县| 神农架林区| 嘉禾县| 兰考县| 香河县| 正宁县| 涪陵区| 宁城县| 衡阳市| 南开区| 佛冈县| 林口县| 南木林县| 雅安市| 河间市| 溧阳市| 久治县| 宁晋县| 广水市| 荔浦县| 万州区| 阿拉尔市| 汕头市| 浦县| 上栗县| 上杭县| 临清市| 南京市| 北安市| 托里县| 吴旗县| 黄冈市| 吕梁市| 达孜县| 巨野县| 称多县|