"Run a read-only SQL query on a `database_id` which will return up rows of data related to the query. The query must only be SELECT statements which do not modify the table data. There should be a reasonable LIMIT on the return quantity to prevent long-running or queries which crash the db.",
examples:[
{
prompt:"How many customers are in dvd-rentals?",
call:JSON.stringify({
database_id:"dvd-rentals",
sql_query:"SELECT * FROM customers",
}),
},
{
prompt:"Can you tell me the total volume of sales last month?",
call:JSON.stringify({
database_id:"sales-db",
sql_query:
"SELECT SUM(sale_amount) AS total_sales FROM sales WHERE sale_date >= DATEADD(month, -1, DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1)) AND sale_date < DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1)",
}),
},
{
prompt:
"Do we have anyone in the staff table for our production db named 'sam'? ",
call:JSON.stringify({
database_id:"production",
sql_query:
"SElECT * FROM staff WHERE first_name='sam%' OR last_name='sam%'",