instruction large_stringclasses 1
value | input large_stringlengths 49 249 | output large_stringlengths 135 574 |
|---|---|---|
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: How many budgets are above 3000 in year 2001 or before? | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: Count the number of budgets in year 2001 or before whose budgeted amount is greater than 3000 | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: Show each school name, its budgeted amount, and invested amount in year 2002 or after. | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.school_name , T1.budgeted , T1.invested FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.year >= 2002
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: Show all donor names. | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT donator_name FROM endowment
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: How many budget record has a budget amount smaller than the invested amount? | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM budget WHERE budgeted < invested
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: What is the total budget amount for school "Glenn" in all years? | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT sum(T1.budgeted) FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: Show the names of schools with a total budget amount greater than 100 or a total endowment greater than 10. | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.school_name FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN endowment AS T3 ON T2.school_id = T3.school_id GROUP BY T2.school_name HAVING sum(T1.budgeted) > 100 OR... |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: Find the names of schools that have more than one donator with donation amount above 8.5. | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.School_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.amount > 8.5 GROUP BY T1.school_id HAVING count(*) > 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: Find the number of schools that have more than one donator whose donation amount is less than 8.5. | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM (SELECT * FROM endowment WHERE amount > 8.5 GROUP BY school_id HAVING count(*) > 1)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: school_finance
Question: List the name, IHSAA Football Class, and Mascot of the schools that have more than 6000 of budgeted amount or were founded before 2003, in the order of percent of total invested budget and total budgeted budget. | <think>
Analyze the request for database 'school_finance' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.School_name , T1.Mascot , T1.IHSAA_Football_Class FROM school AS T1 JOIN budget AS T2 ON T1.school_id = T2.school_id WHERE Budgeted > 6000 OR YEAR < 2003 ORDER BY T2.total_budget_percen... |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: How many buildings are there? | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM building
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the name, street address, and number of floors for all buildings ordered by the number of floors. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT name , street_address , floors FROM building ORDER BY floors
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: What is the name of the tallest building? | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT name FROM building ORDER BY height_feet DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: What are the average, maximum, and minimum number of floors for all buildings? | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT avg(floors) , max(floors) , min(floors) FROM building
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the number of buildings with a height above the average or a number of floors above the average. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM building WHERE height_feet > (SELECT avg(height_feet) FROM building) OR floors > (SELECT avg(floors) FROM building)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: List the names of buildings with at least 200 feet of height and with at least 20 floors. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT name FROM building WHERE height_feet >= 200 AND floors >= 20
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the names and locations of institutions that are founded after 1990 and have the type "Private". | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT institution , LOCATION FROM institution WHERE founded > 1990 AND TYPE = 'Private'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show institution types, along with the number of institutions and total enrollment for each type. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT TYPE , count(*) , sum(enrollment) FROM institution GROUP BY TYPE
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the institution type with the largest number of institutions. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT TYPE FROM institution GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the institution type with an institution founded after 1990 and an institution with at least 1000 enrollment. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT TYPE FROM institution WHERE founded > 1990 AND enrollment >= 1000
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the name of buildings that do not have any institution. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT name FROM building WHERE building_id NOT IN (SELECT building_id FROM institution)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the names of buildings except for those having an institution founded in 2003. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT name FROM building EXCEPT SELECT T1.name FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded = 2003
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: For each building, show the name of the building and the number of institutions in it. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.name , count(*) FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the names and heights of buildings with at least two institutions founded after 1880. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.name , T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded > 1880 GROUP BY T1.building_id HAVING count(*) >= 2
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show all the distinct institution types. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT TYPE FROM institution
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show institution names along with the number of proteins for each institution. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.institution , count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id GROUP BY T1.institution_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: How many proteins are associated with an institution founded after 1880 or an institution with type "Private"? | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id WHERE T1.founded > 1880 OR T1.type = 'Private'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: Show the protein name and the institution name. | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.protein_name , T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: How many proteins are associated with an institution in a building with at least 20 floors? | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id JOIN building AS T3 ON T3.building_id = T1.building_id WHERE T3.floors >= 20
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: protein_institute
Question: How many institutions do not have an associated protein in our record? | <think>
Analyze the request for database 'protein_institute' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM institution WHERE institution_id NOT IN (SELECT institution_id FROM protein)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show all the locations where no cinema has capacity over 800. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show all the locations where some cinemas were opened in both year 2010 and year 2011. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema WHERE openning_year = 2010 INTERSECT SELECT LOCATION FROM cinema WHERE openning_year = 2011
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: How many cinema do we have? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM cinema
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Count the number of cinemas. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM cinema
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show name, opening year, and capacity for each cinema. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT name , openning_year , capacity FROM cinema
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show the cinema name and location for cinemas with capacity above average. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT name , LOCATION FROM cinema WHERE capacity > (SELECT avg(capacity) FROM cinema)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What are all the locations with a cinema? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT LOCATION FROM cinema
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Find the distinct locations that has a cinema. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT LOCATION FROM cinema
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show all the cinema names and opening years in descending order of opening year. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT name , openning_year FROM cinema ORDER BY openning_year DESC
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What are the name and location of the cinema with the largest capacity? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT name , LOCATION FROM cinema ORDER BY capacity DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show the average, minimum, and maximum capacity for all the cinemas opened in year 2011 or later. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT avg(capacity) , min(capacity) , max(capacity) FROM cinema WHERE openning_year >= 2011
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show each location and the number of cinemas there. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION , count(*) FROM cinema GROUP BY LOCATION
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What is the location with the most cinemas opened in year 2010 or later? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show all the locations with at least two cinemas with capacity above 300. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) >= 2
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Which locations have 2 or more cinemas with capacity over 300? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) >= 2
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show the title and director for all films. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT title , directed_by FROM film
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What are the title and director of each film? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT title , directed_by FROM film
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show all directors. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT directed_by FROM film
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Who are all the directors? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT directed_by FROM film
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: List all directors along with the number of films directed by each director. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT directed_by , count(*) FROM film GROUP BY directed_by
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What is total number of show times per dat for each cinema? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.name , sum(T1.show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.cinema_id = T2.cinema_id GROUP BY T1.cinema_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What are the title and maximum price of each film? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.title , max(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Give me the title and highest price for each film. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.title , max(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show cinema name, film title, date, and price for each record in schedule. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT T3.name , T2.title , T1.date , T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN cinema AS T3 ON T1.cinema_id = T3.cinema_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: What are the title and director of the films without any schedule? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT title , directed_by FROM film WHERE film_id NOT IN (SELECT film_id FROM schedule)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Show director with the largest number of show times in total. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY sum(T1.show_times_per_day) DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Find the locations that have more than one movie theater with capacity above 300. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) > 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: In which locations are there more than one movie theater with capacity above 300? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) > 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: How many films have the word 'Dummy' in their titles? | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM film WHERE title LIKE "%Dummy%"
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: cinema
Question: Count the number of films whose title contains the word 'Dummy'. | <think>
Analyze the request for database 'cinema' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM film WHERE title LIKE "%Dummy%"
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: Are the customers holding coupons with amount 500 bad or good? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.coupon_amount = 500
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: How many bookings did each customer make? List the customer id, first name, and the count. | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.customer_id , T1.first_name , count(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What is the maximum total amount paid by a customer? List the customer id and amount. | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT customer_id , sum(amount_paid) FROM Payments GROUP BY customer_id ORDER BY sum(amount_paid) DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the id and the amount of refund of the booking that incurred the most times of payments? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.booking_id , T1.amount_of_refund FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id = T2.booking_id GROUP BY T1.booking_id ORDER BY count(*) DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What is the id of the product that is booked for 3 times? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT product_id FROM products_booked GROUP BY product_id HAVING count(*) = 3
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What is the product description of the product booked with an amount of 102.76? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the start date and end date of the booking that has booked the product named 'Book collection A'? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T3.booking_start_date , T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T3.booking_id W... |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the names of products whose availability equals to 1? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.available_yn = 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: How many different product types are there? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT count(DISTINCT product_type_code) FROM products_for_hire
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the first name, last name, and gender of all the good customers? Order by their last name. | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT first_name , last_name , gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What is the average amount due for all the payments? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT avg(amount_due) FROM payments
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the maximum, minimum, and average booked count for the products booked? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT max(booked_count) , min(booked_count) , avg(booked_count) FROM products_booked
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are all the distinct payment types? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT payment_type_code FROM payments
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the daily hire costs for the products with substring 'Book' in its name? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: How many products are never booked with amount higher than 200? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM Products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount > 200 )
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the coupon amount of the coupons owned by both good and bad customers? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupo... |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check' | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: products_for_hire
Question: What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20? | <think>
Analyze the request for database 'products_for_hire' and construct the corresponding SQL query.
</think>
```sql
SELECT product_name , product_description FROM products_for_hire WHERE product_type_code = 'Cutlery' AND daily_hire_cost < 20
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: How many phones are there? | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM phone
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: List the names of phones in ascending order of price. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Name FROM phone ORDER BY Price ASC
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: What are the memories and carriers of phones? | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Memory_in_G , Carrier FROM phone
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: List the distinct carriers of phones with memories bigger than 32. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the names of phones with carrier either "Sprint" or "TMobile". | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Name FROM phone WHERE Carrier = "Sprint" OR Carrier = "TMobile"
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: What is the carrier of the most expensive phone? | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Carrier FROM phone ORDER BY Price DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show different carriers of phones together with the number of phones with each carrier. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Carrier , COUNT(*) FROM phone GROUP BY Carrier
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the most frequently used carrier of the phones. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Carrier FROM phone WHERE Memory_in_G < 32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G > 64
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the names of phones and the districts of markets they are on. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT T3.Name , T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the names of phones and the districts of markets they are on, in ascending order of the ranking of the market. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT T3.Name , T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID ORDER BY T2.Ranking
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the names of phones that are on market with number of shops greater than 50. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID WHERE T2.Num_of_shops > 50
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: For each phone, show its names and total number of stocks. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.Name , sum(T1.Num_of_stock) FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name HAVING sum(T1.Num_of_stock) >= 2000 ORDER BY sum(T1.Num_of_stock) DESC
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: phone_market
Question: List the names of phones that are not on any market. | <think>
Analyze the request for database 'phone_market' and construct the corresponding SQL query.
</think>
```sql
SELECT Name FROM phone WHERE Phone_id NOT IN (SELECT Phone_ID FROM phone_market)
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: How many gas companies are there? | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM company
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: What is the total number of companies? | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT count(*) FROM company
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: List the company name and rank for all companies in the decreasing order of their sales. | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT company , rank FROM company ORDER BY Sales_billion DESC
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: What is the name and rank of every company ordered by descending number of sales? | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT company , rank FROM company ORDER BY Sales_billion DESC
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: Show the company name and the main industry for all companies whose headquarters are not from USA. | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT company , main_industry FROM company WHERE headquarters != 'USA'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: What are the companies and main industries of all companies that are not headquartered in the United States? | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT company , main_industry FROM company WHERE headquarters != 'USA'
``` |
You are an expert SQL assistant. Given the database schema and question, write the correct SQL query wrapped in a reasoning block. | Database ID: gas_company
Question: Show all company names and headquarters in the descending order of market value. | <think>
Analyze the request for database 'gas_company' and construct the corresponding SQL query.
</think>
```sql
SELECT company , headquarters FROM company ORDER BY market_value DESC
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.