[{"data":1,"prerenderedAt":204},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fai-chat\u002Fgenerate-sql":3},{"id":4,"title":5,"body":6,"description":195,"extension":196,"meta":197,"navigation":198,"path":199,"redirect":200,"seo":201,"stem":202,"__hash__":203},"docs\u002Fdocs\u002Fai-chat\u002Fgenerate-sql.md","Generate SQL",{"type":7,"value":8,"toc":185},"minimark",[9,13,28,33,79,87,93,100,112,117,123,127,150,154],[10,11,5],"h1",{"id":12},"generate-sql",[14,15,16,17,22,23,27],"p",{},"Next to any SQL console, the same assistant that powers ",[18,19,21],"a",{"href":20},"\u002Fdocs\u002Fai-chat","AI Chat","\nworks ",[24,25,26],"strong",{},"inside the editor",": describe what you want and it writes the SQL in\nplace. Use it when you'd rather get a query than have a conversation.",[29,30,32],"h2",{"id":31},"write-a-query-from-plain-language","Write a query from plain language",[34,35,36,44,64],"ol",{},[37,38,39,40,43],"li",{},"Open a SQL console in ",[24,41,42],{},"Data Explorer"," and focus the editor.",[37,45,46,47,53,54,59,60,63],{},"Press ",[24,48,49],{},[50,51,52],"code",{},"⌘K"," (macOS) \u002F ",[24,55,56],{},[50,57,58],{},"Ctrl+K",", type a request —\n",[50,61,62],{},"top 10 customers by total payments, with their city"," — and run it.",[37,65,66,67,70,71,74,75,78],{},"The generated SQL is written straight into the editor and ",[24,68,69],{},"highlighted in\nplace",", with ",[24,72,73],{},"Keep"," and ",[24,76,77],{},"Revert",".",[80,81],"img",{"className":82,"src":85,"alt":86},[83,84],"block","dark:hidden","\u002Fdocs\u002Fimages\u002Fgenerated\u002Fgenerate-sql-review-light.png","Generated SQL highlighted in the editor with Revert and Keep actions",[80,88],{"className":89,"src":92,"alt":86},[90,91],"hidden","dark:block","\u002Fdocs\u002Fimages\u002Fgenerated\u002Fgenerate-sql-review-dark.png",[14,94,95,96,99],{},"Because it's the same engine, it can write ",[24,97,98],{},"federated"," queries across multiple\nattached sources (a database + a folder of CSVs), not just single-source SQL.",[101,102,103],"blockquote",{},[14,104,105,108,109,111],{},[24,106,107],{},"Your existing query is safe."," A generated query you didn't want never\noverwrites the one you had — ",[24,110,77],{}," puts it back.",[113,114,116],"h3",{"id":115},"rewrite-only-a-selection","Rewrite only a selection",[14,118,119,120,122],{},"Select part of the query first, then press ",[50,121,52],{},": only those lines are rewritten,\nand the rest is left untouched. Good for \"make this join a LEFT join\" or \"add a\ndate filter to this subquery\".",[29,124,126],{"id":125},"talk-it-through-instead","Talk it through instead",[14,128,129,131,132,137,138,141,142,144,145,149],{},[50,130,52],{}," writes for you; ",[24,133,134],{},[50,135,136],{},"⌘L"," (",[50,139,140],{},"Ctrl+L",") opens ",[24,143,21],{}," with the current query\nattached, so you can ",[146,147,148],"em",{},"discuss"," it — \"explain this\", \"why is it slow\", \"what would\nbreak if I changed the join\" — and only send it a follow-up when you're ready.",[29,151,153],{"id":152},"next","Next",[155,156,157,164,171,178],"ul",{},[37,158,159,163],{},[18,160,162],{"href":161},"\u002Fdocs\u002Fai-chat\u002Fusing-ai-chat","Using AI Chat"," — the conversational side.",[37,165,166,170],{},[18,167,169],{"href":168},"\u002Fdocs\u002Fai-chat\u002Ffix-failed-query","Fix a failed query"," — repair an error without\nlosing the query you started with.",[37,172,173,177],{},[18,174,176],{"href":175},"\u002Fdocs\u002Fdatabase-explorer\u002Fsql-console","SQL console"," — the editor itself.",[37,179,180,184],{},[18,181,183],{"href":182},"\u002Fdocs\u002Fdatabase-explorer\u002Ffederated-queries","Federated queries"," — querying across\nsources.",{"title":186,"searchDepth":187,"depth":187,"links":188},"",2,[189,193,194],{"id":31,"depth":187,"text":32,"children":190},[191],{"id":115,"depth":192,"text":116},3,{"id":125,"depth":187,"text":126},{"id":152,"depth":187,"text":153},"Write and fix SQL from plain language right in the DBConvert Streams editor with ⌘K \u002F Ctrl+K — the same engine as AI Chat, aimed at the query instead of a conversation.","md",{},false,"\u002Fdocs\u002Fai-chat\u002Fgenerate-sql",null,{"title":5,"description":195},"docs\u002Fai-chat\u002Fgenerate-sql","338UF7gcoJXH2hCf5-05B77AtiqMjamgxUx1aQe1fqI",1784670668678]