first commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
{"qid": "Q1", "question_zh": "按对手方列出截至[日期]的所有未结算交易。", "sql": "-- 按对手方统计截至 2026-04-02 的未结算交易\n-- 使用 TSBBrokerContract(经纪商合约表),按 BrokerID(对手方经纪商)分组\n-- SettleStatus='U' 表示未结算;CashSettleDate <= '2026-04-02' 筛选截至日\nSELECT \n b.BrokerID,\n m.Name AS BrokerName,\n COUNT(*) AS UnsettledTradeCount,\n SUM(b.SettleQuantity) AS TotalUnsettledQty,\n SUM(b.SettleAmount) AS TotalUnsettledAmount,\n MIN(b.BuySell) + '~' + MAX(b.BuySell) AS BuySellRange,\n MIN(b.CashSettleDate) AS EarliestSettleDate,\n MAX(b.CashSettleDate) AS LatestSettleDate\nFROM TSBBrokerContract b\nLEFT JOIN MCBroker m ON b.BrokerID = m.BrokerID\nWHERE b.SettleStatus = 'U'\n AND b.CashSettleDate <= '2026-04-02'\nGROUP BY b.BrokerID, m.Name\nORDER BY TotalUnsettledAmount DESC;", "schema_info": {"tables": {"TSBBrokerContract": {"alias": "b", "columns": []}, "MCBroker": {"alias": "m", "columns": []}}, "joins": [{"type": "LEFT", "on": "b.BrokerID = m.BrokerID"}]}, "explanation": "- `TSBBrokerContract` 是经纪商/对手方合约表,记录与外部对手方的交易合约,`BrokerID` 即对手方标识\n- `SettleStatus = 'U'` 表示未结算;`CashSettleDate <= '2026-04-02'` 筛选截至日未结清的合约\n- 关联 `MCBroker` 获取对手方经纪商名称\n- 按 `BrokerID` 分组汇总未结算数量和金额", "question_en": "Show all unsettled trades as of [date] grouped by counterparty.", "rating": 9, "execution_result": null, "result_note": "| BrokerID | BrokerName | UnsettledTradeCount | TotalUnsettledQty | TotalUnsettledAmount | BuySellRange | EarliestSettleDate | LatestSettleDate |\n|----------|-----------|---------------------|-------------------|---------------------|--------------|---------------------|-------------------|\n| CCASS | CCASS | 622 | 40,459,253 | 44,173,571.06 | B~S | 2025-07-30 | 2026-04-02 |\n\n> **注**:CCASS(Hong Kong Securities Clearing Company Limited)是香港交易所的中央结算机构,作为交易所交易的核心对手方。622笔未结算合约均为 HKEX 市场。", "tags": ["join", "ordering", "broker", "filter", "trade", "left_join", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q2", "question_zh": "列出今日所有客户账户之间的股票转移记录。", "sql": "-- 查询今日客户账户间股票转移(参考日期:2026-04-02)\n-- 使用 TSBAccountInstrumentMovement,MovementType='T' 表示账户间转移\n-- ValueDate 为转移生效日期,关联 MCInstrument 获取证券名称\nSELECT \n m.MovementID,\n m.AccountID AS FromAccountID,\n m.TransferToAccountID,\n m.InstrumentID,\n i.Name AS InstrumentSymbol,\n m.MovementType,\n m.Quantity AS TransferQuantity,\n m.ValueDate AS TransferDate\nFROM TSBAccountInstrumentMovement m\nLEFT JOIN MCInstrument i ON m.InstrumentID = i.InstrumentID\nWHERE m.MovementType = 'T'\n AND m.ValueDate = '2026-04-02'\nORDER BY m.ValueDate;", "schema_info": {"tables": {"TSBAccountInstrumentMovement": {"alias": "m", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "LEFT", "on": "m.InstrumentID = i.InstrumentID"}]}, "explanation": "- `TSBAccountInstrumentMovement` 是持仓变动流水表,记录所有证券变动事件\n- `MovementType = 'T'`(Transfer)特指**账户间股票转移**,对应 `TransferToAccountID` 记录目标账户\n- `ValueDate` 是转移生效日期,可按日期过滤\n- 关联 `MCInstrument` 获取证券代码/名称\n- 注意:`BCAccountInstrument` 的 `TodayIn/TodayOut` 是**实时快照**,不带历史日期维度,不能用于查历史转移", "question_en": "List all stock transfers between client accounts performed today.", "rating": 9, "execution_result": null, "result_note": "当前查询无结果(测试环境中 `TSBAccountInstrumentMovement` 的 `MovementType='T'` 最新记录为 2025-10-21,无 2026-04-02 的账户间转移数据)", "tags": ["join", "ordering", "filter", "account", "left_join"], "difficulty": "hard"}
|
||||
{"qid": "Q7", "question_zh": "今日结算后现金余额为负的账户列表。", "sql": "-- 查询现金余额为负的账户\nSELECT \n c.AccountID,\n a.Name AS AccountName,\n c.CurrencyID,\n c.Settled AS CashBalance,\n c.UnderdueCheque,\n c.BankAvailableBalance\nFROM BCAccountCash c\nINNER JOIN MCAccount a ON c.AccountID = a.AccountID\nWHERE c.Settled < 0\nORDER BY c.Settled ASC;", "schema_info": {"tables": {"BCAccountCash": {"alias": "c", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "c.AccountID = a.AccountID"}]}, "explanation": "- `BCAccountCash.Settled` 表示已结算现金余额\n- 负数表示账户透支\n- 关联 `MCAccount` 获取账户名称", "question_en": "List accounts with negative cash balance after today's settlement.", "rating": 9, "execution_result": null, "result_note": "| AccountID | AccountName | CurrencyID | CashBalance |\n|-----------|------------|------------|-------------|\n| M050009 | NG SUN SHU*** | HKD | -4,678,978.42 |\n| P050667 | WONG YIM HUNG | HKD | -780,196.94 |\n| M050521 | LO CHUN YIP | HKD | -290,487.54 |\n\n(共55个账户现金余额为负)", "tags": ["join", "ordering", "filter", "account", "cash"], "difficulty": "hard"}
|
||||
{"qid": "Q11", "question_zh": "哪些客户尚未缴纳IPO申购款?", "sql": "-- 查询未缴纳IPO申购款的账户\nSELECT \n a.AccountID,\n a.Name AS AccountName,\n bi.InstrumentID,\n i.Name AS InstrumentName,\n bi.TotalBoughtQuantity AS SubscriptionLot,\n bi.TotalBoughtConsideration AS SubscriptionAmount\nFROM BCAccountInstrument bi\nINNER JOIN MCAccount a ON bi.AccountID = a.AccountID\nINNER JOIN MCInstrument i ON bi.InstrumentID = i.InstrumentID\nINNER JOIN MCInstrumentIPODetail ip ON bi.InstrumentID = ip.InstrumentID\nWHERE ip.State = 'A'\n AND bi.TotalBoughtConsideration > 0\n AND bi.TotalBoughtFee = 0\nORDER BY bi.TotalBoughtConsideration DESC;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "bi", "columns": []}, "MCAccount": {"alias": "a", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}, "MCInstrumentIPODetail": {"alias": "ip", "columns": []}}, "joins": [{"type": "INNER", "on": "bi.AccountID = a.AccountID"}, {"type": "INNER", "on": "bi.InstrumentID = i.InstrumentID"}, {"type": "INNER", "on": "bi.InstrumentID = ip.InstrumentID"}]}, "explanation": "- 通过比对买卖数量和手续费判断是否缴款\n- `TotalBoughtConsideration > 0` 有认购\n- `TotalBoughtFee = 0` 未支付手续费", "question_en": "Which clients have not yet paid their IPO subscription money?", "rating": 6, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "account", "filter", "ordering"], "difficulty": "hard"}
|
||||
{"qid": "Q15", "question_zh": "本月应付给介绍经纪人的佣金返佣总额是多少?", "sql": "-- 查询本月应付返佣 (2026年4月)\n-- 注意:BCAccountInstrument 无 UpdatedAt 字段,用 LastTransactionDate 过滤本月有交易的账户\n-- 说明:TotalBoughtFee/TotalSoldFee 为历史累计字段,此处统计近期活跃账户的累计佣金供参考\nSELECT \n a.AEID,\n u.Name AS AEName,\n COUNT(DISTINCT a.AccountID) AS AccountCount,\n SUM(bi.TotalBoughtFee + bi.TotalSoldFee) AS TotalCommission\nFROM MCAccount a\nLEFT JOIN MCUser u ON a.AEID = u.UserID\nLEFT JOIN BCAccountInstrument bi ON a.AccountID = bi.AccountID\nWHERE YEAR(bi.LastTransactionDate) = 2026\n AND MONTH(bi.LastTransactionDate) = 4\nGROUP BY a.AEID, u.Name\nHAVING SUM(bi.TotalBoughtFee + bi.TotalSoldFee) > 0\nORDER BY TotalCommission DESC;", "schema_info": {"tables": {"MCAccount": {"alias": "a", "columns": []}, "MCUser": {"alias": "u", "columns": []}, "BCAccountInstrument": {"alias": "bi", "columns": []}}, "joins": [{"type": "LEFT", "on": "a.AEID = u.UserID"}, {"type": "LEFT", "on": "a.AccountID = bi.AccountID"}]}, "explanation": "- `MCRebateScheme` 可能存储返佣规则\n- 按AE汇总佣金", "question_en": "What is the total commission rebate payable to introducing brokers this month?", "rating": 6, "execution_result": null, "result_note": "", "tags": ["join", "ordering", "filter", "left_join", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q21", "question_zh": "截至昨日的客户借方余额应计利息是多少?", "sql": "-- 查询客户借方余额应计利息 (截至2026-04-01)\nSELECT \n SUM(AccruedDebitInterest) AS TotalDebitInterestAccrued,\n SUM(AccruedCreditInterest) AS TotalCreditInterestAccrued,\n SUM(AccruedDebitInterest) - SUM(AccruedCreditInterest) AS NetDebitInterest,\n COUNT(DISTINCT AccountID) AS AccountCount\nFROM BCAccountCash\nWHERE AccruedDebitInterest > 0;", "schema_info": {"tables": {"BCAccountCash": {"alias": "BCAccountCash", "columns": []}}, "joins": []}, "explanation": "- `AccruedDebitInterest` 借款应计利息\n- `AccruedCreditInterest` 存款应计利息", "question_en": "What is the interest accrued on client debit balances as of yesterday?", "rating": 8, "execution_result": null, "result_note": "| TotalDebitInterestAccrued | TotalCreditInterestAccrued | NetDebitInterest | AccountCount |\n|---------------------------|---------------------------|-----------------|-------------|\n| 2,022.70 | 464.15 | 1,558.55 | 55 |", "tags": ["filter", "account", "interest", "cash", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q22", "question_zh": "列出今日所有公司账户与客户账户之间的现金划转。", "sql": "-- 查询公司账户与客户账户现金划转 (固定日期: 2026-04-02)\nSELECT \n c.AccountID,\n a.Name AS AccountName,\n a.AccountType,\n c.CurrencyID,\n c.TodayIn AS CashInflow,\n c.TodayOut AS CashOutflow,\n c.Settled AS CurrentBalance\nFROM BCAccountCash c\nINNER JOIN MCAccount a ON c.AccountID = a.AccountID\nWHERE (c.TodayIn > 0 OR c.TodayOut > 0)\nORDER BY c.TodayIn + c.TodayOut DESC;", "schema_info": {"tables": {"BCAccountCash": {"alias": "c", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "c.AccountID = a.AccountID"}]}, "explanation": "- 公司账户与客户账户通过 `AccountType` 区分\n- `TodayIn/TodayOut` 记录现金流动", "question_en": "List all cash movements between house and client accounts today.", "rating": 7, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "ordering", "filter", "account", "cash"], "difficulty": "hard"}
|
||||
{"qid": "Q23", "question_zh": "列出所有逾期未付保证金利息的账户。", "sql": "-- 查询逾期保证金利息账户\nSELECT \n c.AccountID,\n a.Name AS AccountName,\n c.LoanInterestMarginOverdue AS MarginOverdueInterest,\n c.LoanInterestMarginBOverdue AS MarginBOverdueInterest,\n c.LoanInterestOverdue AS GeneralOverdueInterest\nFROM BCAccountCash c\nINNER JOIN MCAccount a ON c.AccountID = a.AccountID\nWHERE c.LoanInterestMarginOverdue > 0 \n OR c.LoanInterestMarginBOverdue > 0\n OR c.LoanInterestOverdue > 0\nORDER BY (c.LoanInterestMarginOverdue + c.LoanInterestMarginBOverdue + c.LoanInterestOverdue) DESC;", "schema_info": {"tables": {"BCAccountCash": {"alias": "c", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "c.AccountID = a.AccountID"}]}, "explanation": "- `LoanInterestMarginOverdue` 保证金账户逾期利息\n- `LoanInterestMarginBOverdue` B类保证金逾期利息", "question_en": "Show all accounts with overdue margin interest payments.", "rating": 8, "execution_result": null, "result_note": "当前查询无逾期利息记录", "tags": ["join", "ordering", "margin", "filter", "account", "interest"], "difficulty": "hard"}
|
||||
{"qid": "Q26", "question_zh": "本月各交易所的结算费用明细如何?", "sql": "-- 按交易所统计结算费用 (2026年4月)\n-- 说明:BCAccountInstrument 表中 TotalBoughtFee/TotalSoldFee 是持仓级别的交易费用字段\n-- LastTransactionDate 表示该持仓最后交易日期\n-- 查询逻辑:筛选最后交易日期在本月内的持仓记录,按交易所汇总交易费用\nSELECT \n bi.MarketID,\n m.MarketName,\n SUM(bi.TotalBoughtFee) AS TotalBuyFee,\n SUM(bi.TotalSoldFee) AS TotalSellFee,\n SUM(bi.TotalBoughtFee + bi.TotalSoldFee) AS TotalSettlementFee,\n COUNT(DISTINCT bi.AccountID) AS TradingAccountCount\nFROM BCAccountInstrument bi\nINNER JOIN MCMarket m ON bi.MarketID = m.MarketID\nWHERE bi.LastTransactionDate >= '2026-04-01' AND bi.LastTransactionDate < '2026-05-01'\nGROUP BY bi.MarketID, m.MarketName\nORDER BY TotalSettlementFee DESC;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "bi", "columns": []}, "MCMarket": {"alias": "m", "columns": []}}, "joins": [{"type": "INNER", "on": "bi.MarketID = m.MarketID"}]}, "explanation": "- `BCAccountInstrument` 存储持仓级别信息,包含各持仓的交易费用累计\n- `MCMarket` 存储市场信息,提供市场名称\n- `LastTransactionDate` 用于过滤本月有交易的持仓记录\n- 按市场分组汇总结算费用", "question_en": "What is the breakdown of settlement fees by exchange for this month?", "rating": 8, "execution_result": null, "result_note": "", "tags": ["join", "ordering", "filter", "trade", "aggregation", "date_range"], "difficulty": "hard"}
|
||||
{"qid": "Q30", "question_zh": "按结算日期划分的未结算交易总风险敞口是多少?", "sql": "-- 按结算日期分组的未结算交易敞口\nSELECT \n SettlementType,\n SUM(Amount) AS TotalExposure\nFROM (\n SELECT 'DueBuy_T1' AS SettlementType, SUM(DueBuy) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'DueSell_T1' AS SettlementType, SUM(DueSell) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'NextDayDueBuy' AS SettlementType, SUM(NextDayDueBuy) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'NextDayDueSell' AS SettlementType, SUM(NextDayDueSell) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'NextTwoDayDueBuy' AS SettlementType, SUM(NextTwoDayDueBuy) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'NextTwoDayDueSell' AS SettlementType, SUM(NextTwoDayDueSell) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'TodayDueBuy' AS SettlementType, SUM(TodayDueBuy) AS Amount FROM BCAccountInstrument\n UNION ALL\n SELECT 'TodayDueSell' AS SettlementType, SUM(TodayDueSell) AS Amount FROM BCAccountInstrument\n) t\nGROUP BY SettlementType\nORDER BY SettlementType;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "BCAccountInstrument", "columns": []}}, "joins": []}, "explanation": "- `BCAccountInstrument` 表包含所有账户的证券持仓和交收信息\n- `DueBuy/DueSell` 表示T+1到期的买卖数量", "question_en": "What is the total exposure from unsettled trades by settlement date?", "rating": 8, "execution_result": null, "result_note": "| SettlementType | TotalExposure |\n|----------------|---------------|\n| DueBuy_T1 | 0 |\n| DueSell_T1 | 0 |\n| NextDayDueBuy | 0 |\n| NextDayDueSell | 0 |\n| NextTwoDayDueBuy | 0 |\n| NextTwoDayDueSell | 0 |\n| TodayDueBuy | 1,800 |\n| TodayDueSell | 1,000 |\n\n**注:** `DueBuy/DueSell` 等字段表示应交收数量(T+1/T+2/今日),非金额敞口。如需金额敞口,需乘以价格。", "tags": ["union", "trade", "ordering", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q34", "question_zh": "保证金账户前20大持仓(按市值)是多少?", "sql": "-- 保证金账户按市值排序的前20持仓\nSELECT TOP 20\n a.AccountID,\n a.Name AS AccountName,\n a.MarketValue,\n a.MarginDebitRatio AS MarginDebitBalanceRatio,\n a.MarginPosition,\n a.CallForDeposit,\n a.MarginFacilityFlag\nFROM MCAccount a\nWHERE a.MarginFacilityFlag = 'Y'\n AND a.State = 'A'\n AND a.MarketValue > 0\nORDER BY a.MarketValue DESC;", "schema_info": {"tables": {"MCAccount": {"alias": "a", "columns": []}}, "joins": []}, "explanation": "- `MCAccount` 表包含所有账户信息\n- `MarginFacilityFlag = 'Y'` 筛选保证金账户", "question_en": "What are the top 20 holdings (based on market value) for margin accounts?", "rating": 9, "execution_result": null, "result_note": "| AccountID | AccountName | MarketValue | MarginPosition |\n|-----------|-------------|------------|----------------|\n| M050009 | NG SUN SHU*** | 57,420,000 | 35,515,021.58 |\n| M050013 | NG CHUNG WAI*** | 19,504,520 | 10,918,958.78 |\n| M050193 | WONG KING YIU*** ^ | 11,682,920 | 3,340,099.05 |\n| P020160 | LAW SHIU MING DENNIS | 7,520,370 | 0 |\n| P030078 | MAK SUI BING | 7,120,309.94 | 0 |\n| P051101 | CHUNG CHUNG YEE | 7,117,808.04 | 0 |\n| M050170 | FUNG LAI FONG ANNA | 7,009,227.25 | 4,136,857 |\n| P220005 | LAI KAM SUI # | 5,837,102.10 | 97.97 |\n| P280628 | CHAN KWOK MO # | 5,761,997.48 | 62,508.23 |\n| P280455 | LEUNG KA CHI # | 5,487,971.20 | -64,981.22 |\n\n(共20条记录,以上展示前10条)", "tags": ["ordering", "holding", "margin", "filter", "limit", "account"], "difficulty": "hard"}
|
||||
{"qid": "Q35", "question_zh": "列出本月按客户主任分组的佣金总额,以及相应的成交金额和返佣金额。", "sql": "-- 按经纪商/客户主任分组的佣金统计\nSELECT \n a.AEID,\n u.Name AS AEName,\n COUNT(DISTINCT a.AccountID) AS AccountCount,\n SUM(bi.TotalBoughtFee) AS TotalBuyCommission,\n SUM(bi.TotalSoldFee) AS TotalSellCommission,\n SUM(bi.TotalBoughtConsideration) AS TotalBuyConsideration,\n SUM(bi.TotalSoldConsideration) AS TotalSellConsideration,\n SUM(bi.TotalBoughtFee) + SUM(bi.TotalSoldFee) AS TotalCommission\nFROM MCAccount a\nLEFT JOIN MCUser u ON a.AEID = u.UserID\nLEFT JOIN BCAccountInstrument bi ON a.AccountID = bi.AccountID\nWHERE a.State = 'A'\nGROUP BY a.AEID, u.Name\nHAVING SUM(bi.TotalBoughtFee) + SUM(bi.TotalSoldFee) > 0\nORDER BY TotalCommission DESC;", "schema_info": {"tables": {"MCAccount": {"alias": "a", "columns": []}, "MCUser": {"alias": "u", "columns": []}, "BCAccountInstrument": {"alias": "bi", "columns": []}}, "joins": [{"type": "LEFT", "on": "a.AEID = u.UserID"}, {"type": "LEFT", "on": "a.AccountID = bi.AccountID"}]}, "explanation": "- `MCAccount.AEID` 关联经纪商/客户主任\n- `BCAccountInstrument` 包含交易费用数据", "question_en": "List the total commission received this month by AE, along with corresponding consideration and rebate amounts.", "rating": 8, "execution_result": null, "result_note": "| AEID | AEName | AccountCount | TotalBuyCommission | TotalSellCommission | TotalCommission |\n|------|--------|-------------|-------------------|--------------------|----------------|\n| C01 | CHAN YUET HUNG | 628 | 183,244.64 | 187,220.59 | 370,465.23 |\n| C28 | CHAN SHU SHAN | 405 | 179,275.89 | 176,760.39 | 356,036.28 |\n| C05 | CENTRAL | 517 | 97,368.51 | 102,819.88 | 200,188.39 |\n| C33 | LEON NG | 13 | 71,541.06 | 72,620.60 | 144,161.66 |\n| C07 | CHAN WING PAI | 75 | 73,255.68 | 69,115.58 | 142,371.26 |\n| C10 | TOKWAWAN / KOWLOON CITY | 369 | 51,059.78 | 57,288.86 | 108,348.64 |\n| C08 | WONG HON KONG | 380 | 47,505.15 | 46,300.39 | 93,805.54 |\n| C36 | Name Of C36 | 146 | 40,945.66 | 35,682.86 | 76,628.52 |\n| C66 | CHEUNG YUK LING IVA | 17 | 24,458.82 | 22,723.18 | 47,182.00 |\n| C19 | WONG LO SING | 60 | 13,337.69 | 13,912.30 | 27,249.99 |\n\n(共15个AE有佣金记录,以上展示前10条)\n\n**注:** 当前SQL无日期条件,统计所有历史累计佣金。如需\"本月\"佣金,需添加 `LastTransactionDate >= '2026-04-01'` 条件。", "tags": ["join", "ordering", "filter", "account", "left_join", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q45", "question_zh": "不同经纪商(如非中央结算系统持仓)的客户总持仓是多少?", "sql": "-- 按托管位置统计持仓(非CCASS)\nSELECT \n loc.LocationID,\n loc.Name AS LocationName,\n COUNT(DISTINCT bi.AccountID) AS AccountCount,\n SUM(bi.Settled) AS TotalQuantity,\n SUM(bi.CostAmount) AS TotalCostAmount\nFROM BCAccountLocationInstrument bi\nINNER JOIN MCLocation loc ON bi.LocationID = loc.LocationID\nWHERE loc.CCASSFlag = 'N'\nGROUP BY loc.LocationID, loc.Name\nORDER BY TotalQuantity DESC;", "schema_info": {"tables": {"BCAccountLocationInstrument": {"alias": "bi", "columns": []}, "MCLocation": {"alias": "loc", "columns": []}}, "joins": [{"type": "INNER", "on": "bi.LocationID = loc.LocationID"}]}, "explanation": "- `BCAccountLocationInstrument` 记录按托管位置分类的持仓\n- `MCLocation` 存储托管位置信息", "question_en": "What is the total client holding at different broker firms (e.g., non-CCASS locations)?", "rating": 7, "execution_result": null, "result_note": "当前查询需要验证 Location 表关联", "tags": ["join", "ordering", "holding", "broker", "filter", "account", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q46", "question_zh": "支付给其他经纪商的佣金是多少?", "sql": "-- 查询支付给其他经纪商的佣金\nSELECT \n b.BrokerID,\n b.Name AS BrokerName,\n SUM(bc.Commission) AS TotalCommission,\n SUM(bc.Consideration) AS TotalConsideration\nFROM MCBroker b\nINNER JOIN BCBrokerCash bc ON b.BrokerID = bc.BrokerID\nWHERE bc.Commission > 0\nGROUP BY b.BrokerID, b.Name\nORDER BY TotalCommission DESC;", "schema_info": {"tables": {"MCBroker": {"alias": "b", "columns": []}, "BCBrokerCash": {"alias": "bc", "columns": []}}, "joins": [{"type": "INNER", "on": "b.BrokerID = bc.BrokerID"}]}, "explanation": "- `MCBroker` 存储经纪商信息\n- `BCBrokerCash` 可能包含经纪商现金和佣金数据", "question_en": "How much commission has been paid to other brokers?", "rating": 6, "execution_result": null, "result_note": "当前查询需要验证经纪商佣金表关联", "tags": ["join", "ordering", "broker", "filter", "aggregation"], "difficulty": "hard"}
|
||||
{"qid": "Q47", "question_zh": "今日/指定日期发放了多少份日结单或月结单?", "sql": "-- 查询报表发放统计 (2026-04-02)\nSELECT \n 'Daily Statement' AS StatementType,\n COUNT(*) AS StatementCount\nFROM MCAccount\nWHERE LastDailyStatementDate = '2026-04-02'\nUNION ALL\nSELECT \n 'Monthly Statement' AS StatementType,\n COUNT(*) AS StatementCount\nFROM MCAccount\nWHERE LastMonthlyStatementDate = '2026-04-02';", "schema_info": {"tables": {"MCAccount": {"alias": "MCAccount", "columns": []}}, "joins": []}, "explanation": "- `MCAccount` 记录账户报表发送日期\n- `LastDailyStatementDate` 最近日结单发送日期", "question_en": "How many daily or monthly statements were issued today / on a specific date?", "rating": 9, "execution_result": null, "result_note": "", "tags": ["union", "filter", "aggregation"], "difficulty": "hard"}
|
||||
Reference in New Issue
Block a user