{"slug": "ai-sqlazy-from-sql-novice-to-expert", "title": "AI+SQLazy: From SQL Novice to Expert", "summary": "The team behind SQLazy released a tool that uses AI to help users express query logic as readable, step-by-step plain-language operations, then compiles those steps deterministically into SQL. Instead of having a model generate the final SQL directly, SQLazy keeps each intermediate step visible and editable, so changes touch only the affected step and the query does not drift between runs. The compiler emits CTEs and window functions automatically and can target multiple databases such as MySQL and PostgreSQL.", "body_md": "SQL looks like English, but it is not. A requirement you can state in one sentence becomes dozens of lines of nesting, with syntax picky enough to make a beginner give up.\n\nThen AI arrived, and at last you could “write” SQL: tell it what you need and the SQL appears. And then? You cannot read it. Ask the same question again and you get a different statement. Change one requirement and it produces a whole new version: everything you read and edited before is wasted. You have been at this for months and you are still a novice.\n\nAI is not the problem. The problem is the way we use it: letting AI spit out the final SQL. What AI hands you is a finished product, with no view of how it was computed, so you either trust it or start over. Want to change one step? You cannot; you ask for another version, and it drifts further from what you had in mind.\n\nWith SQLazy, AI helps you organize the logic and write out the calculation steps; you read and confirm them; the rest goes to the SQLazy compiler:\n\n```\nmytable:sort ID, CreatedAt asc\nsegment condition (NewStatus = \"ConfirmationStarted\"); partition ID; as seg\nfilter (NewStatus = \"Closed\" and seg = 1)\nsummarize max CreatedAt as CreatedAt; group ID\n```\n\nPlain language, one idea per step: even without SQL skills you can follow the logic. Broken into steps, easy to read: that is the real difference between SQLazy and asking AI to write SQL directly.\n\nEvery intermediate result is there whenever you want it; fix the step that is off. A change touches only that step, so the query does not drift.\n\nAnd then? Compile it into SQL:\n\n```\nWITH t2 AS (\n        SELECT CreatedAt, ID, NewStatus\n            , 1 + SUM(CASE\n                WHEN (NewStatus = 'ConfirmationStarted') THEN 1\n                ELSE 0\n            END) OVER (PARTITION BY ID ORDER BY ID ASC, CreatedAt ASC ROWS UNBOUNDED PRECEDING) AS seg\n        FROM mytable\n    )\nSELECT ID, MAX(CreatedAt) AS CreatedAt\nFROM (\n    SELECT CreatedAt, ID, NewStatus, seg\n    FROM t2\n    WHERE (NewStatus = 'Closed'\n        AND seg = 1)\n) t_3\nGROUP BY ID\nORDER BY ID\n```\n\nCTE nesting, window functions: none of it is your concern. However complex the query gets, the compiler handles it.\n\nSame logic, same output, every time. People define the logic, the compiler generates the SQL: no probability, no hallucination.\n\nNeed another database? Compile again: MySQL or PostgreSQL, take your pick.\n\nNovice to expert was never about memorizing syntax. It is about having query logic you can read, change, and hand over. SQLazy gives you that logic, AI helps you say what you mean. Start writing, and you become the expert along the way.", "url": "https://wpnews.pro/news/ai-sqlazy-from-sql-novice-to-expert", "canonical_source": "https://dev.to/esproc_spl/aisqlazy-from-sql-novice-to-expert-4nfc", "published_at": "2026-12-01 06:41:37+00:00", "updated_at": "2026-12-01 06:44:50.380392+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models", "ai-products"], "entities": ["SQLazy", "MySQL", "PostgreSQL"], "also_reported_by": [], "takeaway": "Having AI produce intermediate, human-readable query steps that a deterministic compiler turns into SQL avoids the drift and hallucination of asking a model for the final SQL directly.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/ai-sqlazy-from-sql-novice-to-expert", "markdown": "https://wpnews.pro/news/ai-sqlazy-from-sql-novice-to-expert.md", "text": "https://wpnews.pro/news/ai-sqlazy-from-sql-novice-to-expert.txt", "jsonld": "https://wpnews.pro/news/ai-sqlazy-from-sql-novice-to-expert.jsonld"}}