- ตัวดำเนินการ
-
เรียนรู้
เรียน Python ตัวอย่างที่รันได้, NumPy, pandas และอื่น ๆ เรียน AI / Machine Learningโครงข่ายประสาท ML และ LLM ตั้งแต่ศูนย์ เรียน C และ C++ พอยน์เตอร์ หน่วยความจำ STL และ C++ สมัยใหม่ เรียน C#พื้นฐาน C#, OOP, LINQ, async และแบบฝึกหัด .NET เรียน Matplotlibกราฟเส้น แท่ง กระจาย และวงกลม พร้อมตัวแสดงภาพแบบโต้ตอบ เรียน RustOwnership, trait, การจัดการข้อผิดพลาด และ thread เรียน GoSlice, interface, goroutine และ channel อัลกอริทึม Python การค้นหา การเรียงลำดับ รีเคอร์ชัน และภาพจำลอง O(n) อัลกอริทึม C และ C++ เปรียบเทียบการเขียนด้วย C และ C++ เขียนโปรแกรมสำหรับเด็ก เรียนเขียนโปรแกรมผ่านการเล่น!
- ควิซใหม่
- โจทย์ใหม่
- สำหรับครูใหม่
- อัปเดต
- เลี้ยงกาแฟสักแก้ว
ควิซ SQL: Running Totals, LAG & LEAD
This SQL quiz covers aggregate window functions and the offset functions LAG() and LEAD(). You will compute running totals and moving averages, compare each row with the previous one and run into the default window frame that surprises many developers when the sort order has ties.
ตัวอย่างคำถาม
ข้อ 1 จาก 10What does this print?
CREATE TABLE sales (day INTEGER, amount INTEGER);
INSERT INTO sales VALUES (1, 10), (2, 20), (3, 5), (4, 15);
SELECT day, SUM(amount) OVER (ORDER BY day)
FROM sales
ORDER BY day;
ดูเฉลย
A. 1|10
2|30
3|35
4|50 With ORDER BY inside OVER, the sum runs from the first row up to the current one, giving a running total. Unlike GROUP BY, every row is kept.
ควิซนี้มีเนื้อหาอะไรบ้าง
- Running totals with
SUM(...) OVER (ORDER BY ...) LAGandLEADwith offsets and default values- Frames:
ROWS BETWEEN ... AND CURRENT ROW - The default RANGE frame and ties
- Per-group running totals with
PARTITION BY
คำถามที่พบบ่อย
ต้องมีบัญชีไหม?
ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ
ทำซ้ำได้ไหม?
ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง