Files
ai-g3sb-backman2.0/data/experiences/all_samples.jsonl
T
2026-04-10 16:52:07 +08:00

51 lines
64 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"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": "Q3", "question_zh": "今日结算使用的汇率是多少?", "sql": "-- 查询汇率类型列表 (固定日期: 2026-04-02)\nSELECT \n ExchangeRateID, \n Name, \n NameEx\nFROM HCExchangeRate\nWHERE ValueDate = '2026-04-02'\nORDER BY ExchangeRateID;", "schema_info": {"tables": {"HCExchangeRate": {"alias": "HCExchangeRate", "columns": []}}, "joins": []}, "explanation": "- `HCExchangeRate` 存储汇率类型定义\n- `HCExchangeRateDetail` 存储各货币对的汇率值\n- 两个表通过 `ExchangeRateID` + `ValueDate` 关联\n- `ExchangeRateDirection` = 'D' 表示直接汇率", "question_en": "What are the currency exchange rates used for today's settlement?", "rating": 9, "execution_result": null, "result_note": "", "tags": ["exchange_rate", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q4", "question_zh": "哪些券商尚有未履行的交收义务?", "sql": "-- 查询有未履行交收义务的经纪商(截至 2026-04-02)\n-- Settled < 0 表示经纪商欠我们的现金(未履行交收义务)\n-- 注意:BCBrokerCash.Settled 是经纪商在我们账户的已结算现金余额,负数=经纪商欠款\nSELECT \n b.BrokerID,\n m.Name AS BrokerName,\n b.CurrencyID,\n b.Settled AS OwedToUsAmount,\n ABS(b.Settled) AS OutstandingAmount\nFROM BCBrokerCash b\nINNER JOIN MCBroker m ON b.BrokerID = m.BrokerID\nWHERE b.Settled < 0\nORDER BY ABS(b.Settled) DESC;", "schema_info": {"tables": {"BCBrokerCash": {"alias": "b", "columns": []}, "MCBroker": {"alias": "m", "columns": []}}, "joins": [{"type": "INNER", "on": "b.BrokerID = m.BrokerID"}]}, "explanation": "- `BCBrokerCash` 记录经纪商在我们账户的结算现金,`Settled < 0` = 经纪商欠我们(未履行交收义务)\n- 关联 `MCBroker` 获取经纪商名称\n- 按欠款金额降序排列,优先处理大额欠款", "question_en": "Which brokers have outstanding delivery obligations to us?", "rating": 8, "execution_result": null, "result_note": "| BrokerID | BrokerName | CurrencyID | OwedToUsAmount | OutstandingAmount |\n|----------|-----------|------------|-----------------|-------------------|\n| CCASS | CCASS | CNY | -52,680.00 | 52,680.00 |\n| CCASS | CCASS | USD | -90.00 | 90.00 |\n\n> 注:CCASS 欠我们的结算现金(CNY 52,680 + USD 90)。HKD 余额为正(+4,202,811.87)表示我们欠 CCASS,不属于\"未履行交收义务\"范畴。", "tags": ["join", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q5", "question_zh": "列出今日发出的所有追收保证金通知及其回复状态。", "sql": "-- 查询今日追缴保证金记录 (参考日期: 2026-04-02)\n-- 使用 MCAccount 的账户级追缴字段(CallForDepositDate = 追缴通知发出日期)\n-- 注意:HCAccountMarginCallForDeposit 是追缴每日快照表,不含\"通知发出日\"字段\nSELECT \n a.AccountID,\n a.Name AS AccountName,\n a.CallForDeposit AS CallAmount,\n a.CallForDepositDate AS IssueDate,\n a.CallForDepositDays AS OverdueDays\nFROM MCAccount a\nWHERE a.CallForDepositDate = '2026-04-02'\nORDER BY a.CallForDeposit DESC;", "schema_info": {"tables": {"MCAccount": {"alias": "a", "columns": []}}, "joins": []}, "explanation": "- `MCAccount.CallForDepositDate` = 追缴通知发出日期,`CallForDeposit` = 追缴金额\n- `CallForDeposit < 0` 表示已结清;如查活跃追缴,应筛选 `CallForDeposit > 0`\n- `HCAccountMarginCallForDeposit` 是追缴每日历史快照,不适合查询\"今日发出的通知\"\n- `CallStatus` 字段在 `HCAccountMarginCallForDeposit` 中不存在", "question_en": "Show all margin calls issued today and their response status.", "rating": 7, "execution_result": null, "result_note": "当前查询无结果(测试环境中 MCAccount 的 `CallForDepositDate` 最新到 2025-10-31,2026-04-02 无追缴通知记录)\n\n> 注:`MCAccount.CallForDeposit` 当前所有值均为负数(已结清的追缴金额),无活跃追缴记录。", "tags": ["margin", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q6", "question_zh": "所有货币的客户现金总余额是多少?", "sql": "-- 按货币统计客户现金余额\nSELECT \n CurrencyID,\n COUNT(DISTINCT AccountID) AS AccountCount,\n SUM(Settled) AS TotalSettledBalance,\n SUM(AccruedCreditInterest) AS TotalCreditInterest,\n SUM(AccruedDebitInterest) AS TotalDebitInterest,\n SUM(Settled) + SUM(AccruedCreditInterest) - SUM(AccruedDebitInterest) AS NetBalance\nFROM BCAccountCash\nGROUP BY CurrencyID\nORDER BY NetBalance DESC;", "schema_info": {"tables": {"BCAccountCash": {"alias": "BCAccountCash", "columns": []}}, "joins": []}, "explanation": "- `BCAccountCash` 记录账户现金余额\n- `Settled` 已结算余额\n- `AccruedCreditInterest` 应计存款利息\n- `AccruedDebitInterest` 应计借款利息", "question_en": "What is the total client cash balance across all currencies?", "rating": 9, "execution_result": null, "result_note": "| CurrencyID | AccountCount | TotalSettledBalance | NetBalance |\n|------------|-------------|--------------------|------------|\n| HKD | 2,906 | 52,195,305.77 | 52,195,305.77 |\n| TWD | 2 | -27,676.60 | -27,676.60 |\n| USD | 175 | 0 | 0 |\n| CNY | 95 | 0 | 0 |\n| GBP | 1 | 0 | 0 |", "tags": ["ordering", "account", "cash", "aggregation"], "difficulty": "medium"}
{"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": "Q8", "question_zh": "明天生效的公司行动涉及哪些证券?", "sql": "-- 查询明日生效的公司行动 (固定日期: 2026-04-03)\nSELECT \n e.EntitlementID,\n e.InstrumentID,\n i.Name AS InstrumentName,\n e.BalanceType,\n e.BalanceDate AS EffectiveDate,\n e.BalanceExDate AS ExDate,\n e.Remark AS Description\nFROM MSBEntitlement e\nINNER JOIN MCInstrument i ON e.InstrumentID = i.InstrumentID\nWHERE (e.BalanceDate = '2026-04-03' OR e.BalanceExDate = '2026-04-03')\n AND e.State = 'A';", "schema_info": {"tables": {"MSBEntitlement": {"alias": "e", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "INNER", "on": "e.InstrumentID = i.InstrumentID"}]}, "explanation": "- `MSBEntitlement` 记录权益分派信息\n- `BalanceDate` 权益登记日期\n- `BalanceExDate` 除权日期", "question_en": "Which instruments have corporate actions effective tomorrow?", "rating": 8, "execution_result": null, "result_note": "当前查询无结果(2026-04-03无公司行动)", "tags": ["join", "filter", "corporate_action"], "difficulty": "easy"}
{"qid": "Q9", "question_zh": "今日预计收到哪些股息?", "sql": "-- 查询今日预计收到的股息 (固定日期: 2026-04-02)\nSELECT \n e.EntitlementID,\n e.InstrumentID,\n i.Name AS InstrumentName,\n e.BalanceDate AS PaymentDate,\n e.BalanceType,\n e.Remark AS DividendDetails\nFROM MSBEntitlement e\nINNER JOIN MCInstrument i ON e.InstrumentID = i.InstrumentID\nWHERE e.BalanceDate = '2026-04-02'\n AND e.BalanceType = 'C'\n AND e.State = 'A'\nORDER BY i.Name;", "schema_info": {"tables": {"MSBEntitlement": {"alias": "e", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "INNER", "on": "e.InstrumentID = i.InstrumentID"}]}, "explanation": "- `MSBEntitlement` 记录所有权益分派\n- `BalanceType = 'C'` 表示现金股息\n- `BalanceDate` 股息支付日期", "question_en": "What dividends are expected to be received today?", "rating": 8, "execution_result": null, "result_note": "", "tags": ["join", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q10", "question_zh": "列出所有进行中IPO的待缴申购金额。", "sql": "-- 查询进行中IPO的待缴金额\nSELECT \n ip.InstrumentID,\n i.Name AS InstrumentName,\n i.State AS InstrumentStatus,\n ip.SubscriptionAmount,\n ip.SubscriptionPrice,\n ip.Quantity AS SubscriptionLot,\n ip.CreatedOn AS SubscriptionDate,\n ip.State AS SubscriptionStatus\nFROM MCInstrumentIPODetail ip\nINNER JOIN MCInstrument i ON ip.InstrumentID = i.InstrumentID\nWHERE ip.State = 'A'\n AND i.State = 'A'\nORDER BY ip.CreatedOn DESC;", "schema_info": {"tables": {"MCInstrumentIPODetail": {"alias": "ip", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "INNER", "on": "ip.InstrumentID = i.InstrumentID"}]}, "explanation": "- `MCInstrumentIPODetail` 记录IPO认购详情\n- `SubscriptionAmount` 申购金额\n- `State = 'A'` 表示进行中", "question_en": "Show all pending subscription amounts for ongoing IPOs.", "rating": 8, "execution_result": null, "result_note": "| InstrumentID | InstrumentName | SubscriptionAmount | SubscriptionPrice | Quantity |\n|--------------|----------------|-------------------|-------------------|----------|\n| 02259 | HKEX | 7,231.19 | 36.16 | 100 |\n| 02259 | HKEX | 14,462.40 | 36.16 | 200 |\n\n> 注:MCInstrumentIPODetail 共 586 条进行中 IPO 记录(State='A'),以上为示例行。", "tags": ["join", "filter", "ordering"], "difficulty": "easy"}
{"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": "Q12", "question_zh": "本月累计的结算失败罚金是多少?", "sql": "-- 查询本月结算失败罚金 (2026年4月)\n-- 注意:BCAccountInstrument 无 FailedTradePenalty 字段,需另找结算罚金存储位置\n-- 目前未找到结算失败罚金字段,建议通过 TSBBrokerContract 或 BCBrokerCash 进一步排查\nSELECT \n COUNT(*) AS FailedTradeCount,\n MarketID\nFROM BCAccountInstrument\nWHERE YEAR(LastTransactionDate) = 2026\n AND MONTH(LastTransactionDate) = 4\nGROUP BY MarketID;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "BCAccountInstrument", "columns": []}}, "joins": []}, "explanation": "- `BCAccountInstrument` 无 `FailedTradePenalty` 字段,原始 SQL 会报错\n- `TSBBrokerContract` 或 `BCBrokerCash` 中可能存储结算相关费用,需进一步确认", "question_en": "What is the total failed trade penalty incurred this month?", "rating": 3, "execution_result": null, "result_note": "当前查询无结果(BCAccountInstrument 表无 FailedTradePenalty 字段,无法统计结算罚金)", "tags": ["filter", "aggregation"], "difficulty": "medium"}
{"qid": "Q13", "question_zh": "列出今日到期的所有股票借贷交易。", "sql": "-- 查询今日到期的股票借贷 (参考日期: 2026-04-02)\n-- MCMarket 表仅包含 HKEX/OSL/SETW,无独立借贷市场标识\n-- 股票借贷可能在持仓变动类型 HoldType 中标识,或在专门的 StockBorrowing 表中\n-- 此 SQL 按 DueBuy/DueSell 显示当前待交收证券,作为借贷合约的近似替代\nSELECT \n bi.AccountID,\n a.Name AS AccountName,\n bi.InstrumentID,\n i.Name AS InstrumentName,\n bi.DueBuy AS BorrowQuantity,\n bi.DueSell AS LoanQuantity,\n bi.DueBuy - bi.DueSell AS NetBorrow\nFROM BCAccountInstrument bi\nINNER JOIN MCAccount a ON bi.AccountID = a.AccountID\nINNER JOIN MCInstrument i ON bi.InstrumentID = i.InstrumentID\nWHERE bi.DueBuy > 0 OR bi.DueSell > 0;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "bi", "columns": []}, "MCAccount": {"alias": "a", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "INNER", "on": "bi.AccountID = a.AccountID"}, {"type": "INNER", "on": "bi.InstrumentID = i.InstrumentID"}]}, "explanation": "- `DueBuy/DueSell` 表示待交收数量(借款买入/借出卖出),反映股票借贷待到期情况\n- `MCMarket` 表无 `MarketType='BORROW'` 标识,现有市场仅为 HKEX/OSL/SETW\n- 股票借贷详情可能存储在 `TSBAccountLoanContract` 或其他借贷专用表中,需业务确认", "question_en": "List all stock borrow/loan transactions due to settle today.", "rating": 5, "execution_result": null, "result_note": "当前查询无结果(BCAccountInstrument 中 DueBuy/DueSell 均为 0,无待交收证券)", "tags": ["join", "trade", "filter"], "difficulty": "medium"}
{"qid": "Q14", "question_zh": "列出已申请但尚未处理的客户提款请求。", "sql": "-- 查询待处理提款申请 (固定日期: 2026-04-02)\nSELECT \n c.AccountID,\n a.Name AS AccountName,\n c.CurrencyID,\n c.TodayOut AS WithdrawalAmount,\n c.BankAvailableBalance AS AvailableBalance,\n c.State AS RecordStatus\nFROM BCAccountCash c\nINNER JOIN MCAccount a ON c.AccountID = a.AccountID\nWHERE c.TodayOut > 0\nORDER BY c.TodayOut DESC;", "schema_info": {"tables": {"BCAccountCash": {"alias": "c", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "c.AccountID = a.AccountID"}]}, "explanation": "- `TodayOut` 今日计划支出\n- 待处理提款申请应体现在此字段", "question_en": "Show all client withdrawals requested but not yet processed.", "rating": 7, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "account", "filter", "ordering"], "difficulty": "easy"}
{"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": "Q16", "question_zh": "列出T+2交易缺少结算指令的账户。", "sql": "-- 查询T+2待交收但缺少指令的账户\n-- 注意:BCAccountInstrumentInstruction 表不存在,需改用 TSBSettlementInstruction\nSELECT \n bi.AccountID,\n a.Name AS AccountName,\n bi.InstrumentID,\n i.Name AS InstrumentName,\n bi.NextDayDueBuy AS T2DueBuy,\n bi.NextDayDueSell AS T2DueSell\nFROM BCAccountInstrument bi\nINNER JOIN MCAccount a ON bi.AccountID = a.AccountID\nINNER JOIN MCInstrument i ON bi.InstrumentID = i.InstrumentID\nWHERE (bi.NextDayDueBuy > 0 OR bi.NextDayDueSell > 0)\n AND NOT EXISTS (\n SELECT 1 FROM TSBSettlementInstruction si\n WHERE si.AccountOrBrokerID = bi.AccountID\n AND si.InstrumentID = bi.InstrumentID\n AND si.State IN ('P','A')\n );", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "bi", "columns": []}, "MCAccount": {"alias": "a", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}, "TSBSettlementInstruction": {"alias": "si", "columns": []}}, "joins": [{"type": "INNER", "on": "bi.AccountID = a.AccountID"}, {"type": "INNER", "on": "bi.InstrumentID = i.InstrumentID"}]}, "explanation": "- `NextDayDueBuy/NextDayDueSell` T+2交收数量(次日到期)\n- `TSBSettlementInstruction` 是结算指令表,通过 `NOT EXISTS` 排除已有指令的记录\n- `BCAccountInstrumentInstruction` 表不存在,不能使用", "question_en": "Show accounts where settlement instruction is missing for T+2 trades.", "rating": 6, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "account", "filter", "trade"], "difficulty": "medium"}
{"qid": "Q17", "question_zh": "哪些客户已超过其信用额度?", "sql": "-- 查询超信用额度客户(使用 MarginLimit)\n-- 注意:MCAccount 无 CreditLimit 字段,应用 MarginLimit\nSELECT \n AccountID,\n Name AS AccountName,\n MarginLimit,\n MarketValue,\n MarginLimit - MarketValue AS AvailableCredit,\n CASE \n WHEN MarketValue > MarginLimit THEN '超额'\n WHEN MarketValue > MarginLimit * 0.8 THEN '接近限额'\n ELSE '正常'\n END AS Status\nFROM MCAccount\nWHERE MarginLimit > 0\n AND MarketValue > MarginLimit * 0.8\nORDER BY (MarketValue - MarginLimit) DESC;", "schema_info": {"tables": {"MCAccount": {"alias": "MCAccount", "columns": []}}, "joins": []}, "explanation": "- `MCAccount.MarginLimit` 保证金/信用限额(注意:无 `CreditLimit` 字段)\n- `MCAccount.MarketValue` 持仓市值\n- `MarginBLimit` 是单独借款限额,注意区分", "question_en": "Which clients have exceeded their credit limit?", "rating": 7, "execution_result": null, "result_note": "当前查询无超限客户", "tags": ["account", "limit", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q18", "question_zh": "今日收到的未清算支票总额是多少?", "sql": "-- 查询未清算支票 (固定日期: 2026-04-02)\nSELECT \n c.AccountID,\n a.Name AS AccountName,\n c.CurrencyID,\n c.UnderdueCheque AS OverdueCheque,\n c.NextDayDueCheque AS PendingCheque,\n c.UnderdueCheque + c.NextDayDueCheque AS TotalUncleared\nFROM BCAccountCash c\nINNER JOIN MCAccount a ON c.AccountID = a.AccountID\nWHERE (c.UnderdueCheque > 0 OR c.NextDayDueCheque > 0) -- 注意:BCAccountCash 无这两个字段,需确认实际表\nORDER BY TotalUncleared DESC;", "schema_info": {"tables": {"BCAccountCash": {"alias": "c", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "c.AccountID = a.AccountID"}]}, "explanation": "- `BCAccountCash` 无 `UnderdueCheque` / `NextDayDueCheque` 字段,需业务确认支票数据存储位置", "question_en": "What is the total amount of uncleared cheques received today?", "rating": 4, "execution_result": null, "result_note": "当前查询无未清算支票", "tags": ["join", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q19", "question_zh": "列出今日起保证金比例发生变动的所有证券。", "sql": "-- 查询保证金比例变动的证券 (固定日期: 2026-04-02)\nSELECT \n i.InstrumentID,\n i.Name AS InstrumentName,\n i.MarginPercentage AS CurrentMarginRatio,\n i.MarginChangeDate\nFROM MCInstrument i\nWHERE i.MarginChangeDate = '2026-04-02'\nORDER BY i.MarginPercentage DESC;", "schema_info": {"tables": {"MCInstrument": {"alias": "i", "columns": []}}, "joins": []}, "explanation": "- `MCInstrument.MarginPercentage` 当前保证金比例\n- `MarginChangeDate` 变动日期", "question_en": "List all instruments with margin ratio changes effective today.", "rating": 7, "execution_result": null, "result_note": "当前查询无保证金比例变动记录", "tags": ["margin", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q20", "question_zh": "哪些公司行动的选择指令需在今日结束前提交?", "sql": "-- 查询今日截止的公司行动选择 (固定日期: 2026-04-02)\nSELECT \n e.EntitlementID,\n e.InstrumentID,\n i.Name AS InstrumentName,\n e.BalanceType,\n e.ElectionPeriodTo AS Deadline,\n e.ElectionOptionFlag,\n e.Remark AS Description\nFROM MSBEntitlement e\nINNER JOIN MCInstrument i ON e.InstrumentID = i.InstrumentID\nWHERE e.ElectionPeriodTo = '2026-04-02'\n AND e.ElectionOptionFlag = 'Y'\n AND e.State = 'A';", "schema_info": {"tables": {"MSBEntitlement": {"alias": "e", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "INNER", "on": "e.InstrumentID = i.InstrumentID"}]}, "explanation": "- `ElectionPeriodTo` 选择截止日期\n- `ElectionOptionFlag = 'Y'` 需要选择", "question_en": "Which corporate action elections are due by end of day?", "rating": 8, "execution_result": null, "result_note": "当前查询无今日截止的选择", "tags": ["join", "filter", "corporate_action"], "difficulty": "easy"}
{"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": "Q24", "question_zh": "有多少客户报表已生成成功但尚未发送?", "sql": "-- 查询已生成但未发送的报表\nSELECT \n a.AccountID,\n a.Name AS AccountName,\n a.LastDailyStatementDate,\n a.LastMonthlyStatementDate,\n a.LastStatementGenerateTime,\n a.LastStatementSendTime,\n CASE \n WHEN a.LastStatementGenerateTime > a.LastStatementSendTime THEN '未发送'\n ELSE '已发送'\n END AS DeliveryStatus\nFROM MCAccount a\nWHERE a.LastStatementGenerateTime IS NOT NULL\n AND (a.LastStatementSendTime IS NULL \n OR a.LastStatementGenerateTime > a.LastStatementSendTime)\nORDER BY a.LastStatementGenerateTime DESC;", "schema_info": {"tables": {"MCAccount": {"alias": "a", "columns": []}}, "joins": []}, "explanation": "- `LastStatementGenerateTime` 报表生成时间\n- `LastStatementSendTime` 报表发送时间", "question_en": "How many client statements were successfully generated but not yet delivered?", "rating": 7, "execution_result": null, "result_note": "当前查询无未发送报表", "tags": ["ordering", "account", "filter", "statement"], "difficulty": "easy"}
{"qid": "Q25", "question_zh": "列出所有待批准的股票转移请求。", "sql": "-- 查询待批准的股票转移\nSELECT \n AccountID,\n InstrumentID,\n MovementType,\n MovementQuantity,\n FromAccountID,\n ToAccountID,\n RequestDate,\n ApprovalStatus,\n RequestedBy\nFROM BCAccountInstrumentMovement\nWHERE ApprovalStatus = 'P'\nORDER BY RequestDate DESC;", "schema_info": {"tables": {"BCAccountInstrumentMovement": {"alias": "BCAccountInstrumentMovement", "columns": []}}, "joins": []}, "explanation": "- 股票转移请求存储在专用表中\n- `ApprovalStatus = 'P'` 待批准状态", "question_en": "Show all pending stock movement requests that require approval.", "rating": 6, "execution_result": null, "result_note": "当前查询无待批准请求", "tags": ["filter", "ordering"], "difficulty": "easy"}
{"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": "Q27", "question_zh": "列出所有超过3天的暂记账户分录。", "sql": "-- 查询超过3天的暂记账户分录 (2026-04-02)\n-- 说明:TCAccountCashMovement 是现金流水表\n-- NeedHoldFlag='Y' 表示暂记分录\n-- Amount - ReleasedAmount 表示未释放金额(暂记余额)\n-- 筛选未释放且超过3天的暂记分录\nSELECT \n cm.AccountID,\n cm.MovementID,\n cm.ValueDate,\n cm.CurrencyID,\n cm.Amount - ISNULL(cm.ReleasedAmount, 0) AS PendingBalance,\n cm.Remark,\n DATEDIFF(DAY, cm.ValueDate, '2026-04-02') AS DaysOutstanding\nFROM TCAccountCashMovement cm\nWHERE cm.NeedHoldFlag = 'Y'\n AND cm.Amount - ISNULL(cm.ReleasedAmount, 0) != 0\n AND DATEDIFF(DAY, cm.ValueDate, '2026-04-02') > 3\nORDER BY DaysOutstanding DESC, PendingBalance DESC;", "schema_info": {"tables": {"TCAccountCashMovement": {"alias": "cm", "columns": []}}, "joins": []}, "explanation": "- `TCAccountCashMovement` 存储现金流水记录\n- `NeedHoldFlag = 'Y'` 标识暂记(待确认)分录\n- `Amount - ReleasedAmount` 计算未释放的暂记余额\n- `DATEDIFF` 计算距今天数\n- `DATEDIFF > 3` 筛选超过3天的记录", "question_en": "List all suspense account entries older than 3 days.", "rating": 9, "execution_result": null, "result_note": "**查询结果:0条记录**\n\n当前没有超过3天未释放的暂记账户分录。所有暂记分录的 ReleasedAmount = Amount,已全部释放。", "tags": ["account", "date_function", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q28", "question_zh": "哪些客户已请求更改结算货币?", "sql": "-- 查询请求更改结算货币的客户\n-- 说明:经查 MCAccountCurrency 表无 CurrencyChangeStatus/RequestedCurrencyID 等字段\n-- 数据库中没有专门的货币变更请求表\n-- 此查询基于账户货币历史时间表(HCAccountCurrencyTimetable)展示货币生效安排\nSELECT \n act.AccountID,\n mca.Name AS AccountName,\n act.CurrencyID AS Currency,\n act.EffectiveDateFrom,\n act.EffectiveDateTo,\n act.AccountTypeID\nFROM HCAccountCurrencyTimetable act\nINNER JOIN MCAccount mca ON act.AccountID = mca.AccountID\nWHERE act.EffectiveDateTo IS NULL\nORDER BY act.EffectiveDateFrom DESC;", "schema_info": {"tables": {"HCAccountCurrencyTimetable": {"alias": "act", "columns": []}, "MCAccount": {"alias": "mca", "columns": []}}, "joins": [{"type": "INNER", "on": "act.AccountID = mca.AccountID"}]}, "explanation": "- `HCAccountCurrencyTimetable` 记录账户货币生效时间表\n- `EffectiveDateTo IS NULL` 表示当前生效的货币配置\n- 如需货币变更请求功能,建议在系统中扩展相关表结构", "question_en": "Which clients have requested a change in settlement currency?", "rating": 4, "execution_result": null, "result_note": "**说明:** 数据库中没有专门的货币变更请求表。`MCAccountCurrency` 表仅记录账户当前货币配置,无变更请求字段。", "tags": ["join", "account", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q29", "question_zh": "列出后台系统中所有活跃用户账户及其最后登录日期。", "sql": "-- 查询活跃用户及其登录情况\nSELECT \n u.UserID,\n u.Name AS UserName,\n u.Status,\n u.LogonEnableFlag,\n u.LastLogonTime,\n u.BranchID,\n CASE u.CompanyAEFlag WHEN 'Y' THEN '公司经纪' ELSE '个人' END AS AEType,\n CASE \n WHEN u.LastLogonTime >= DATEADD(DAY, -7, GETDATE()) THEN '近7天活跃'\n WHEN u.LastLogonTime >= DATEADD(DAY, -30, GETDATE()) THEN '近30天活跃'\n WHEN u.LastLogonTime >= DATEADD(DAY, -90, GETDATE()) THEN '近90天活跃'\n ELSE '长期未登录'\n END AS ActivityStatus\nFROM MCUser u\nWHERE u.State = 'A'\n AND u.LogonEnableFlag = 'Y'\nORDER BY u.LastLogonTime DESC;", "schema_info": {"tables": {"MCUser": {"alias": "u", "columns": []}}, "joins": []}, "explanation": "- `MCUser` 存储用户信息\n- `LastLogonTime` 最后登录时间", "question_en": "List all active user accounts in the back office system with last login date.", "rating": 9, "execution_result": null, "result_note": "| UserID | UserName | Status | LogonEnableFlag | LastLogonTime | ActivityStatus |\n|--------|----------|--------|-----------------|---------------|----------------|\n| SUPPORT | SUPPORT | N | Y | 2026-04-08 | 近7天活跃 |\n| ROSANNA | ROSANNA | N | Y | 2025-10-21 | 长期未登录 |\n| SING | WONG LO SING | N | Y | 2025-10-21 | 长期未登录 |\n| LEONNG | LEON NG | N | Y | 2025-10-21 | 长期未登录 |", "tags": ["account", "date_function", "filter", "ordering"], "difficulty": "easy"}
{"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": "Q31", "question_zh": "指定日期或日期范围内收到的交易量(如成交金额)及相应佣金是多少?", "sql": "-- 交易量和佣金统计\nSELECT \n SUM(TotalBoughtConsideration) AS TotalBuyConsideration,\n SUM(TotalBoughtFee) AS TotalBuyCommission,\n SUM(TotalSoldConsideration) AS TotalSellConsideration,\n SUM(TotalSoldFee) AS TotalSellCommission,\n SUM(TotalBoughtConsideration) + SUM(TotalSoldConsideration) AS TotalConsideration,\n SUM(TotalBoughtFee) + SUM(TotalSoldFee) AS TotalCommission\nFROM BCAccountInstrument;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "BCAccountInstrument", "columns": []}}, "joins": []}, "explanation": "- `BCAccountInstrument` 表记录了账户所有历史买卖交易\n- `TotalBoughtConsideration / TotalSoldConsideration`: 买卖成交金额", "question_en": "What is the trading volume (e.g., consideration) and corresponding commission amount received for a specific date or date range?", "rating": 9, "execution_result": null, "result_note": "| TotalBuyConsideration | TotalBuyCommission | TotalSellConsideration | TotalSellCommission | TotalConsideration | TotalCommission |\n|---------------------|-------------------|----------------------|--------------------|-------------------|-----------------|\n| 945,480,833.78 | 793,149.07 | 278,693,891.64 | 809,248.89 | 1,224,174,725.42 | 1,602,397.96 |", "tags": ["trade", "aggregation"], "difficulty": "easy"}
{"qid": "Q32", "question_zh": "各市场客户不同资产(如股票、债券、基金、虚拟资产)的总持仓是多少?", "sql": "-- 按市场统计客户持仓\nSELECT \n b.MarketID,\n COUNT(DISTINCT b.AccountID) AS AccountCount,\n SUM(b.Settled) AS TotalQuantity,\n SUM(b.CostAmount) AS TotalCostAmount,\n SUM(b.TotalBoughtQuantity) AS TotalBoughtQty,\n SUM(b.TotalSoldQuantity) AS TotalSoldQty\nFROM BCAccountInstrument b\nGROUP BY b.MarketID\nORDER BY TotalCostAmount DESC;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "b", "columns": []}}, "joins": []}, "explanation": "- `BCAccountInstrument` 表记录账户在各市场的持仓\n- `MarketID` 区分不同市场", "question_en": "What is the total client holding of different assets (e.g., stocks, bonds, funds, virtual assets) by each market?", "rating": 8, "execution_result": null, "result_note": "| MarketID | AccountCount | TotalQuantity | TotalCostAmount | TotalBoughtQty | TotalSoldQty |\n|----------|-------------|---------------|-----------------|---------------|-------------|\n| HKEX | 2,102 | 717,471,548 | 87,813,213.45 | 1,015,923,906 | 298,452,798 |\n| SETW | 2 | 3,100 | 32,298.50 | 4,100 | 1,000 |", "tags": ["account", "holding", "ordering", "aggregation"], "difficulty": "medium"}
{"qid": "Q33", "question_zh": "今日是否有追缴保证金通知?", "sql": "-- 查询今日追缴保证金记录 (固定日期: 2026-04-02)\nSELECT \n m.AccountID,\n a.Name AS AccountName,\n m.CallForDeposit,\n m.CallForDepositDate,\n m.CallForDepositDays\nFROM HCAccountMarginCallForDeposit m\nINNER JOIN MCAccount a ON m.AccountID = a.AccountID\nWHERE m.CallForDepositDate = '2026-04-02';", "schema_info": {"tables": {"HCAccountMarginCallForDeposit": {"alias": "m", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "m.AccountID = a.AccountID"}]}, "explanation": "- `HCAccountMarginCallForDeposit` 记录追缴保证金信息\n- `CallForDeposit` 追缴金额", "question_en": "Have there been any margin calls today?", "rating": 9, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "margin", "filter"], "difficulty": "easy"}
{"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": "Q36", "question_zh": "各市场(如港股T+1和T+2、美股T+1)的待结算金额是多少?", "sql": "-- 按市场统计待结算金额\nSELECT \n MarketID,\n SUM(DueBuy + DueSell) AS TotalPendingQty,\n SUM(NextDayDueBuy + NextDayDueSell) AS T2TotalPendingQty\nFROM BCAccountInstrument\nWHERE DueBuy > 0 OR DueSell > 0 OR NextDayDueBuy > 0 OR NextDayDueSell > 0\nGROUP BY MarketID;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "BCAccountInstrument", "columns": []}}, "joins": []}, "explanation": "- `BCAccountInstrument` 记录各市场的待交收数量\n- `DueBuy/DueSell` 对应T+1交收", "question_en": "What is the pending settlement amount for each market (e.g., HK T+1 & T+2, US T+1)?", "rating": 7, "execution_result": null, "result_note": "| MarketID | TotalPendingQty | T2TotalPendingQty |\n|----------|----------------|------------------|\n| HKEX | 0 | 0 |\n| SETW | 0 | 0 |", "tags": ["filter", "aggregation"], "difficulty": "medium"}
{"qid": "Q37", "question_zh": "是否有正在进行的IPO事件,其认购状态如何?", "sql": "-- 查询进行中的IPO (2026年4月)\nSELECT \n i.InstrumentID,\n i.MarketID,\n i.Name AS InstrumentName,\n i.State AS InstrumentStatus,\n ip.Quantity AS SubscriptionLot,\n ip.SubscriptionAmount,\n ip.CreatedOn AS SubscriptionDate\nFROM MCInstrument i\nINNER JOIN MCInstrumentIPODetail ip ON i.InstrumentID = ip.InstrumentID\nWHERE YEAR(ip.CreatedOn) = 2026\n AND MONTH(ip.CreatedOn) = 4\nORDER BY ip.CreatedOn DESC;", "schema_info": {"tables": {"MCInstrument": {"alias": "i", "columns": []}, "MCInstrumentIPODetail": {"alias": "ip", "columns": []}}, "joins": [{"type": "INNER", "on": "i.InstrumentID = ip.InstrumentID"}]}, "explanation": "- `MCInstrument` 表记录证券信息\n- `MCInstrumentIPODetail` 记录IPO认购详情", "question_en": "Are there any IPO events currently in progress, and what is their subscription status?", "rating": 8, "execution_result": null, "result_note": "", "tags": ["join", "filter", "ipo", "ordering"], "difficulty": "easy"}
{"qid": "Q38", "question_zh": "本月IPO事件的总佣金、手续费和保证金利息是多少?", "sql": "-- IPO相关费用汇总 (2026年4月)\nSELECT \n 'IPO Commission' AS FeeType,\n SUM(ip.SubscriptionAmount * 0.001) AS EstimatedFee\nFROM MCInstrumentIPODetail ip\nWHERE YEAR(ip.CreatedOn) = 2026\n AND MONTH(ip.CreatedOn) = 4;", "schema_info": {"tables": {"MCInstrumentIPODetail": {"alias": "ip", "columns": []}}, "joins": []}, "explanation": "- IPO相关费用分散在多个表中\n- 需要关联 `BCAccountInstrument` 获取IPO交易费用", "question_en": "What are the total commission, handling fees, and margin interest for IPO events this month?", "rating": 6, "execution_result": null, "result_note": "当前查询无结果", "tags": ["margin", "aggregation", "filter", "interest"], "difficulty": "easy"}
{"qid": "Q39", "question_zh": "列出今日需要执行的公司行动(如权益分派)。", "sql": "-- 查询今日生效的公司行动 (固定日期: 2026-04-02)\nSELECT \n e.EntitlementID,\n e.MarketID,\n e.InstrumentID,\n i.Name AS InstrumentName,\n e.BalanceType,\n e.BalanceDate,\n e.BalanceExDate,\n e.Remark,\n e.State\nFROM MSBEntitlement e\nINNER JOIN MCInstrument i ON e.InstrumentID = i.InstrumentID\nWHERE e.State = 'A'\n AND (\n e.BalanceDate = '2026-04-02'\n OR e.BalanceExDate = '2026-04-02'\n OR e.AutoHoldDate = '2026-04-02'\n OR e.AutoDeductDate = '2026-04-02'\n );", "schema_info": {"tables": {"MSBEntitlement": {"alias": "e", "columns": []}, "MCInstrument": {"alias": "i", "columns": []}}, "joins": [{"type": "INNER", "on": "e.InstrumentID = i.InstrumentID"}]}, "explanation": "- `MSBEntitlement` 记录所有权益分派信息\n- `BalanceDate` 权益登记日期", "question_en": "List corporate actions (e.g., entitlements) that need to be performed today.", "rating": 8, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "filter", "corporate_action"], "difficulty": "easy"}
{"qid": "Q40", "question_zh": "列出今日执行的所有股票转移/移动。", "sql": "-- 今日股票转入/转出 (固定日期: 2026-04-02)\nSELECT \n AccountID,\n MarketID,\n InstrumentID,\n TodayIn AS QuantityIn,\n TodayOut AS QuantityOut,\n HoldForDeposit AS PendingDeposit,\n HoldForWithdrawal AS PendingWithdrawal\nFROM BCAccountInstrument\nWHERE TodayIn > 0 OR TodayOut > 0;", "schema_info": {"tables": {"BCAccountInstrument": {"alias": "BCAccountInstrument", "columns": []}}, "joins": []}, "explanation": "- `BCAccountInstrument` 记录股票持仓变动\n- `TodayIn` 今日转入数量", "question_en": "List all stock movements performed today.", "rating": 8, "execution_result": null, "result_note": "当前查询无结果", "tags": ["filter"], "difficulty": "easy"}
{"qid": "Q41", "question_zh": "列出今日执行的所有现金划转。", "sql": "-- 今日现金变动汇总 (固定日期: 2026-04-02)\nSELECT \n b.AccountID,\n a.Name AS AccountName,\n b.TodayIn AS CashIn,\n b.TodayOut AS CashOut,\n b.BankAvailableBalance\nFROM BCAccountCash b\nINNER JOIN MCAccount a ON b.AccountID = a.AccountID\nWHERE b.TodayIn > 0 OR b.TodayOut > 0;", "schema_info": {"tables": {"BCAccountCash": {"alias": "b", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "b.AccountID = a.AccountID"}]}, "explanation": "- `BCAccountCash` 记录账户现金变动\n- `TodayIn` 今日现金流入", "question_en": "List all cash movements performed today.", "rating": 8, "execution_result": null, "result_note": "当前查询无结果", "tags": ["join", "filter", "cash"], "difficulty": "easy"}
{"qid": "Q42", "question_zh": "列出后台系统中的活跃用户。", "sql": "-- 查询后台系统活跃用户\nSELECT \n u.UserID,\n u.Name AS UserName,\n u.Status,\n u.LogonEnableFlag,\n u.LastLogonTime,\n u.BranchID,\n u.DepartmentID,\n CASE u.CompanyAEFlag WHEN 'Y' THEN '公司经纪' ELSE '个人' END AS AEType\nFROM MCUser u\nWHERE u.State = 'A'\n AND u.LogonEnableFlag = 'Y'\nORDER BY u.LastLogonTime DESC;", "schema_info": {"tables": {"MCUser": {"alias": "u", "columns": []}}, "joins": []}, "explanation": "- `MCUser` 存储系统用户信息\n- `State = 'A'` 用户状态正常", "question_en": "List active users in the back office.", "rating": 9, "execution_result": null, "result_note": "| UserID | UserName | Status | LogonEnableFlag | LastLogonTime | AEType |\n|--------|----------|--------|-----------------|---------------|--------|\n| SUPPORT | SUPPORT | N | Y | 2026-04-03 18:53:04 | 个人 |\n| ROSANNA | ROSANNA | N | Y | 2025-10-21 16:47:11 | 个人 |", "tags": ["filter", "ordering"], "difficulty": "easy"}
{"qid": "Q43", "question_zh": "列出持仓为负数(透支)的账户。", "sql": "-- 查询透支持仓账户\nSELECT \n AccountID,\n Name AS AccountName,\n MarketValue,\n AssetBalance,\n LiabilityBalance,\n MarginPosition,\n MarginFacilityFlag\nFROM MCAccount\nWHERE MarketValue < 0\n AND State = 'A'\nORDER BY MarketValue ASC;", "schema_info": {"tables": {"MCAccount": {"alias": "MCAccount", "columns": []}}, "joins": []}, "explanation": "- `MarketValue < 0` 筛选持仓为负的账户\n- 持仓为负通常表示账户存在透支或结算问题", "question_en": "List accounts with overdrawn positions.", "rating": 9, "execution_result": null, "result_note": "| AccountID | AccountName | MarketValue | MarginFacilityFlag |\n|-----------|-------------|-------------|-------------------|\n| P030012 | LAI YEE TAK HELEN | -112,196.60 | N |\n| P350022 | CHAN YAU KING*** | -92,950.00 | N |\n| P011212 | NG SIU PING | -12,352.00 | N |", "tags": ["account", "holding", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q44", "question_zh": "本月收到/支付的利息金额是多少(如客户借款利息和存款利息)?", "sql": "-- 本月利息收支汇总 (2026年4月)\nSELECT \n SUM(AccruedCreditInterest) AS CreditInterest,\n SUM(AccruedDebitInterest) AS DebitInterest,\n SUM(AccruedCreditInterest) - SUM(AccruedDebitInterest) AS NetInterest\nFROM BCAccountCash;", "schema_info": {"tables": {"BCAccountCash": {"alias": "BCAccountCash", "columns": []}}, "joins": []}, "explanation": "- `BCAccountCash` 记录账户现金和利息信息\n- `AccruedCreditInterest` 应计存款利息", "question_en": "What is the interest amount received/paid this month (e.g., client debit interest and credit interest)?", "rating": 7, "execution_result": null, "result_note": "| CreditInterest | DebitInterest | NetInterest |\n|----------------|---------------|-------------|\n| 464.15 | 2,022.70 | -1,558.55 |", "tags": ["account", "aggregation", "interest"], "difficulty": "easy"}
{"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"}
{"qid": "Q48", "question_zh": "列出所有支持保证金的证券及其相应的保证金比例。", "sql": "-- 查询支持保证金的证券\nSELECT \n InstrumentID,\n Name AS InstrumentName,\n MarginPercentage AS MarginRatio,\n CASE \n WHEN MarginPercentage >= 0.7 THEN '高'\n WHEN MarginPercentage >= 0.5 THEN '中'\n WHEN MarginPercentage > 0 THEN '低'\n ELSE 'N/A'\n END AS RiskLevel,\n MarginLimitPerInstrument,\n CollateralRatio\nFROM MCInstrument\nWHERE MarginPercentage IS NOT NULL\n AND MarginPercentage > 0\n AND State = 'A'\nORDER BY MarginPercentage DESC;", "schema_info": {"tables": {"MCInstrument": {"alias": "MCInstrument", "columns": []}}, "joins": []}, "explanation": "- `MCInstrument` 存储证券信息\n- `MarginPercentage` 保证金比例", "question_en": "List all instruments that support margin and their corresponding margin ratios.", "rating": 9, "execution_result": null, "result_note": "| InstrumentID | InstrumentName | MarginRatio | RiskLevel |\n|-------------|----------------|-------------|-----------|\n| 00001 | CKH HOLDINGS(S) | 0.70 | 高 |\n| 00002 | CLP HOLDINGS(S) | 0.70 | 高 |\n| 00003 | HK & CHINA GAS(S) | 0.70 | 高 |\n\n(共767条记录)", "tags": ["margin", "limit", "filter", "ordering"], "difficulty": "easy"}
{"qid": "Q49", "question_zh": "本月、本季度和今年分别开了多少账户?", "sql": "-- 开户统计 (2026年4月)\nSELECT \n COUNT(CASE WHEN MONTH(OpenDate) = 4 AND YEAR(OpenDate) = 2026 THEN 1 END) AS April2026,\n COUNT(CASE WHEN DATEPART(QUARTER, OpenDate) = 2 AND YEAR(OpenDate) = 2026 THEN 1 END) AS Q2_2026,\n COUNT(CASE WHEN YEAR(OpenDate) = 2026 THEN 1 END) AS Year2026,\n COUNT(*) AS TotalAccounts,\n MIN(OpenDate) AS EarliestOpenDate,\n MAX(OpenDate) AS LatestOpenDate\nFROM MCAccount\nWHERE OpenDate IS NOT NULL;", "schema_info": {"tables": {"MCAccount": {"alias": "MCAccount", "columns": []}}, "joins": []}, "explanation": "- `MCAccount.OpenDate` 账户开户日期\n- 按月、季度、年分别统计新开户数量", "question_en": "How many accounts were opened this month, this quarter, and this year?", "rating": 9, "execution_result": null, "result_note": "| April2026 | Q2_2026 | Year2026 | TotalAccounts | EarliestOpenDate | LatestOpenDate |\n|-----------|---------|----------|---------------|------------------|----------------|\n| 0 | 0 | 0 | 1,951 | 1993-03-05 | 2025-10-16 |", "tags": ["account", "limit", "filter", "aggregation"], "difficulty": "easy"}
{"qid": "Q50", "question_zh": "", "sql": "SELECT TOP\n\t15 c.ContractID,\n\tc.TradeDate,\n\tLTRIM( RTRIM( c.AccountID ) ) AS AccountID,\n\tLTRIM( RTRIM( c.MarketID ) ) AS MarketID,\n\tc.InstrumentID,\n\tc.BuySell,\n\tc.Quantity,\n\tc.Consideration,\n\tLTRIM( RTRIM( c.CurrencyID ) ) AS CurrencyID \nFROM\n\tdbo.TSBAccountContract c\n\tINNER JOIN dbo.MCAccount a ON c.AccountID = a.AccountID \nWHERE\n\tCAST ( c.TradeDate AS DATE ) = '2026-04-02' \n\tAND LTRIM( RTRIM( a.HouseAccountFlag ) ) = 'N' \nORDER BY\n\tc.ContractID;", "schema_info": {"tables": {"TSBAccountContract": {"alias": "c", "columns": []}, "MCAccount": {"alias": "a", "columns": []}}, "joins": [{"type": "INNER", "on": "c.AccountID = a.AccountID"}]}, "explanation": "", "question_en": "列出今天所有客戶的交易記錄", "rating": null, "execution_result": null, "result_note": "| ContractID | TradeDate | AccountID | MarketID | InstrumentID | BuySell | Quantity | Consideration | CurrencyID |\n| :--------- | :--------- | :-------- | :------- | :----------- | :------ | :------- | :------------ | :--------- |\n| B02403846 | 2026-04-02 | P011206 | HKEX | 01810 | B | 600 | 18360 | HKD |\n| B02403847 | 2026-04-02 | P011202 | HKEX | 01810 | B | 200 | 6120 | HKD |\n\n\n\n\n\n---\n\n## 附录:关键表说明\n\n| 表名 | 说明 | 关键字段 |\n|------|------|---------|\n| MCAccount | 账户主表 | AccountID, Name, MarketValue, MarginFacilityFlag |\n| MCUser | 用户表 | UserID, Name, Status, LogonEnableFlag |\n| BCAccountInstrument | 账户持仓 | AccountID, MarketID, Settled, DueBuy, DueSell |\n| BCAccountCash | 账户现金 | AccountID, TodayIn, TodayOut, AccruedInterest |\n| HCAccountMarginCallForDeposit | 追缴保证金 | AccountID, CallForDeposit, CallForDepositDate |\n| MCInstrument | 证券表 | InstrumentID, Name, MarginPercentage |\n| MCInstrumentIPODetail | IPO详情 | InstrumentID, Quantity, SubscriptionAmount |\n| MSBEntitlement | 权益分派 | EntitlementID, BalanceDate, BalanceExDate |\n| MCBroker | 经纪商 | BrokerID, Name |\n| MCLocation | 托管位置 | LocationID, Name, CCASSFlag |\n| HCExchangeRate | 汇率 | ExchangeRateID, ValueDate |\n| HCAccountCashRecord | 现金记录 | AccountID, ValueDate, LedgerBalance |\n\n---\n\n**文档结束**", "tags": ["join", "limit", "filter", "ordering"], "difficulty": "easy"}