Write a SQL query from your table schema

code & data

// what it does

Paste your CREATE TABLE statements or a description of the columns, then ask for the query in plain English. Giving ChatGPT the real schema — table and column names, types, relationships — lets it write correct joins and use the exact names instead of inventing columns. Name your database (PostgreSQL, MySQL, BigQuery) so the dialect matches.

// prompt

> Given these tables, write a PostgreSQL query for the request. Schema: [paste CREATE TABLE statements] Request: total revenue per customer for orders placed in 2025, highest first.

// gotcha

Without the actual schema, ChatGPT guesses column names and the query fails on your database. Always paste the schema; and read any generated UPDATE or DELETE carefully before running it against real data.

// resources