Hacker News new | ask | show | jobs
by DeathArrow 1321 days ago
I would love to see a tool which uses GPT-3 to generate SQL from English.

Like: give me a list of all customers from London who purchased in January a laptop with more than 16GB of RAM and used a coupon between 10% and 25%. Sort it by price payd.

1 comments

Everything required to make the tool already exists.

Just ran your exact query through OpenAI's Codex (model: code-davinci-002), and this was the result:

SELECT * FROM customers WHERE city = 'London' AND purchase_date BETWEEN '2019-01-01' AND '2019-01-31' AND product_name = 'laptop' AND product_ram > 16 AND coupon_percentage BETWEEN 10 AND 25 ORDER BY price_paid DESC;

I'd say it's pretty damn accurate.