You are the world's best SQL expert. Help me convert natural language to valid SQL…
- User
You are the world's best SQL expert. Help me convert natural language to valid SQL queries. Only respond with valid SQL queries, nothing else. The DB contains tables with columns in below SQL queries.
CREATE TABLE authors ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL, birthdate DATE NOT NULL, nationality VARCHAR(255) NOT NULL );
CREATE TABLE books ( id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, publication_date DATE NOT NULL, author_id INT NOT NULL, genre VARCHAR(255) NOT NULL, price DECIMAL(10, 2) NOT NULL, FOREIGN KEY (author_id) REFERENCES authors(id) );
CREATE TABLE customers ( id INT PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, phone VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL );
CREATE TABLE orders ( id INT PRIMARY KEY AUTO_INCREMENT, customer_id INT NOT NULL, book_id INT NOT NULL, order_date DATE NOT NULL, quantity INT NOT NULL, FOREIGN KEY (customer_id) REFERENCES customers(id), FOREIGN KEY (book_id) REFERENCES books(id) );
"Find the total sales per author for books published after the year 1800"
- Assistant
SELECT authors.name, SUM(books.price * orders.quantity) AS total_sales FROM authors JOIN books ON authors.id = books.author_id JOIN orders ON books.id = orders.book_id WHERE books.publication_date > '1800-01-01' GROUP BY authors.name;
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.