mirror of
https://github.com/tiennm99/thptqg2017.git
synced 2026-09-04 18:20:24 +00:00
feat: add 'Top 100 điểm khối cao nhất - Long An' SQL preset
Computes each student's max admission-block sum across 49 official 2017 blocks (A00-A11, B00-B08, C00-C20, D01-D15, restricted to subjects present in our DB — no Đức/Nhật languages). One row per student, sorted by their personal best, top 100. SQL note: SQLite's MAX(x,y,...) scalar returns NULL if ANY arg is NULL. Each block expression is wrapped in COALESCE(..., -1); NULLIF(..., -1) restores NULL only for students with zero computable blocks.
This commit is contained in:
@@ -51,6 +51,73 @@ WHERE so_bao_danh LIKE '49%'
|
||||
AND toan IS NOT NULL AND vat_ly IS NOT NULL AND hoa_hoc IS NOT NULL
|
||||
ORDER BY tong_khoi_a DESC LIMIT 10`,
|
||||
},
|
||||
{
|
||||
// Per-student MAX across 49 official 2017 blocks (A00-A11, B00-B08,
|
||||
// C00-C20, D01-D15) restricted to subjects in our DB. SQLite's
|
||||
// MAX(x,y,...) scalar returns NULL if ANY arg is NULL (not just all),
|
||||
// so every block is wrapped in COALESCE(..., -1). NULLIF(..., -1)
|
||||
// then restores NULL for students whose data yields no valid block.
|
||||
label: "Top 100 điểm khối cao nhất - Long An",
|
||||
sql: `SELECT
|
||||
so_bao_danh,
|
||||
ho_ten,
|
||||
ngay_sinh,
|
||||
ROUND(NULLIF(MAX(
|
||||
COALESCE(toan+vat_ly+hoa_hoc, -1), -- A00
|
||||
COALESCE(toan+vat_ly+tieng_anh, -1), -- A01
|
||||
COALESCE(toan+vat_ly+sinh_hoc, -1), -- A02
|
||||
COALESCE(toan+vat_ly+lich_su, -1), -- A03
|
||||
COALESCE(toan+vat_ly+dia_ly, -1), -- A04
|
||||
COALESCE(toan+hoa_hoc+lich_su, -1), -- A05
|
||||
COALESCE(toan+hoa_hoc+dia_ly, -1), -- A06
|
||||
COALESCE(toan+lich_su+dia_ly, -1), -- A07
|
||||
COALESCE(toan+lich_su+gdcd, -1), -- A08
|
||||
COALESCE(toan+dia_ly+gdcd, -1), -- A09
|
||||
COALESCE(toan+vat_ly+gdcd, -1), -- A10
|
||||
COALESCE(toan+hoa_hoc+gdcd, -1), -- A11
|
||||
COALESCE(toan+hoa_hoc+sinh_hoc, -1), -- B00
|
||||
COALESCE(toan+sinh_hoc+lich_su, -1), -- B01
|
||||
COALESCE(toan+sinh_hoc+dia_ly, -1), -- B02
|
||||
COALESCE(toan+sinh_hoc+ngu_van, -1), -- B03
|
||||
COALESCE(toan+sinh_hoc+gdcd, -1), -- B04
|
||||
COALESCE(toan+sinh_hoc+tieng_anh, -1), -- B08
|
||||
COALESCE(ngu_van+lich_su+dia_ly, -1), -- C00
|
||||
COALESCE(ngu_van+toan+vat_ly, -1), -- C01
|
||||
COALESCE(ngu_van+toan+hoa_hoc, -1), -- C02
|
||||
COALESCE(ngu_van+toan+lich_su, -1), -- C03
|
||||
COALESCE(ngu_van+toan+dia_ly, -1), -- C04
|
||||
COALESCE(ngu_van+vat_ly+hoa_hoc, -1), -- C05
|
||||
COALESCE(ngu_van+vat_ly+sinh_hoc, -1), -- C06
|
||||
COALESCE(ngu_van+vat_ly+lich_su, -1), -- C07
|
||||
COALESCE(ngu_van+hoa_hoc+sinh_hoc, -1), -- C08
|
||||
COALESCE(ngu_van+vat_ly+dia_ly, -1), -- C09
|
||||
COALESCE(ngu_van+hoa_hoc+lich_su, -1), -- C10
|
||||
COALESCE(ngu_van+sinh_hoc+lich_su, -1), -- C12
|
||||
COALESCE(ngu_van+sinh_hoc+dia_ly, -1), -- C13
|
||||
COALESCE(ngu_van+toan+gdcd, -1), -- C14
|
||||
COALESCE(ngu_van+vat_ly+gdcd, -1), -- C16
|
||||
COALESCE(ngu_van+hoa_hoc+gdcd, -1), -- C17
|
||||
COALESCE(ngu_van+lich_su+gdcd, -1), -- C19
|
||||
COALESCE(ngu_van+dia_ly+gdcd, -1), -- C20
|
||||
COALESCE(toan+ngu_van+tieng_anh, -1), -- D01
|
||||
COALESCE(toan+ngu_van+tieng_nga, -1), -- D02
|
||||
COALESCE(toan+ngu_van+tieng_phap, -1), -- D03
|
||||
COALESCE(toan+ngu_van+tieng_trung, -1), -- D04
|
||||
COALESCE(toan+hoa_hoc+tieng_anh, -1), -- D07
|
||||
COALESCE(toan+sinh_hoc+tieng_anh, -1), -- D08
|
||||
COALESCE(toan+lich_su+tieng_anh, -1), -- D09
|
||||
COALESCE(toan+dia_ly+tieng_anh, -1), -- D10
|
||||
COALESCE(ngu_van+vat_ly+tieng_anh, -1), -- D11
|
||||
COALESCE(ngu_van+hoa_hoc+tieng_anh, -1), -- D12
|
||||
COALESCE(ngu_van+sinh_hoc+tieng_anh, -1), -- D13
|
||||
COALESCE(ngu_van+lich_su+tieng_anh, -1), -- D14
|
||||
COALESCE(ngu_van+dia_ly+tieng_anh, -1) -- D15
|
||||
), -1), 2) AS diem_khoi_cao_nhat
|
||||
FROM student
|
||||
WHERE so_bao_danh LIKE '49%'
|
||||
ORDER BY diem_khoi_cao_nhat IS NULL, diem_khoi_cao_nhat DESC
|
||||
LIMIT 100`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user