Files
controls-web/ai_agents/db_agent/context/examples.json
2026-02-17 09:29:34 -06:00

28 lines
1.8 KiB
JSON

[
{
"question": "How many loads were completed yesterday?",
"sql": "SELECT COUNT(*) AS load_count\nFROM dbo.SugarLoadData\nWHERE DateOut >= CAST(DATEADD(day, -1, CAST(SYSDATETIME() AS date)) AS datetime)\n AND DateOut < CAST(SYSDATETIME() AS date);",
"notes": "Uses DateOut to ensure the truck exited; bounds the window on the local date."
},
{
"question": "Show the top 5 heaviest loads in the past week.",
"sql": "SELECT TOP (5) SugarLoadID_Pk, VehicleId_Fk, GrossWt, TareWt, Tons, DateOut\nFROM dbo.SugarLoadData\nWHERE DateOut >= DATEADD(day, -7, SYSDATETIME())\nORDER BY GrossWt DESC;",
"notes": "Ranks by gross weight; includes net/tare columns for context."
},
{
"question": "List average payload tons per hauling company for the last 30 days.",
"sql": "SELECT TCompanyName, AVG(Tons) AS avg_tons, COUNT(*) AS load_count\nFROM dbo.SugarLoadData\nWHERE DateOut >= DATEADD(day, -30, SYSDATETIME())\n AND Tons IS NOT NULL\nGROUP BY TCompanyName\nORDER BY avg_tons DESC;",
"notes": "Filters out null payloads and groups by company for business comparison."
},
{
"question": "Which vehicles have missing tare weights on recent loads?",
"sql": "SELECT VehicleId_Fk, COUNT(*) AS missing_tare_count\nFROM dbo.SugarLoadData\nWHERE DateOut >= DATEADD(day, -14, SYSDATETIME())\n AND (TareWt IS NULL OR TareWt = 0)\nGROUP BY VehicleId_Fk\nORDER BY missing_tare_count DESC;",
"notes": "Helps operations schedule tare recalibration."
},
{
"question": "Provide hourly load counts for the current day.",
"sql": "SELECT DATEPART(hour, DateOut) AS hour_of_day, COUNT(*) AS loads\nFROM dbo.SugarLoadData\nWHERE DateOut >= CAST(SYSDATETIME() AS date)\nGROUP BY DATEPART(hour, DateOut)\nORDER BY hour_of_day;",
"notes": "Generates time-series data for real-time dashboards; assumes DateOut in local timezone."
}
]