first commit

This commit is contained in:
陈辅元
2026-04-10 16:52:07 +08:00
commit 84fe545640
87 changed files with 20842 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
{"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": "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": "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": "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": "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": "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": "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": "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": "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": "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"}