SQL Code Generator
Text generator - SQL code generation examples
Example input
-
-- Select the least selling product from the products table -- query.sql SELECT MIN
Open this prompt in Playground
Example real generated results
-
star
To select a "least-selling" item, you cannot simply use `MIN` on an integer column (like ID or Name), as that would return lexicographically smallest values. Instead: 1️⃣ **Join** with sales/transactions to get quantity sold per SKU 2️🔢 Aggregate total quantities by ProductID/SKU using SUM() / COUNT(*) 3 📉 Find minimum sum/count via subquery/window function OR ORDER BY LIMIT → ⚠ Avoid
try it yourself: Text Generator Playground - SQL Code Generator
Sign up