instruction_seed stringlengths 305 1.28k | response_seed stringclasses 1
value | response stringlengths 7 2.05k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|---|
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (name VARCHAR, age VARCHAR)
Question: Show the name of drivers in descending order of age.
Here is the SQLite query to answer to the question: Show the name of dr... | Here is the SQLite query to answer the question of showing the name of drivers in descending order of age:
```
SELECT name FROM driver ORDER BY age DESC
``` | 3,600 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (name VARCHAR, age VARCHAR)\n\n Question: Show the name of drivers in descending order of age.\n\nHere is the SQLite query ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (home_city VARCHAR)
Question: Show all different home cities.
Here is the SQLite query to answer to the question: Show all different home cities.:
```
SELECT DIST... | Your SQLite query looks correct for retrieving all different home cities from the `driver` table. Here it is formatted as requested:
```
SELECT DISTINCT home_city FROM driver
``` | 3,601 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (home_city VARCHAR)\n\n Question: Show all different home cities.\n\nHere is the SQLite query to answer to the question: Sh... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (home_city VARCHAR)
Question: Show the home city with the most number of drivers.
Here is the SQLite query to answer to the question: Show the home city with the ... | Your SQLite query looks correct. It will retrieve the home city with the highest number of drivers from the `driver` table. Here is the query wrapped as you requested:
```
SELECT home_city FROM driver GROUP BY home_city ORDER BY COUNT(*) DESC LIMIT 1
```
This query groups the results by `home_city`, counts the numbe... | 3,602 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (home_city VARCHAR)\n\n Question: Show the home city with the most number of drivers.\n\nHere is the SQLite query to answer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (party VARCHAR, home_city VARCHAR, age VARCHAR)
Question: Show the party with drivers from Hartford and drivers older than 40.
Here is the SQLite query to answer ... | Here is the SQLite query to answer the question of showing the party with drivers from Hartford and drivers older than 40:
```
SELECT party FROM driver WHERE home_city = 'Hartford' AND CAST(age AS INTEGER) > 40
``` | 3,603 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (party VARCHAR, home_city VARCHAR, age VARCHAR)\n\n Question: Show the party with drivers from Hartford and drivers older t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (home_city VARCHAR, age INTEGER)
Question: Show home city where at least two drivers older than 40 are from.
Here is the SQLite query to answer to the question: S... | Your SQLite query is correctly formulated to answer the question. Here it is wrapped in code formatting as requested:
```
SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING COUNT(*) >= 2
```
This query will return the home cities where at least two drivers are older than 40. | 3,604 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (home_city VARCHAR, age INTEGER)\n\n Question: Show home city where at least two drivers older than 40 are from.\n\nHere is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (home_city VARCHAR, age INTEGER)
Question: Show all home cities except for those having a driver older than 40.
Here is the SQLite query to answer to the question... | Here is the SQLite query to answer the question as you've requested:
```
SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40
``` | 3,605 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (home_city VARCHAR, age INTEGER)\n\n Question: Show all home cities except for those having a driver older than 40.\n\nHere... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school_bus (name VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
Question: Show the names of the drivers without a school bus.
Here is... | Your SQLite query to show the names of the drivers without a school bus is correct. Here it is wrapped in code formatting:
```
SELECT name FROM driver WHERE NOT driver_id IN (SELECT driver_id FROM school_bus);
```
Alternatively, you could also write it using a LEFT JOIN to achieve the same result:
```
SELECT d.name... | 3,606 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school_bus (name VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)\n\n Question: Show the names o... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school (TYPE VARCHAR)
Question: Show the types of schools that have two schools.
Here is the SQLite query to answer to the question: Show the types of schools that have ... | Your provided SQLite query is correct for the question posed. It selects the types of schools from the `school` table that have exactly two entries.
Here is the query wrapped in code formatting:
```
SELECT TYPE FROM school GROUP BY TYPE HAVING COUNT(*) = 2;
```
This will return the types of schools that have exact... | 3,607 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school (TYPE VARCHAR)\n\n Question: Show the types of schools that have two schools.\n\nHere is the SQLite query to answer to the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school (school VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
Question... | Here's the SQLite query to answer the question:
```
SELECT T2.school, T3.name
FROM school_bus AS T1
JOIN school AS T2 ON T1.school_id = T2.school_id
JOIN driver AS T3 ON T1.driver_id = T3.driver_id;
``` | 3,608 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school (school VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school_bus (years_working INTEGER)
Question: What is the maximum, minimum and average years spent working on a school bus?
Here is the SQLite query to answer to the ques... | Here is the SQLite query to answer the question regarding the maximum, minimum, and average years spent working on a school bus:
```
SELECT MAX(years_working), MIN(years_working), AVG(years_working) FROM school_bus;
``` | 3,609 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school_bus (years_working INTEGER)\n\n Question: What is the maximum, minimum and average years spent working on a school bus?\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school_bus (school VARCHAR, TYPE VARCHAR, school_id VARCHAR); CREATE TABLE school (school VARCHAR, TYPE VARCHAR, school_id VARCHAR)
Question: Show the school name and typ... | Your SQLite query looks good! Here it is wrapped properly:
```sql
SELECT school, TYPE
FROM school
WHERE school_id NOT IN (SELECT school_id FROM school_bus);
```
This query selects the school name and type from the `school` table where the `school_id` is not present in the `school_bus` table, effectively giving you... | 3,610 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school_bus (school VARCHAR, TYPE VARCHAR, school_id VARCHAR); CREATE TABLE school (school VARCHAR, TYPE VARCHAR, school_id VARCHAR)\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school (type VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR)
Question: Show the type of school and the number of buses for each type.
Here is th... | Here is the SQLite query to show the type of school and the number of buses for each type:
```
SELECT T2.type, COUNT(*) AS number_of_buses
FROM school_bus AS T1
JOIN school AS T2
ON T1.school_id = T2.school_id
GROUP BY T2.type;
``` | 3,611 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school (type VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR)\n\n Question: Show the type of school and th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (home_city VARCHAR, age VARCHAR)
Question: How many drivers are from Hartford city or younger than 40?
Here is the SQLite query to answer to the question: How man... | Here is the SQLite query to answer the question:
```
SELECT COUNT(*) FROM driver WHERE home_city = 'Hartford' OR age < 40
``` | 3,612 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (home_city VARCHAR, age VARCHAR)\n\n Question: How many drivers are from Hartford city or younger than 40?\n\nHere is the S... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE driver (name VARCHAR, home_city VARCHAR, age VARCHAR)
Question: List names for drivers from Hartford city and younger than 40.
Here is the SQLite query to answer to the ... | Here is the SQLite query to list names for drivers from Hartford city and younger than 40:
```
SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40
``` | 3,613 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE driver (name VARCHAR, home_city VARCHAR, age VARCHAR)\n\n Question: List names for drivers from Hartford city and younger than 40.... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE school_bus (driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
Question: find the name of driver who is driving the school bus with the longest wor... | To find the name of the driver who is driving the school bus with the longest working history, you would need to have a way to quantify "working history". Since the schema provided does not include any information about years of working or any date records, let's assume the table `driver` includes a column for `years_w... | 3,614 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE school_bus (driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)\n\n Question: find the name of driver who is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE flight (velocity INTEGER)
Question: How many flights have a velocity larger than 200?
Here is the SQLite query to answer to the question: How many flights have a velocit... | Your SQLite query to count how many flights have a velocity larger than 200 is correct. Here it is wrapped in code format:
```
SELECT COUNT(*) FROM flight WHERE velocity > 200;
``` | 3,615 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE flight (velocity INTEGER)\n\n Question: How many flights have a velocity larger than 200?\n\nHere is the SQLite query to answer to... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE flight (vehicle_flight_number VARCHAR, date VARCHAR, pilot VARCHAR, altitude VARCHAR)
Question: List the vehicle flight number, date and pilot of all the flights, ordered... | Here is the SQLite query as requested:
```
SELECT vehicle_flight_number, date, pilot FROM flight ORDER BY altitude;
``` | 3,616 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE flight (vehicle_flight_number VARCHAR, date VARCHAR, pilot VARCHAR, altitude VARCHAR)\n\n Question: List the vehicle flight number... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (id VARCHAR, country VARCHAR, city VARCHAR, name VARCHAR)
Question: List the id, country, city and name of the airports ordered alphabetically by the name.
Here ... | Here is the SQLite query to list the id, country, city, and name of the airports ordered alphabetically by the name:
```
SELECT id, country, city, name FROM airport ORDER BY name;
``` | 3,617 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (id VARCHAR, country VARCHAR, city VARCHAR, name VARCHAR)\n\n Question: List the id, country, city and name of the airport... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE operate_company (group_equity_shareholding INTEGER)
Question: What is maximum group equity shareholding of the companies?
Here is the SQLite query to answer to the quest... | Your provided SQLite query is correct for finding the maximum group equity shareholding of the companies. Here it is wrapped in the appropriate code block:
```
SELECT MAX(group_equity_shareholding) FROM operate_company;
``` | 3,618 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE operate_company (group_equity_shareholding INTEGER)\n\n Question: What is maximum group equity shareholding of the companies?\n\nH... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE flight (velocity INTEGER, pilot VARCHAR)
Question: What is the velocity of the pilot named 'Thompson'?
Here is the SQLite query to answer to the question: What is the ve... | To retrieve the velocity of the pilot named 'Thompson', you can use the following SQLite query:
```
SELECT velocity FROM flight WHERE pilot = 'Thompson';
``` | 3,619 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE flight (velocity INTEGER, pilot VARCHAR)\n\n Question: What is the velocity of the pilot named 'Thompson'?\n\nHere is the SQLite q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE operate_company (name VARCHAR, type VARCHAR, id VARCHAR); CREATE TABLE flight (Id VARCHAR)
Question: What are the names and types of the companies that have ever operated... | Your SQLite query seems to be on the right track but contains a small error since the `flight` table in your provided schema does not indicate that it has a `company_id` field. Assuming there is a relationship between `operate_company` and `flight`, I will modify it appropriately. Here is how the correct query would lo... | 3,620 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE operate_company (name VARCHAR, type VARCHAR, id VARCHAR); CREATE TABLE flight (Id VARCHAR)\n\n Question: What are the names and ty... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (name VARCHAR, country VARCHAR)
Question: What are the names of the airports which are not in the country 'Iceland'?
Here is the SQLite query to answer to the qu... | Here is the SQLite query to find the names of the airports which are not in the country 'Iceland':
```
SELECT name FROM airport WHERE country <> 'Iceland'
``` | 3,621 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (name VARCHAR, country VARCHAR)\n\n Question: What are the names of the airports which are not in the country 'Iceland'?\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (type VARCHAR, id VARCHAR)
Question: What are the distinct types of the companies that have operated any flights with ve... | The provided query aims to retrieve the distinct types of companies that have operated flights with a velocity less than 200. However, there seems to be a missing column in the `flight` table (`company_id` is referenced but not defined in the schema). Assuming the `flight` table should have a reference to the `operate_... | 3,622 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (type VARCHAR, id VARCHAR)\n\n Question: What are the distinct types of the comp... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR, name VARCHAR)
Question: What are the ids and names of the companies that operated more than one flight?
He... | Your SQLite query is almost correct, but it seems there is a missing reference for `company_id` in the `flight` table, which is not defined in the provided schema. Assuming that the `flight` table should have a `company_id` column that references the `operate_company` table, here’s the correct version of the query:
``... | 3,623 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR, name VARCHAR)\n\n Question: What are the ids and names of the compa... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (id VARCHAR, name VARCHAR, IATA VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR)
Question: What is the id, name and IATA code of the airport that ha... | The SQLite query you provided is almost correct, but there is a slight issue in the `GROUP BY` clause. You need to group by the airport characteristics in the `airport` table rather than the `flight` table.
Here is the corrected query to find the airport with the most flights, ensuring we group by the appropriate fiel... | 3,624 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (id VARCHAR, name VARCHAR, IATA VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR)\n\n Question: What is the i... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (id VARCHAR, country VARCHAR, name VARCHAR); CREATE TABLE flight (pilot VARCHAR, airport_id VARCHAR)
Question: What are the different pilot names who had piloted ... | Here is the SQLite query to answer the question regarding the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport':
```sql
SELECT DISTINCT T2.pilot
FROM airport AS T1
JOIN flight AS T2 ON T1.id = T2.airport_id
WHERE T1.country = 'United States' OR T... | 3,625 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (id VARCHAR, country VARCHAR, name VARCHAR); CREATE TABLE flight (pilot VARCHAR, airport_id VARCHAR)\n\n Question: What ar... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE operate_company (TYPE VARCHAR)
Question: What is the most common company type, and how many are there?
Here is the SQLite query to answer to the question: What is the mo... | Your SQLite query is correct for finding the most common company type and counting how many there are. Here it is wrapped as you requested:
```
SELECT TYPE, COUNT(*) AS count
FROM operate_company
GROUP BY TYPE
ORDER BY count DESC
LIMIT 1;
``` | 3,626 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE operate_company (TYPE VARCHAR)\n\n Question: What is the most common company type, and how many are there?\n\nHere is the SQLite q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (id VARCHAR, airport_id VARCHAR, pilot VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR, pilot VARCHAR)
Question: How many airports haven't the pilot... | Your SQLite query is on the right track, but it needs a slight adjustment to ensure it counts the correct airports that have not been associated with the pilot 'Thompson' in the flight table. Here’s the corrected SQLite query:
```sql
SELECT COUNT(*)
FROM airport
WHERE airport_id NOT IN (SELECT DISTINCT airport_id FR... | 3,627 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (id VARCHAR, airport_id VARCHAR, pilot VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR, pilot VARCHAR)\n\n Q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE operate_company (id VARCHAR, principal_activities VARCHAR); CREATE TABLE flight (Id VARCHAR)
Question: List the name of the pilots who have flied for both a company that ... | The provided SQLite query contains a few inaccuracies, especially regarding the table structure and join conditions. The schema includes only `operate_company` and `flight`, but does not reference pilots or the necessary relationships that would link pilots to flights and companies. Therefore, we need to assume there a... | 3,628 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE operate_company (id VARCHAR, principal_activities VARCHAR); CREATE TABLE flight (Id VARCHAR)\n\n Question: List the name of the pi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (name VARCHAR)
Question: Which of the airport names contains the word 'international'?
Here is the SQLite query to answer to the question: Which of the airport n... | Your provided SQLite query is correct. Here it is wrapped in the requested format:
```
SELECT name FROM airport WHERE name LIKE '%international%'
``` | 3,629 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (name VARCHAR)\n\n Question: Which of the airport names contains the word 'international'?\n\nHere is the SQLite query to ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (id VARCHAR); CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR)
Question: How many companies operates airlines in each airport?
Here is... | Your provided query structure is largely correct, but there are a few minor adjustments needed for clarity and correctness. Specifically, I assume there is a proper relationship between the flight and operate_company tables involving a `company_id`. Here’s the corrected version:
```sql
SELECT T3.id AS airport_id, COUN... | 3,630 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (id VARCHAR); CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR)\n\n Question: How many companies... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (country VARCHAR)
Question: how many airports are there in each country?
Here is the SQLite query to answer to the question: how many airports are there in each ... | Your provided SQLite query is correct for counting the number of airports in each country based on the given schema. Here it is wrapped properly as you requested:
```
SELECT COUNT(*), country FROM airport GROUP BY country;
```
This query will return the count of airports grouped by each country in the `airport` tabl... | 3,631 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (country VARCHAR)\n\n Question: how many airports are there in each country?\n\nHere is the SQLite query to answer to the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE airport (country VARCHAR)
Question: which countries have more than 2 airports?
Here is the SQLite query to answer to the question: which countries have more than 2 airpo... | Your provided SQLite query is correct for the question asked. It will return the countries that have more than 2 airports by grouping the records by country and applying a HAVING clause to filter those groups.
Here’s the properly formatted query:
```sql
SELECT country FROM airport GROUP BY country HAVING COUNT(*) > 2... | 3,632 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE airport (country VARCHAR)\n\n Question: which countries have more than 2 airports?\n\nHere is the SQLite query to answer to the qu... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE flight (pilot VARCHAR)
Question: which pilot is in charge of the most number of flights?
Here is the SQLite query to answer to the question: which pilot is in charge of ... | The SQLite query you provided correctly identifies the pilot in charge of the most number of flights. Here it is wrapped in the specified format:
```
SELECT pilot FROM flight GROUP BY pilot ORDER BY COUNT(*) DESC LIMIT 1
``` | 3,633 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE flight (pilot VARCHAR)\n\n Question: which pilot is in charge of the most number of flights?\n\nHere is the SQLite query to answer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Accounts (account_id VARCHAR, account_details VARCHAR)
Question: Show all account ids and account details.
Here is the SQLite query to answer to the question: Show all a... | Here is the SQLite query to show all account ids and account details:
```
SELECT account_id, account_details FROM Accounts;
``` | 3,634 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Accounts (account_id VARCHAR, account_details VARCHAR)\n\n Question: Show all account ids and account details.\n\nHere is the SQLi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Statements (Id VARCHAR)
Question: How many statements do we have?
Here is the SQLite query to answer to the question: How many statements do we have?:
```
SELECT COUNT(*... | Here is the SQLite query to answer the question "How many statements do we have?":
```
SELECT COUNT(*) FROM Statements;
``` | 3,635 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Statements (Id VARCHAR)\n\n Question: How many statements do we have?\n\nHere is the SQLite query to answer to the question: How m... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Statements (STATEMENT_ID VARCHAR, statement_details VARCHAR)
Question: List all statement ids and statement details.
Here is the SQLite query to answer to the question: ... | Here is the SQLite query to list all statement ids and statement details:
```
SELECT STATEMENT_ID, statement_details FROM Statements;
``` | 3,636 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Statements (STATEMENT_ID VARCHAR, statement_details VARCHAR)\n\n Question: List all statement ids and statement details.\n\nHere i... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Accounts (statement_id VARCHAR, account_details VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)
Question: Show statement id, statement... | Your SQLite query looks correct for retrieving the statement id, statement detail, and account detail by performing a join between the `Accounts` and `Statements` tables based on the `statement_id`. Here it is wrapped properly:
```
SELECT T1.statement_id, T2.statement_details, T1.account_details
FROM Accounts AS T1
... | 3,637 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Accounts (statement_id VARCHAR, account_details VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Accounts (STATEMENT_ID VARCHAR)
Question: Show all statement id and the number of accounts for each statement.
Here is the SQLite query to answer to the question: Show a... | Your SQLite query is correctly formatted. It groups the records by `STATEMENT_ID` and counts the number of accounts for each statement. Here is the query wrapped in the required code format:
```
SELECT STATEMENT_ID, COUNT(*) FROM Accounts GROUP BY STATEMENT_ID
``` | 3,638 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Accounts (STATEMENT_ID VARCHAR)\n\n Question: Show all statement id and the number of accounts for each statement.\n\nHere is the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Accounts (statement_id VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)
Question: Show the statement id and the statement detail for th... | Your SQLite query is mostly correct and effectively retrieves the statement ID and details for the statement that has the most associated accounts. However, it's important to ensure that the columns you select in your `SELECT` statement correctly correspond to the values you're interested in and that the `GROUP BY` and... | 3,639 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Accounts (statement_id VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)\n\n Question: Show the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (Id VARCHAR)
Question: Show the number of documents.
Here is the SQLite query to answer to the question: Show the number of documents.:
```
SELECT COUNT(*) FRO... | Here is the SQLite query to answer the question of showing the number of documents:
```
SELECT COUNT(*) FROM Documents;
``` | 3,640 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (Id VARCHAR)\n\n Question: Show the number of documents.\n\nHere is the SQLite query to answer to the question: Show the... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_type_code VARCHAR, document_name VARCHAR, document_description VARCHAR)
Question: List the document type code, document name, and document description... | Here is the SQLite query to answer the question:
```
SELECT document_type_code, document_name, document_description
FROM Documents
WHERE document_name = 'Noel CV' OR document_name = 'King Book';
``` | 3,641 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_type_code VARCHAR, document_name VARCHAR, document_description VARCHAR)\n\n Question: List the document type c... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)
Question: Show the ids and names of all documents.
Here is the SQLite query to answer to the question: Show the id... | Here is the SQLite query to answer the question: Show the ids and names of all documents:
```
SELECT document_id, document_name FROM Documents
``` | 3,642 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)\n\n Question: Show the ids and names of all documents.\n\nHere is the SQLit... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR, document_type_code VARCHAR)
Question: Find names and ids of all documents with document type code BK.
Here is the ... | Your provided SQLite query is correct for the given requirement. Here it is wrapped in code format:
```
SELECT document_name, document_id FROM Documents WHERE document_type_code = "BK";
```
This query selects the columns `document_name` and `document_id` from the `Documents` table where the `document_type_code` equa... | 3,643 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR, document_type_code VARCHAR)\n\n Question: Find names and ids of all documen... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (project_id VARCHAR, document_type_code VARCHAR)
Question: How many documents are with document type code BK for each product id?
Here is the SQLite query to a... | Your provided SQLite query is correct for counting the number of documents with the document type code 'BK' for each project ID. Here it is wrapped in the requested code format:
```
SELECT COUNT(*), project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id;
```
This query will return a list of pr... | 3,644 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (project_id VARCHAR, document_type_code VARCHAR)\n\n Question: How many documents are with document type code BK for eac... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (project_id VARCHAR); CREATE TABLE projects (project_id VARCHAR, project_details VARCHAR)
Question: Show the document name and the document date for all documen... | It seems like there might be a slight adjustment needed in the query you provided because the `Documents` table schema doesn't include `document_name` and `document_date` columns. If they exist in the `Documents` table but were just not included in your schema description, the query you gave is correct.
Assuming the `... | 3,645 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (project_id VARCHAR); CREATE TABLE projects (project_id VARCHAR, project_details VARCHAR)\n\n Question: Show the documen... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (project_id VARCHAR)
Question: Show project ids and the number of documents in each project.
Here is the SQLite query to answer to the question: Show project i... | Your provided SQLite query is correct. It will give you the project IDs along with the count of documents for each project. Here is the query wrapped in the specified code format:
```
SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id;
``` | 3,646 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (project_id VARCHAR)\n\n Question: Show project ids and the number of documents in each project.\n\nHere is the SQLite q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (project_id VARCHAR)
Question: What is the id of the project with least number of documents?
Here is the SQLite query to answer to the question: What is the id... | Your SQLite query to find the project ID with the least number of documents is correctly structured. Here it is wrapped as per your request:
```
SELECT project_id FROM Documents GROUP BY project_id ORDER BY COUNT(*) ASC LIMIT 1
```
This query groups the records by `project_id`, counts the number of documents for eac... | 3,647 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (project_id VARCHAR)\n\n Question: What is the id of the project with least number of documents?\n\nHere is the SQLite q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (project_id VARCHAR)
Question: Show the ids for projects with at least 2 documents.
Here is the SQLite query to answer to the question: Show the ids for projec... | Your provided SQLite query is correct. Here it is wrapped in the requested code block:
```
SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2
```
This query will successfully retrieve the project IDs for projects that have at least 2 documents by grouping the records by `project_id` and using ... | 3,648 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (project_id VARCHAR)\n\n Question: Show the ids for projects with at least 2 documents.\n\nHere is the SQLite query to a... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_type_code VARCHAR)
Question: List document type codes and the number of documents in each code.
Here is the SQLite query to answer to the question: L... | Here is the SQLite query to list document type codes and the number of documents in each code, wrapped in code formatting:
```
SELECT document_type_code, COUNT(*) AS document_count
FROM Documents
GROUP BY document_type_code;
``` | 3,649 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_type_code VARCHAR)\n\n Question: List document type codes and the number of documents in each code.\n\nHere is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_type_code VARCHAR)
Question: What is the document type code with most number of documents?
Here is the SQLite query to answer to the question: What i... | Your provided SQLite query looks correct for finding the document type code with the most number of documents. Here it is wrapped in code formatting:
```
SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
```
This query groups the records by `document_type_code`, coun... | 3,650 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_type_code VARCHAR)\n\n Question: What is the document type code with most number of documents?\n\nHere is the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_type_code VARCHAR)
Question: Show the document type code with fewer than 3 documents.
Here is the SQLite query to answer to the question: Show the do... | Your SQLite query is correct. It groups the records by `document_type_code` and filters those groups to only return codes with fewer than 3 associated documents. Here’s the query wrapped in code formatting:
```
SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3
``` | 3,651 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_type_code VARCHAR)\n\n Question: Show the document type code with fewer than 3 documents.\n\nHere is the SQLit... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR); CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR)
Question: Show the statement detail and ... | Here is the SQLite query to answer the question about showing the statement detail and the corresponding document name for the statement with the detail 'Private Project':
```
SELECT T1.statement_details, T2.document_name
FROM Statements AS T1
JOIN Documents AS T2 ON T1.statement_id = T2.document_id
WHERE T1.statem... | 3,652 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR); CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR)\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_document_types (document_type_code VARCHAR, document_type_name VARCHAR, document_type_description VARCHAR)
Question: Show all document type codes, document type names... | Here is the SQLite query to show all document type codes, document type names, and document type descriptions:
```
SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types;
``` | 3,653 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_document_types (document_type_code VARCHAR, document_type_name VARCHAR, document_type_description VARCHAR)\n\n Question: Show ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_document_types (document_type_description VARCHAR, document_type_name VARCHAR)
Question: What is the document type description for document type named Film?
Here is ... | Here is the SQLite query to answer the question regarding the document type description for the document type named Film:
```sql
SELECT document_type_description FROM Ref_document_types WHERE document_type_name = 'Film';
``` | 3,654 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_document_types (document_type_description VARCHAR, document_type_name VARCHAR)\n\n Question: What is the document type descrip... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_document_types (document_type_name VARCHAR, document_type_description VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (Document_date VARCHAR, document_type_co... | Here is the SQLite query to answer the question regarding the document type name, document type description, and creation date for all documents:
```
SELECT T1.document_type_name, T1.document_type_description, T2.Document_date
FROM Ref_document_types AS T1
JOIN Documents AS T2 ON T1.document_type_code = T2.document_... | 3,655 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_document_types (document_type_name VARCHAR, document_type_description VARCHAR, document_type_code VARCHAR); CREATE TABLE Document... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Projects (Id VARCHAR)
Question: Show the number of projects.
Here is the SQLite query to answer to the question: Show the number of projects.:
```
SELECT COUNT(*) FROM P... | Your SQLite query to show the number of projects is correct. Here it is wrapped in the requested format:
```
SELECT COUNT(*) FROM Projects;
``` | 3,656 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Projects (Id VARCHAR)\n\n Question: Show the number of projects.\n\nHere is the SQLite query to answer to the question: Show the n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR)
Question: List ids and details for all projects.
Here is the SQLite query to answer to the question: List ids and ... | Here is the SQLite query to list ids and details for all projects:
```
SELECT project_id, project_details FROM Projects;
``` | 3,657 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR)\n\n Question: List ids and details for all projects.\n\nHere is the SQLite ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR); CREATE TABLE Documents (project_id VARCHAR)
Question: What is the project id and detail for the project with at le... | The query you provided is almost correct, but it seems there is a small mistake in the HAVING clause. To find projects with at least two documents, the COUNT should be greater than or equal to 2, not greater than 2. Here is the revised query:
```sql
SELECT T1.project_id, T1.project_details
FROM Projects AS T1
JOIN D... | 3,658 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR); CREATE TABLE Documents (project_id VARCHAR)\n\n Question: What is the proj... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Documents (project_id VARCHAR, document_name VARCHAR)
Question: What is the project detail for the pr... | Here is your SQLite query wrapped as you requested:
```
SELECT T1.project_details
FROM Projects AS T1
JOIN Documents AS T2 ON T1.project_id = T2.project_id
WHERE T2.document_name = "King Book"
``` | 3,659 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Documents (project_id VARCHAR, document_name VARCHAR)\n\n Que... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_budget_codes (Id VARCHAR)
Question: How many budget types do we have?
Here is the SQLite query to answer to the question: How many budget types do we have?:
```
SELE... | Your provided SQL query is correct for counting the number of budget types in the `Ref_budget_codes` table. To clarify, here is the query wrapped in a code block:
```
SELECT COUNT(*) FROM Ref_budget_codes;
``` | 3,660 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_budget_codes (Id VARCHAR)\n\n Question: How many budget types do we have?\n\nHere is the SQLite query to answer to the questio... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR)
Question: List all budget type codes and descriptions.
Here is the SQLite query to answer to... | Here is the SQLite query to list all budget type codes and descriptions:
```
SELECT budget_type_code, budget_type_description FROM Ref_budget_codes
``` | 3,661 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR)\n\n Question: List all budget type codes and descript... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_budget_codes (budget_type_description VARCHAR, budget_type_code VARCHAR)
Question: What is the description for the budget type with code ORG?
Here is the SQLite quer... | Here is the SQLite query to answer the question about the description for the budget type with code ORG:
```
SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG";
``` | 3,662 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_budget_codes (budget_type_description VARCHAR, budget_type_code VARCHAR)\n\n Question: What is the description for the budget ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (Id VARCHAR)
Question: How many documents have expenses?
Here is the SQLite query to answer to the question: How many documents have expenses?:
`... | Here is the SQLite query to answer the question: How many documents have expenses?:
```sql
SELECT COUNT(*) FROM Documents_with_expenses;
``` | 3,663 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (Id VARCHAR)\n\n Question: How many documents have expenses?\n\nHere is the SQLite query to answer to the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR)
Question: What are the document ids for the budget type code 'SF'?
Here is the SQLite query to an... | Your provided SQLite query is correct. Here it is wrapped in code formatting:
```
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF';
```
This query will return all document IDs from the `Documents_with_expenses` table where the `budget_type_code` is 'SF'. | 3,664 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR)\n\n Question: What are the document ids for the budget typ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR)
Questio... | Here is the SQLite query you need to show the budget type code and description along with the corresponding document id:
```sql
SELECT T2.budget_type_code, T2.budget_type_description, T1.document_id
FROM Documents_with_expenses AS T1
JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code;
``` | 3,665 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCH... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR, Budget_Type_code VARCHAR); CREATE TABLE Ref_Budget_Codes (Budget_Type_code VARCHAR, budget_type_Description VARCHAR)
Questio... | Here is the SQLite query to show ids for all documents with budget types described as 'Government':
```
SELECT T1.document_id
FROM Documents_with_expenses AS T1
JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code
WHERE T2.budget_type_Description = "Government"
``` | 3,666 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR, Budget_Type_code VARCHAR); CREATE TABLE Ref_Budget_Codes (Budget_Type_code VARCHAR, bud... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR)
Question: Show budget type codes and the number of documents in each budget type.
Here is the SQLite query to answer t... | Your provided SQLite query is correct for the given question. It will retrieve the budget type codes along with the count of documents for each budget type. Here it is again wrapped as requested:
```
SELECT budget_type_code, COUNT(*)
FROM Documents_with_expenses
GROUP BY budget_type_code
``` | 3,667 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR)\n\n Question: Show budget type codes and the number of documents in each budget... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR)
Question: What is the budget type code with most number of documents.
Here is the SQLite query to answer to the questi... | Your SQLite query to find the budget type code with the most number of documents is correct. Here it is, wrapped in the appropriate code block:
```
SELECT budget_type_code
FROM Documents_with_expenses
GROUP BY budget_type_code
ORDER BY COUNT(*) DESC
LIMIT 1;
```
This query groups the records by `budget_type_code... | 3,668 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR)\n\n Question: What is the budget type code with most number of documents.\n\nHe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR)
Question: What are the ids of documents which don't have expense budgets?
Her... | Your provided SQLite query is correct and effectively retrieves the document IDs that do not have corresponding entries in the `Documents_with_expenses` table. Here is the query wrapped in code formatting:
```
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses;
```
This query se... | 3,669 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR)\n\n Question: What are the ids of docu... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_type_code VARCHAR)
Question: Show ids for... | Your SQLite query is structured correctly to achieve the desired result. It selects the `document_id` from the `Documents` table where the `document_type_code` is "CV" and excludes any `document_id` that exists in the `Documents_with_expenses` table.
Here's your query wrapped appropriately:
```
SELECT document_id FR... | 3,670 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_type... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)
Question: What are the ids of documents with letter 's'... | Your SQLite query to answer the question is perfectly formulated. Here it is, wrapped properly as requested:
```
SELECT T1.document_id
FROM Documents AS T1
JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id
WHERE T1.document_name LIKE '%s%'
```
This query will select the `document_id` from the ... | 3,671 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_expenses (document_id VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)\n\n Question: W... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR)
Question: How many documents do not have any expense?
Here is the SQLite quer... | Here is the SQLite query to answer the question of how many documents do not have any expense:
```
SELECT COUNT(*) FROM Documents WHERE document_id NOT IN (SELECT document_id FROM Documents_with_expenses);
``` | 3,672 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR)\n\n Question: How many documents do no... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Documents_with_Expenses (document_id VARCHAR, budget_type_code VARCHAR); CREATE TABLE Documents (document_date VARCHAR, document_id VARCHAR)
Question: What are the dates ... | Here is the SQLite query to answer the question regarding the dates for the documents that have both 'GV' type and 'SF' type expenses:
```sql
SELECT T1.document_date
FROM Documents AS T1
JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id
WHERE T2.budget_type_code = 'GV'
INTERSECT
SELECT T1.docu... | 3,673 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Documents_with_Expenses (document_id VARCHAR, budget_type_code VARCHAR); CREATE TABLE Documents (document_date VARCHAR, document_id V... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Accounts (Account_details INTEGER)
Question: What are the account details with the largest value or with value having char '5' in it?
Here is the SQLite query to answer ... | The SQL query you provided is almost correct, but it will yield a result set that includes both the maximum account detail and the account details containing the character '5', but you might want it in a single unified result or want to ensure distinct values. Here’s a corrected version that also ensures distinct resul... | 3,674 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Accounts (Account_details INTEGER)\n\n Question: What are the account details with the largest value or with value having char '5'... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (Id VARCHAR)
Question: Find the total number of scientists.
Here is the SQLite query to answer to the question: Find the total number of scientists.:
```
SELE... | Here is the SQLite query to find the total number of scientists:
```
SELECT COUNT(*) FROM scientists;
``` | 3,675 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (Id VARCHAR)\n\n Question: Find the total number of scientists.\n\nHere is the SQLite query to answer to the question: ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (hours INTEGER)
Question: Find the total hours of all projects.
Here is the SQLite query to answer to the question: Find the total hours of all projects.:
```
S... | Here is the SQLite query to find the total hours of all projects:
```
SELECT SUM(hours) FROM projects;
``` | 3,676 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (hours INTEGER)\n\n Question: Find the total hours of all projects.\n\nHere is the SQLite query to answer to the question... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE assignedto (scientist VARCHAR)
Question: How many different scientists are assigned to any project?
Here is the SQLite query to answer to the question: How many differen... | Your query is correct. Here it is wrapped in code format:
```
SELECT COUNT(DISTINCT scientist) FROM assignedto;
``` | 3,677 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE assignedto (scientist VARCHAR)\n\n Question: How many different scientists are assigned to any project?\n\nHere is the SQLite quer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (name VARCHAR)
Question: Find the number of distinct projects.
Here is the SQLite query to answer to the question: Find the number of distinct projects.:
```
SE... | Here is the SQLite query to find the number of distinct projects:
```
SELECT COUNT(DISTINCT name) FROM projects;
``` | 3,678 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (name VARCHAR)\n\n Question: Find the number of distinct projects.\n\nHere is the SQLite query to answer to the question:... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (hours INTEGER)
Question: Find the average hours of all projects.
Here is the SQLite query to answer to the question: Find the average hours of all projects.:
`... | Here is the SQLite query to find the average hours of all projects:
```
SELECT AVG(hours) FROM projects;
``` | 3,679 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (hours INTEGER)\n\n Question: Find the average hours of all projects.\n\nHere is the SQLite query to answer to the questi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (name VARCHAR, hours VARCHAR)
Question: Find the name of project that continues for the longest time.
Here is the SQLite query to answer to the question: Find t... | Your query looks generally good, but it's important to ensure that the `hours` column is treated as a numeric value if the hours are stored as a string. Assuming that the `hours` column contains numeric values represented as strings, you can cast it to a number for accurate sorting. Here’s the corrected version of the ... | 3,680 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (name VARCHAR, hours VARCHAR)\n\n Question: Find the name of project that continues for the longest time.\n\nHere is the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (name VARCHAR, hours INTEGER)
Question: List the name of all projects that are operated longer than the average working hours of all projects.
Here is the SQLit... | Here is the SQLite query to answer the question:
```
SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)
``` | 3,681 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (name VARCHAR, hours INTEGER)\n\n Question: List the name of all projects that are operated longer than the average worki... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, hours VARCHAR, code VARCHAR)
Question: Find the name and hours of project that has the most number of s... | Here is the SQLite query wrapped as you requested:
```
SELECT T1.name, T1.hours
FROM projects AS T1
JOIN assignedto AS T2 ON T1.code = T2.project
GROUP BY T1.name, T1.hours
ORDER BY COUNT(*) DESC
LIMIT 1
``` | 3,682 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, hours VARCHAR, code VARCHAR)\n\n Question: Find the name and ho... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR)
Question: Find th... | Your provided SQLite query is already correct for the given database schema and question. It effectively joins the `assignedto`, `projects`, and `scientists` tables to find the names of projects associated with scientists whose names contain 'Smith'.
Here's the query wrapped properly:
```
SELECT T2.name
FROM assigne... | 3,683 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE projects (hours INTEGER, code VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR)
Question: Find t... | Here is the SQLite query to find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to:
```
SELECT SUM(T2.hours)
FROM assignedto AS T1
JOIN projects AS T2 ON T1.project = T2.code
JOIN scientists AS T3 ON T1.scientist = T3.SSN
WHERE T3.name = 'Michael Rogers' OR T3.name... | 3,684 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE projects (hours INTEGER, code VARCHAR); CREATE TABLE assignedto (project VARCHAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (name VARCHAR, hours INTEGER)
Question: Find the name of projects that require between 100 and 300 hours of work.
Here is the SQLite query to answer to the ques... | Your SQLite query is correct. Here it is wrapped in the appropriate code block:
```
SELECT name FROM projects WHERE hours BETWEEN 100 AND 300;
``` | 3,685 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (name VARCHAR, hours INTEGER)\n\n Question: Find the name of projects that require between 100 and 300 hours of work.\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE projects (code VARCHAR, name VARCHAR); CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR)
Question: Find th... | Here's the SQLite query to find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax':
```sql
SELECT T3.name
FROM assignedto AS T1
JOIN projects AS T2 ON T1.project = T2.code
JOIN scientists AS T3 ON T1.scientist = T3.SSN
WHERE T2.name = 'Matter of ... | 3,686 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE projects (code VARCHAR, name VARCHAR); CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR,... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (name VARCHAR)
Question: List the names of all scientists sorted in alphabetical order.
Here is the SQLite query to answer to the question: List the names of ... | Here is the SQLite query to answer the question:
```
SELECT name FROM scientists ORDER BY name;
``` | 3,687 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (name VARCHAR)\n\n Question: List the names of all scientists sorted in alphabetical order.\n\nHere is the SQLite query... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR)
Question: Find the number of scientists involved for each project name.
Here is the SQLi... | Your SQLite query is correctly structured to find the number of scientists involved for each project name, based on the given schema. Here’s the query wrapped in the requested format:
```
SELECT COUNT(*) AS scientist_count, T1.name
FROM projects AS T1
JOIN assignedto AS T2 ON T1.code = T2.project
GROUP BY T1.name;
... | 3,688 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR)\n\n Question: Find the number of scientists invol... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER)
Question: Find the number of scientists involved for the projects that req... | Your SQL query to find the number of scientists involved in projects that require more than 300 hours looks correct. However, the `COUNT(*)` function will provide the total count of scientists involved in each project with hours greater than 300, but it does not specify that `COUNT(*)` should only count unique scientis... | 3,689 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER)\n\n Question: Find the number of s... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (name VARCHAR, ssn VARCHAR); CREATE TABLE assignedto (scientist VARCHAR)
Question: Find the number of projects which each scientist is working on and scientist... | Your SQLite query is mostly correct but the column in the `assignedto` table used in the `JOIN` clause should match the `ssn` of the scientists, which seems to be the assumption based on your descriptions. Here’s a refined version of your query with a clearer structure:
```sql
SELECT COUNT(T2.scientist) AS project_cou... | 3,690 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (name VARCHAR, ssn VARCHAR); CREATE TABLE assignedto (scientist VARCHAR)\n\n Question: Find the number of projects whic... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (ssn VARCHAR, name VARCHAR, SSN VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE ... | Your query looks correct for finding the SSN and name of scientists assigned to the project with the longest hours. Here is the query formatted as you requested:
```
SELECT T3.ssn, T3.name
FROM assignedto AS T1
JOIN projects AS T2 ON T1.project = T2.code
JOIN scientists AS T3 ON T1.scientist = T3.SSN
WHERE T2.hour... | 3,691 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (ssn VARCHAR, name VARCHAR, SSN VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE assignedto (pr... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE assignedto (scientist VARCHAR); CREATE TABLE scientists (name VARCHAR, ssn VARCHAR)
Question: Find the name of scientists who are assigned to some project.
Here is the S... | Your SQL query is correct. It retrieves the names of scientists who are assigned to some project by joining the `assignedto` table with the `scientists` table on the matching scientist's SSN. Here it is wrapped properly for you:
```
SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn
``... | 3,692 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE assignedto (scientist VARCHAR); CREATE TABLE scientists (name VARCHAR, ssn VARCHAR)\n\n Question: Find the name of scientists who ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Projects (Name VARCHAR, Code VARCHAR, Project VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, Code VARCHAR, Project VARCHAR)
Question: Select the project names which are... | The query you provided is close, but there is a slight inconsistency in how you reference columns. Also, it seems you want to check for projects that are not assigned based on the project names and not the codes.
Here is the corrected SQLite query to select project names which are not assigned yet:
```
SELECT DISTIN... | 3,693 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Projects (Name VARCHAR, Code VARCHAR, Project VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, Code VARCHAR, Project VARCHAR)\n\n ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (Name VARCHAR, ssn VARCHAR, scientist VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, ssn VARCHAR, scientist VARCHAR)
Question: Find the name of scientists wh... | Your SQL query is almost correct, but there is a small issue with how you're checking the condition for scientists who are not assigned to any project. Instead, you should join the tables based on the common fields (in this case, the `ssn` field) and select the ones that do not appear in the `AssignedTo` table. Here’s ... | 3,694 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (Name VARCHAR, ssn VARCHAR, scientist VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, ssn VARCHAR, scientist VARCHAR)\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE AssignedTo (ssn VARCHAR, scientist VARCHAR); CREATE TABLE scientists (ssn VARCHAR, scientist VARCHAR)
Question: Find the number of scientists who are not assigned to any ... | Your SQLite query to find the number of scientists who are not assigned to any project is mostly correct, but there's a slight adjustment needed in the subquery to ensure you're correctly checking for unassigned scientists. The subquery should reference the `ssn` from the `AssignedTo` table instead of `scientist`. Here... | 3,695 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE AssignedTo (ssn VARCHAR, scientist VARCHAR); CREATE TABLE scientists (ssn VARCHAR, scientist VARCHAR)\n\n Question: Find the numbe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE scienti... | Your provided query is mostly correct, but there are a few adjustments needed because of the incorrect table schema duplication for the `scientists` and `projects` tables. Here's a corrected version based on the specified schema:
```sql
SELECT name
FROM scientists
WHERE SSN NOT IN (
SELECT T3.SSN
FROM assig... | 3,696 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (code VAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE AssignedTo (Scientist VARCHAR, Project VARCHAR); CREATE TABLE Projects (Name VARCHAR, Hours VARCHAR, Code VARCHAR); CREATE TABLE Scientists (Name VARCHAR, SSN VARCHAR)
Qu... | Here is the SQLite query to answer the question:
```
SELECT T1.Name AS ScientistName, T2.Project AS ProjectName, T3.Hours
FROM Scientists AS T1
JOIN AssignedTo AS T2 ON T1.Name = T2.Scientist
JOIN Projects AS T3 ON T2.Project = T3.Code
ORDER BY T3.Name, T1.Name;
``` | 3,697 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE AssignedTo (Scientist VARCHAR, Project VARCHAR); CREATE TABLE Projects (Name VARCHAR, Hours VARCHAR, Code VARCHAR); CREATE TABLE Scie... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER); CREATE... | Your SQL query appears to be well-structured for the task you've described. However, I noticed a small error in your `CREATE TABLE` schema: you have defined the `projects` table twice. It should be defined only once. I will provide the corrected schema along with the SQL query wrapped in code block, as requested.
Here... | 3,698 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE WINE (Name VARCHAR, Score VARCHAR)
Question: What is the name of the highest rated wine?
Here is the SQLite query to answer to the question: What is the name of the high... | The query you provided does not correctly address finding the highest rated wine because it orders by `Score` in ascending order and only retrieves the first result, which may not correspond to the highest score if the scores are not numeric or if they are in a different format (like text).
To get the highest rated wi... | 3,699 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE WINE (Name VARCHAR, Score VARCHAR)\n\n Question: What is the name of the highest rated wine?\n\nHere is the SQLite query to answer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.