input
stringlengths 201
2.7k
| output
stringlengths 24
744
|
|---|---|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many customers are active? [/INST] [/INST]
|
SELECT COUNT(customer_id) FROM customer WHERE active = 1;
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among all the customers of store no.1, how many of them are active? [/INST] [/INST]
|
SELECT COUNT(customer_id) FROM customer WHERE active = 1 AND store_id = 1;
|
[INST] Here is a database schema:
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the address of Mary Smith? [/INST] [/INST]
|
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH';
|
[INST] Here is a database schema:
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among all the active customers, how many of them live in Arlington? [/INST] [/INST]
|
SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington';
|
[INST] Here is a database schema:
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the full names of all the customers who live in Italy. [/INST] [/INST]
|
SELECT T4.first_name, T4.last_name FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T3.country = 'Italy';
|
[INST] Here is a database schema:
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which country does Mary Smith live in? [/INST] [/INST]
|
SELECT T3.country FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T4.first_name = 'MARY' AND T4.last_name = 'SMITH';
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the biggest amount of payment for a rental made by Mary Smith? [/INST] [/INST]
|
SELECT T1.amount FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' ORDER BY T1.amount DESC LIMIT 1;
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many times has Mary Smith rented a film? [/INST] [/INST]
|
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH';
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the total amount of money Mary Smith has spent on film rentals? [/INST] [/INST]
|
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH';
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the times Mary Smith had rented a movie, how many of them happened in June, 2005? [/INST] [/INST]
|
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6';
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please give the full name of the customer who had made the biggest amount of payment in one single film rental. [/INST] [/INST]
|
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.amount DESC LIMIT 1;
|
[INST] Here is a database schema:
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How much in total had the customers in Italy spent on film rentals? [/INST] [/INST]
|
SELECT SUM(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy';
|
[INST] Here is a database schema:
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the payments made by Mary Smith, how many of them are over 4.99? [/INST] [/INST]
|
SELECT COUNT(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND T1.amount > 4.99;
|
[INST] Here is a database schema:
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average amount of money spent by a customer in Italy on a single film rental? [/INST] [/INST]
|
SELECT AVG(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy';
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.