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 head (age INTEGER)
Question: How many heads of the departments are older than 56 ?
Here is the SQLite query to answer to the question: How many heads of the departments ... | Here is the SQLite query to answer the question about how many heads of departments are older than 56:
```
SELECT COUNT(*) FROM head WHERE age > 56;
``` | 0 | [
{
"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 head (age INTEGER)\n\n Question: How many heads of the departments are older than 56 ?\n\nHere is the SQLite query to answer to th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE head (name VARCHAR, born_state VARCHAR, age VARCHAR)
Question: List the name, born state and age of the heads of departments ordered by age.
Here is the SQLite query to ... | Here is the SQLite query to list the name, born state, and age of the heads of departments ordered by age:
```
SELECT name, born_state, age FROM head ORDER BY age;
``` | 1 | [
{
"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 head (name VARCHAR, born_state VARCHAR, age VARCHAR)\n\n Question: List the name, born state and age of the heads of departments o... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE department (creation VARCHAR, name VARCHAR, budget_in_billions VARCHAR)
Question: List the creation year, name and budget of each department.
Here is the SQLite query to... | Here is the SQLite query to answer the question you provided:
```
SELECT creation, name, budget_in_billions FROM department
``` | 2 | [
{
"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 department (creation VARCHAR, name VARCHAR, budget_in_billions VARCHAR)\n\n Question: List the creation year, name and budget of e... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE department (budget_in_billions INTEGER)
Question: What are the maximum and minimum budget of the departments?
Here is the SQLite query to answer to the question: What ar... | Here is the SQLite query to answer the question about the maximum and minimum budget of the departments:
```
SELECT MAX(budget_in_billions), MIN(budget_in_billions) FROM department;
``` | 3 | [
{
"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 department (budget_in_billions INTEGER)\n\n Question: What are the maximum and minimum budget of the departments?\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 department (num_employees INTEGER, ranking INTEGER)
Question: What is the average number of employees of the departments whose rank is between 10 and 15?
Here is the SQL... | Here is the SQLite query to find the average number of employees of the departments whose rank is between 10 and 15:
```
SELECT AVG(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15;
``` | 4 | [
{
"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 department (num_employees INTEGER, ranking INTEGER)\n\n Question: What is the average number of employees of the departments whose... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE head (name VARCHAR, born_state VARCHAR)
Question: What are the names of the heads who are born outside the California state?
Here is the SQLite query to answer to the qu... | Here is the SQLite query to answer the question about the names of the heads who are born outside the California state:
```
SELECT name FROM head WHERE born_state <> 'California'
``` | 5 | [
{
"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 head (name VARCHAR, born_state VARCHAR)\n\n Question: What are the names of the heads who are born outside the California state?\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE department (creation VARCHAR, department_id VARCHAR); CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (head_id VARCHAR, born_state VARCHAR)... | Here is the SQLite query to answer the question about the distinct creation years of the departments managed by a secretary born in state 'Alabama':
```
SELECT DISTINCT T1.creation
FROM department AS T1
JOIN management AS T2 ON T1.department_id = T2.department_id
JOIN head AS T3 ON T2.head_id = T3.head_id
WHERE T3... | 6 | [
{
"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 department (creation VARCHAR, department_id VARCHAR); CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE head (born_state VARCHAR)
Question: What are the names of the states where at least 3 heads were born?
Here is the SQLite query to answer to the question: What are the n... | Here's the SQLite query to find the names of the states where at least 3 heads were born, wrapped in code format:
```
SELECT born_state FROM head GROUP BY born_state HAVING COUNT(*) >= 3;
``` | 7 | [
{
"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 head (born_state VARCHAR)\n\n Question: What are the names of the states where at least 3 heads were born?\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 department (creation VARCHAR)
Question: In which year were most departments established?
Here is the SQLite query to answer to the question: In which year were most depa... | Your query is mostly correct, but it needs to extract the year from the `creation` field and group by that year. Assuming the `creation` field holds date strings in a recognizable format (like 'YYYY-MM-DD'), you could modify the query to extract the year and then group by it. Here’s the revised SQL query:
```
SELECT s... | 8 | [
{
"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 department (creation VARCHAR)\n\n Question: In which year were most departments established?\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 management (department_id VARCHAR, temporary_acting VARCHAR); CREATE TABLE department (name VARCHAR, num_employees VARCHAR, department_id VARCHAR)
Question: Show the name... | Here is the SQLite query to answer the question:
```
SELECT T1.name, T1.num_employees
FROM department AS T1
JOIN management AS T2 ON T1.department_id = T2.department_id
WHERE T2.temporary_acting = 'Yes'
``` | 9 | [
{
"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 management (department_id VARCHAR, temporary_acting VARCHAR); CREATE TABLE department (name VARCHAR, num_employees VARCHAR, departmen... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE management (temporary_acting VARCHAR)
Question: How many acting statuses are there?
Here is the SQLite query to answer to the question: How many acting statuses are ther... | Here is the SQLite query to answer the question of how many acting statuses are there:
```
SELECT COUNT(DISTINCT temporary_acting) FROM management;
``` | 10 | [
{
"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 management (temporary_acting VARCHAR)\n\n Question: How many acting statuses are there?\n\nHere is the SQLite query to answer to t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR)
Question: How many departments are led by heads who are not mentioned?
Here is the SQ... | Your provided SQLite query to count the number of departments led by heads who are not mentioned is correct. Here it is wrapped in code formatting for clarity:
```
SELECT COUNT(*) FROM department WHERE NOT department_id IN (SELECT department_id FROM management);
```
This query works by selecting all department IDs f... | 11 | [
{
"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 management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR)\n\n Question: How many departments are led by ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE head (age VARCHAR, head_id VARCHAR); CREATE TABLE management (head_id VARCHAR, temporary_acting VARCHAR)
Question: What are the distinct ages of the heads who are acting?... | Your provided SQLite query is correct for retrieving the distinct ages of heads who are acting. Here’s the query wrapped in the appropriate code block:
```
SELECT DISTINCT T1.age
FROM management AS T2
JOIN head AS T1 ON T1.head_id = T2.head_id
WHERE T2.temporary_acting = 'Yes';
```
This query selects distinct age... | 12 | [
{
"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 head (age VARCHAR, head_id VARCHAR); CREATE TABLE management (head_id VARCHAR, temporary_acting VARCHAR)\n\n Question: What are th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (born_state VARCHAR, head_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR)
... | Here is the SQLite query formatted as requested:
```
SELECT T3.born_state
FROM department AS T1
JOIN management AS T2 ON T1.department_id = T2.department_id
JOIN head AS T3 ON T2.head_id = T3.head_id
WHERE T1.name = 'Treasury'
INTERSECT
SELECT T3.born_state
FROM department AS T1
JOIN management AS T2 ON T1.dep... | 13 | [
{
"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 management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (born_state VARCHAR, head_id VARCHAR); CREATE TABLE department... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR)
Question: Which department has more than 1 head at a time? List the id, ... | The SQLite query you provided is almost correct, but it would be better to clarify the groups being counted to ensure it accurately reflects departments with more than one head. Assuming that the `management` table's entries correspond to heads of departments (i.e., each row represents a head for a particular departmen... | 14 | [
{
"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 management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR)\n\n Question: Which department h... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE head (head_id VARCHAR, name VARCHAR)
Question: Which head's name has the substring 'Ha'? List the id and name.
Here is the SQLite query to answer to the question: Which ... | Here is the SQLite query to answer the question about which head's name has the substring 'Ha':
```
SELECT head_id, name FROM head WHERE name LIKE '%Ha%'
``` | 15 | [
{
"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 head (head_id VARCHAR, name VARCHAR)\n\n Question: Which head's name has the substring 'Ha'? List the id and name.\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 farm (Id VARCHAR)
Question: How many farms are there?
Here is the SQLite query to answer to the question: How many farms are there?:
```
SELECT COUNT(*) FROM farm
``` | Your provided SQLite query is correct. Here it is wrapped in the requested format:
```
SELECT COUNT(*) FROM farm
``` | 16 | [
{
"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 farm (Id VARCHAR)\n\n Question: How many farms are there?\n\nHere is the SQLite query to answer to the question: How many farms ar... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE farm (Total_Horses VARCHAR)
Question: List the total number of horses on farms in ascending order.
Here is the SQLite query to answer to the question: List the total num... | Your SQLite query is mostly correct, but to ensure that the total number of horses is treated as a numeric value during sorting, you should convert the `Total_Horses` field to an integer or numeric type. Assuming the `Total_Horses` column contains numeric values stored as strings, you can modify the query as follows:
... | 17 | [
{
"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 farm (Total_Horses VARCHAR)\n\n Question: List the total number of horses on farms in ascending 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 farm_competition (Hosts VARCHAR, Theme VARCHAR)
Question: What are the hosts of competitions whose theme is not "Aliens"?
Here is the SQLite query to answer to the quest... | Here's the SQLite query to answer the question regarding the hosts of competitions whose theme is not "Aliens":
```sql
SELECT Hosts FROM farm_competition WHERE Theme <> 'Aliens';
``` | 18 | [
{
"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 farm_competition (Hosts VARCHAR, Theme VARCHAR)\n\n Question: What are the hosts of competitions whose theme is not \"Aliens\"?\n\... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE farm_competition (Theme VARCHAR, YEAR VARCHAR)
Question: What are the themes of farm competitions sorted by year in ascending order?
Here is the SQLite query to answer t... | Your provided SQL query is almost correct, but it's a good practice to also specify the order clearly for readability. Here is the updated query to answer the question about the themes of farm competitions sorted by year in ascending order:
```
SELECT Theme FROM farm_competition ORDER BY YEAR ASC;
```
This explicitl... | 19 | [
{
"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 farm_competition (Theme VARCHAR, YEAR VARCHAR)\n\n Question: What are the themes of farm competitions sorted by year in ascending ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE farm (Working_Horses INTEGER, Total_Horses INTEGER)
Question: What is the average number of working horses of farms with more than 5000 total number of horses?
Here is t... | Here is the SQLite query to answer the given question:
```
SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000
``` | 20 | [
{
"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 farm (Working_Horses INTEGER, Total_Horses INTEGER)\n\n Question: What is the average number of working horses of farms with more ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE farm (Cows INTEGER)
Question: What are the maximum and minimum number of cows across all farms.
Here is the SQLite query to answer to the question: What are the maximum ... | Here is the SQLite query to answer the question regarding the maximum and minimum number of cows across all farms:
```
SELECT MAX(Cows), MIN(Cows) FROM farm;
``` | 21 | [
{
"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 farm (Cows INTEGER)\n\n Question: What are the maximum and minimum number of cows across all farms.\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 city (Status VARCHAR)
Question: How many different statuses do cities have?
Here is the SQLite query to answer to the question: How many different statuses do cities hav... | Here is the SQLite query to answer the question: How many different statuses do cities have?:
```
SELECT COUNT(DISTINCT Status) FROM city
``` | 22 | [
{
"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 city (Status VARCHAR)\n\n Question: How many different statuses do cities have?\n\nHere is the SQLite query to answer to the quest... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Official_Name VARCHAR, Population VARCHAR)
Question: List official names of cities in descending order of population.
Here is the SQLite query to answer to the que... | Here is the SQLite query to list the official names of cities in descending order of population:
```sql
SELECT Official_Name FROM city ORDER BY Population DESC;
``` | 23 | [
{
"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 city (Official_Name VARCHAR, Population VARCHAR)\n\n Question: List official names of cities in descending order of population.\n\... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Official_Name VARCHAR, Status VARCHAR, Population VARCHAR)
Question: List the official name and status of the city with the largest population.
Here is the SQLite ... | Your SQLite query correctly identifies the city with the largest population and retrieves its official name and status. Here it is wrapped in the requested format:
```
SELECT Official_Name, Status FROM city ORDER BY Population DESC LIMIT 1;
``` | 24 | [
{
"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 city (Official_Name VARCHAR, Status VARCHAR, Population VARCHAR)\n\n Question: List the official name and status of the city with ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Year VARCHAR, Host_city_ID VARCHAR)
Question: Show the years and the official names of the h... | Here's the SQLite query you can use to show the years and the official names of the host cities of competitions:
```
SELECT T2.Year, T1.Official_Name
FROM city AS T1
JOIN farm_competition AS T2
ON T1.City_ID = T2.Host_city_ID;
``` | 25 | [
{
"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 city (Official_Name VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Year VARCHAR, Host_city_ID VARCHAR)\n\n Question: Sh... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE farm_competition (Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR)
Question: Show the official names of the cities that have hosted more ... | Here is the SQLite query you requested, wrapped in code formatting:
```
SELECT T1.Official_Name
FROM city AS T1
JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID
GROUP BY T2.Host_city_ID
HAVING COUNT(*) > 1
``` | 26 | [
{
"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 farm_competition (Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR)\n\n Question: Show the officia... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Status VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Host_city_ID VARCHAR)
Question: Show the status of the city that has hosted the greatest number of ... | Your query is almost correct; however, it is essential to ensure that you are selecting the correct row corresponding to the city with the greatest number of competitions. The query you've provided already does this effectively. Here's a slightly reformatted version for clarity:
```sql
SELECT T1.Status
FROM city AS T... | 27 | [
{
"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 city (Status VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Host_city_ID VARCHAR)\n\n Question: Show the status of the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (City_ID VARCHAR, Population INTEGER); CREATE TABLE farm_competition (Theme VARCHAR, Host_city_ID VARCHAR)
Question: Please show the themes of competitions with host... | Here is the SQLite query to answer the question regarding the themes of competitions with host cities having populations larger than 1000:
```
SELECT T2.Theme
FROM city AS T1
JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID
WHERE T1.Population > 1000;
``` | 28 | [
{
"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 city (City_ID VARCHAR, Population INTEGER); CREATE TABLE farm_competition (Theme VARCHAR, Host_city_ID VARCHAR)\n\n Question: Plea... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Status VARCHAR, Population INTEGER)
Question: Please show the different statuses of cities and the average population of cities with each status.
Here is the SQLit... | Here is the SQLite query to show the different statuses of cities and the average population of cities with each status:
```sql
SELECT Status, AVG(Population) AS AveragePopulation FROM city GROUP BY Status;
``` | 29 | [
{
"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 city (Status VARCHAR, Population INTEGER)\n\n Question: Please show the different statuses of cities and the average population of... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Status VARCHAR)
Question: Please show the different statuses, ordered by the number of cities that have each.
Here is the SQLite query to answer to the question: P... | Your query is almost correct, but to order by the count of statuses, you need to use the `COUNT(*)` in the `ORDER BY` clause correctly. Here is the revised SQL query:
```sql
SELECT Status, COUNT(*) AS city_count
FROM city
GROUP BY Status
ORDER BY city_count;
```
This query selects the different statuses from the ... | 30 | [
{
"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 city (Status VARCHAR)\n\n Question: Please show the different statuses, ordered by the number of cities that have each.\n\nHere is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Status VARCHAR)
Question: List the most common type of Status across cities.
Here is the SQLite query to answer to the question: List the most common type of Statu... | Your provided SQLite query is almost correct for retrieving the most common type of `Status` across cities. However, it could be clearer by explicitly counting the occurrences of each `Status`. Here's the refined query:
```sql
SELECT Status
FROM city
GROUP BY Status
ORDER BY COUNT(*) DESC
LIMIT 1;
```
This query ... | 31 | [
{
"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 city (Status VARCHAR)\n\n Question: List the most common type of Status across cities.\n\nHere is the SQLite query to answer to th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE farm_competition (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR)
Question... | Your query is almost correct, but it's better to use `NOT EXISTS` for checking the absence of a related record in the `farm_competition` table. Here's a refined version of your original query:
```sql
SELECT Official_Name
FROM city AS c
WHERE NOT EXISTS (
SELECT 1
FROM farm_competition AS f
WHERE f.Host_c... | 32 | [
{
"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 farm_competition (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VA... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Status VARCHAR, Population INTEGER)
Question: Show the status shared by cities with population bigger than 1500 and smaller than 500.
Here is the SQLite query to a... | Here is the SQLite query that answers the question:
```
SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500
``` | 33 | [
{
"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 city (Status VARCHAR, Population INTEGER)\n\n Question: Show the status shared by cities with population bigger than 1500 and smal... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Official_Name VARCHAR, Population VARCHAR)
Question: Find the official names of cities with population bigger than 1500 or smaller than 500.
Here is the SQLite que... | Your provided SQLite query is almost correct, but it's important to note that the `Population` column is defined as a `VARCHAR`. To perform numerical comparisons, you should convert it to an integer using the `CAST` function. Here’s the corrected version of the query:
```
SELECT Official_Name FROM city WHERE CAST(Popu... | 34 | [
{
"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 city (Official_Name VARCHAR, Population VARCHAR)\n\n Question: Find the official names of cities with population bigger than 1500 ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE city (Census_Ranking VARCHAR, Status VARCHAR)
Question: Show the census ranking of cities whose status are not "Village".
Here is the SQLite query to answer to the quest... | Here is the SQLite query to answer the question:
```
SELECT Census_Ranking FROM city WHERE Status <> "Village";
``` | 35 | [
{
"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 city (Census_Ranking VARCHAR, Status VARCHAR)\n\n Question: Show the census ranking of cities whose status are not \"Village\".\n\... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_Id VARCHAR)
Question: which course has most number of registered stude... | Your SQLite query is correctly structured to find the course with the most registered students. Here it is wrapped in code formatting:
```
SELECT T1.course_name
FROM courses AS T1
JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id
GROUP BY T1.course_id
ORDER BY COUNT(*) DESC
LIMIT 1;
```
Thi... | 36 | [
{
"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 courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_Id VARCHAR)\n\n Question: whic... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_registrations (student_id VARCHAR)
Question: what is id of students who registered some courses but the least number of courses in these students?
Here is... | The provided query is mostly correct, but it will return only one student ID regardless of how many students have the least number of registrations. To get all students who have the least number of course registrations, you need to first determine the minimum count of registrations, and then select all students who hav... | 37 | [
{
"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 student_course_registrations (student_id VARCHAR)\n\n Question: what is id of students who registered some courses but the least n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (first_name VARCHAR, last_name VARCHAR, person_id VARCHAR)
Question: what are the first name and last name of all c... | Your SQLite query correctly retrieves the first name and last name of all candidates by joining the `candidates` table with the `people` table based on the candidate ID. Below is the query formatted as requested:
```
SELECT T2.first_name, T2.last_name
FROM candidates AS T1
JOIN people AS T2 ON T1.candidate_id = T2.p... | 38 | [
{
"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 candidates (candidate_id VARCHAR); CREATE TABLE people (first_name VARCHAR, last_name VARCHAR, person_id VARCHAR)\n\n Question: wh... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE students (student_id VARCHAR)
Question: List the id of students who never attends courses?
Here is the SQLit... | Here is the SQLite query to list the IDs of students who never attend courses:
```
SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);
``` | 39 | [
{
"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 student_course_attendance (student_id VARCHAR); CREATE TABLE students (student_id VARCHAR)\n\n Question: List the id of students w... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR)
Question: List the id of students who attended some courses?
Here is the SQLite query to answer to the question: List the ... | Here is the SQLite query to answer the question of listing the IDs of students who attended some courses:
```
SELECT student_id FROM student_course_attendance;
``` | 40 | [
{
"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 student_course_attendance (student_id VARCHAR)\n\n Question: List the id of students who attended some courses?\n\nHere is the SQL... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR)
Question: What are the ids of all stud... | Here is the SQLite query to answer the question about the ids of all students for courses and the names of those courses:
```
SELECT T1.student_id, T2.course_name
FROM student_course_registrations AS T1
JOIN courses AS T2 ON T1.course_id = T2.course_id
``` | 41 | [
{
"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 courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR)\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_registrations (student_id VARCHAR, registration_date VARCHAR); CREATE TABLE students (student_details VARCHAR, student_id VARCHAR)
Question: What is detail... | Here is the SQLite query to answer the question of which student most recently registered for a course:
```sql
SELECT T2.student_details
FROM student_course_registrations AS T1
JOIN students AS T2 ON T1.student_id = T2.student_id
ORDER BY T1.registration_date DESC
LIMIT 1;
``` | 42 | [
{
"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 student_course_registrations (student_id VARCHAR, registration_date VARCHAR); CREATE TABLE students (student_details VARCHAR, student... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (course_id VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR)
Question: How many students attend course English?
Here is t... | Here is the SQLite query to answer the question of how many students attend the course English:
```sql
SELECT COUNT(*)
FROM courses AS T1
JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id
WHERE T1.course_name = "English";
``` | 43 | [
{
"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 student_course_attendance (course_id VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR)\n\n Question: How man... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE courses (course_id VARCHAR); CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR)
Question: How many courses do the student whose id is 171 atte... | Your SQLite query is correct for counting the number of courses that the student with ID 171 attends. Here it is wrapped in the required format:
```
SELECT COUNT(*)
FROM courses AS T1
JOIN student_course_attendance AS T2
ON T1.course_id = T2.course_id
WHERE T2.student_id = '171';
```
Note: Make sure to use quote... | 44 | [
{
"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 courses (course_id VARCHAR); CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR)\n\n Question: How many... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (person_id VARCHAR, email_address VARCHAR)
Question: Find id of the candidate whose email is stanley.monahan@exampl... | Here is the SQLite query to answer the question:
```
SELECT T2.candidate_id
FROM people AS T1
JOIN candidates AS T2 ON T1.person_id = T2.candidate_id
WHERE T1.email_address = 'stanley.monahan@example.org';
``` | 45 | [
{
"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 candidates (candidate_id VARCHAR); CREATE TABLE people (person_id VARCHAR, email_address VARCHAR)\n\n Question: Find id of the can... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate_assessments (candidate_id VARCHAR, assessment_date VARCHAR)
Question: Find id of the candidate who most recently accessed the course?
Here is the SQLite query ... | Here is the SQLite query to find the id of the candidate who most recently accessed the course:
```
SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1
``` | 46 | [
{
"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 candidate_assessments (candidate_id VARCHAR, assessment_date VARCHAR)\n\n Question: Find id of the candidate who most recently acc... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE students (student_details VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)
Question: What is detail of the student who registe... | Here is the SQLite query to answer the question regarding the detail of the student who registered the most number of courses:
```
SELECT T1.student_details
FROM students AS T1
JOIN student_course_registrations AS T2
ON T1.student_id = T2.student_id
GROUP BY T1.student_id
ORDER BY COUNT(*) DESC
LIMIT 1;
``` | 47 | [
{
"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 students (student_details VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)\n\n Questio... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE students (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)
Question: List the id of students who registered some courses and the number... | Your SQLite query is almost correct for retrieving the IDs of students who have registered for courses along with the count of their registrations. Here is the properly formatted query:
```sql
SELECT T1.student_id, COUNT(*) AS course_count
FROM students AS T1
JOIN student_course_registrations AS T2 ON T1.student_id ... | 48 | [
{
"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 students (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)\n\n Question: List the id of student... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE students (student_id VARCHAR); CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR)... | Here is the SQLite query to answer the question on how many registered students each course has, along with the course name:
```
SELECT T3.course_name, COUNT(*) AS registered_students
FROM students AS T1
JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id
JOIN courses AS T3 ON T2.course_id = T3... | 49 | [
{
"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 students (student_id VARCHAR); CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registratio... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate_assessments (candidate_id VARCHAR, asessment_outcome_code VARCHAR)
Question: Find id of candidates whose assessment code is "Pass"?
Here is the SQLite query to... | Here is the SQLite query to find the id of candidates whose assessment code is "Pass":
```sql
SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass";
``` | 50 | [
{
"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 candidate_assessments (candidate_id VARCHAR, asessment_outcome_code VARCHAR)\n\n Question: Find id of candidates whose assessment ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (cell_mobile_number VARCHAR, person_id VARCHAR); CREATE TABLE candidate_assessments (candidate_id VARCHAR, asessment_out... | Your SQLite query to find the cell mobile number of the candidates whose assessment code is "Fail" looks almost correct, but there is a small error in the join condition between the `candidates` and `people` tables. The `candidates` table should be joined with `people` on candidate_id matching person_id.
Here is the ... | 51 | [
{
"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 candidates (candidate_id VARCHAR); CREATE TABLE people (cell_mobile_number VARCHAR, person_id VARCHAR); CREATE TABLE candidate_assess... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR)
Question: What are the id of students who registered course 301?
Here is the SQLite query to answer to ... | Here is the correct SQLite query to find the IDs of students who registered for course 301:
```
SELECT student_id FROM student_course_attendance WHERE course_id = '301'
```
(Note: The course_id is treated as a string in this query. If it should be treated as an integer, you can remove the single quotes.) | 52 | [
{
"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 student_course_attendance (student_id VARCHAR, course_id VARCHAR)\n\n Question: What are the id of students who registered course ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR)
Question: What is the id of the student who most recently registered course ... | Your query looks good! It effectively retrieves the ID of the student who most recently attended course 301. Here is the query wrapped in code formatting:
```
SELECT student_id FROM student_course_attendance WHERE course_id = '301' ORDER BY date_of_attendance DESC LIMIT 1;
```
Note: I've added single quotes around '... | 53 | [
{
"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 student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR)\n\n Question: What is the id of the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR)
Question: Find distinct cities of addresses of people?
Here is the SQLit... | Here is the SQLite query to find the distinct cities of addresses of people:
```
SELECT DISTINCT T1.city
FROM addresses AS T1
JOIN people_addresses AS T2 ON T1.address_id = T2.address_id;
``` | 54 | [
{
"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 addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR)\n\n Question: Find distinct citie... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE students (student_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR, person_id VARCHAR)
Question: ... | Your provided SQLite query correctly identifies the distinct cities of addresses for students. Here it is formatted for clarity:
```sql
SELECT DISTINCT T1.city
FROM addresses AS T1
JOIN people_addresses AS T2 ON T1.address_id = T2.address_id
JOIN students AS T3 ON T2.person_id = T3.student_id;
```
This query achi... | 55 | [
{
"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 students (student_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id V... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE courses (course_name VARCHAR)
Question: List the names of courses in alphabetical order?
Here is the SQLite query to answer to the question: List the names of courses in... | Here is the SQLite query to list the names of courses in alphabetical order:
```
SELECT course_name FROM courses ORDER BY course_name;
``` | 56 | [
{
"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 courses (course_name VARCHAR)\n\n Question: List the names of courses in alphabetical order?\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 people (first_name VARCHAR)
Question: List the first names of people in alphabetical order?
Here is the SQLite query to answer to the question: List the first names of p... | Here is the SQLite query to list the first names of people in alphabetical order:
```
SELECT first_name FROM people ORDER BY first_name;
``` | 57 | [
{
"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 people (first_name VARCHAR)\n\n Question: List the first names of people in alphabetical order?\n\nHere is the SQLite query to ans... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)
Question: What are the id of students who registered course... | Here is the SQLite query to answer the question about the IDs of students who registered for courses or attended courses:
```
SELECT student_id FROM student_course_registrations
UNION
SELECT student_id FROM student_course_attendance;
``` | 58 | [
{
"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 student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)\n\n Question: What ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR)
Question: Find the id... | Here is the SQLite query to find the id of courses that are either registered or attended by the student with id 121:
```sql
SELECT course_id FROM student_course_registrations WHERE student_id = '121'
UNION
SELECT course_id FROM student_course_attendance WHERE student_id = '121';
```
Make sure to use quotes around... | 59 | [
{
"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 student_course_attendance (course_id VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, stud... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)
Question: What are all info of students who registered cour... | Your SQLite query is almost correct but can be refined for clarity and efficiency. You can use a `LEFT JOIN` to find students who registered for courses but are not present in the attendance records. Here’s the revised query:
```sql
SELECT scr.*
FROM student_course_registrations scr
LEFT JOIN student_course_attendance... | 60 | [
{
"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 student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR)\n\n Question: What ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR, registration_date VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR)
Question: L... | Here is the SQLite query to answer the question about listing the IDs of students who registered for the course "statistics" in the order of their registration date:
```
SELECT T2.student_id
FROM courses AS T1
JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id
WHERE T1.course_name = "statistics"... | 61 | [
{
"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 student_course_registrations (student_id VARCHAR, course_id VARCHAR, registration_date VARCHAR); CREATE TABLE courses (course_id VARC... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR)
Question: Lis... | Here is the SQLite query to list the IDs of students who attended statistics courses in the order of attendance date:
```
SELECT T2.student_id
FROM courses AS T1
JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id
WHERE T1.course_name = "statistics"
ORDER BY T2.date_of_attendance;
``` | 62 | [
{
"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 student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR); CREATE TABLE courses (course_id VARCHA... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (date VARCHAR, max_temperature_f INTEGER)
Question: Give me the dates when the max temperature was higher than 85.
Here is the SQLite query to answer to the ques... | Here is the SQLite query to answer the question of when the max temperature was higher than 85:
```
SELECT date FROM weather WHERE max_temperature_f > 85
``` | 63 | [
{
"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 weather (date VARCHAR, max_temperature_f INTEGER)\n\n Question: Give me the dates when the max temperature was higher than 85.\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (name VARCHAR, lat INTEGER)
Question: What are the names of stations that have latitude lower than 37.5?
Here is the SQLite query to answer to the question: What... | The SQLite query to find the names of stations that have a latitude lower than 37.5 is as follows:
```
SELECT name FROM station WHERE lat < 37.5;
``` | 64 | [
{
"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 station (name VARCHAR, lat INTEGER)\n\n Question: What are the names of stations that have latitude lower than 37.5?\n\nHere is th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (city VARCHAR, lat INTEGER)
Question: For each city, return the highest latitude among its stations.
Here is the SQLite query to answer to the question: For each... | Your SQL query is correctly written to return the highest latitude for each city from the `station` table. Here it is wrapped in the requested code format:
```sql
SELECT city, MAX(lat) FROM station GROUP BY city;
``` | 65 | [
{
"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 station (city VARCHAR, lat INTEGER)\n\n Question: For each city, return the highest latitude among its stations.\n\nHere is the SQ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (start_station_name VARCHAR, end_station_name VARCHAR, id VARCHAR)
Question: Give me the start station and end station for the trips with the three oldest id.
Here ... | Your query is close, but to get the three oldest IDs, you should order by the `id` in ascending order. Here’s the corrected SQLite query:
```sql
SELECT start_station_name, end_station_name
FROM trip
ORDER BY id ASC
LIMIT 3;
```
This will give you the start and end stations for the trips with the three oldest IDs ... | 66 | [
{
"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 trip (start_station_name VARCHAR, end_station_name VARCHAR, id VARCHAR)\n\n Question: Give me the start station and end station fo... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (lat INTEGER, long INTEGER, city VARCHAR)
Question: What is the average latitude and longitude of stations located in San Jose city?
Here is the SQLite query to ... | Here is the SQLite query to answer the question regarding the average latitude and longitude of stations located in San Jose city:
```
SELECT AVG(lat) AS average_latitude, AVG(long) AS average_longitude FROM station WHERE city = "San Jose";
``` | 67 | [
{
"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 station (lat INTEGER, long INTEGER, city VARCHAR)\n\n Question: What is the average latitude and longitude of stations located in ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (id VARCHAR, duration VARCHAR)
Question: What is the id of the trip that has the shortest duration?
Here is the SQLite query to answer to the question: What is the ... | Your provided SQLite query is almost correct, but it will not accurately find the trip with the shortest duration unless the duration is stored in a format that allows for correct ordering (e.g., as an integer representation of minutes or seconds). Assuming the duration is stored in a format that can be compared (such ... | 68 | [
{
"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 trip (id VARCHAR, duration VARCHAR)\n\n Question: What is the id of the trip that has the shortest duration?\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 trip (duration INTEGER, bike_id VARCHAR)
Question: What is the total and maximum duration of trips with bike id 636?
Here is the SQLite query to answer to the question: ... | Here is the SQLite query to answer the question regarding the total and maximum duration of trips with bike id 636:
```
SELECT SUM(duration) AS total_duration, MAX(duration) AS max_duration FROM trip WHERE bike_id = '636';
``` | 69 | [
{
"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 trip (duration INTEGER, bike_id VARCHAR)\n\n Question: What is the total and maximum duration of trips with bike id 636?\n\nHere i... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER, date VARCHAR)
Question: For each zip code, return the average mean temperature of August there.
Here is the SQLite... | Your SQLite query is almost correct but needs a slight adjustment to accurately filter for the month of August. Typically, you want to filter based on the month instead of using a wildcard in the `LIKE` clause.
If the `date` format is `YYYY-MM-DD`, you should use the following query to get the average mean temperatur... | 70 | [
{
"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 weather (zip_code VARCHAR, mean_temperature_f INTEGER, date VARCHAR)\n\n Question: For each zip code, return the average mean temp... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (bike_id VARCHAR)
Question: From the trip record, find the number of unique bikes.
Here is the SQLite query to answer to the question: From the trip record, find th... | Here is the SQLite query to find the number of unique bikes from the trip record:
```
SELECT COUNT(DISTINCT bike_id) FROM trip;
``` | 71 | [
{
"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 trip (bike_id VARCHAR)\n\n Question: From the trip record, find the number of unique bikes.\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 station (city VARCHAR)
Question: What is the number of distinct cities the stations are located at?
Here is the SQLite query to answer to the question: What is the numbe... | Your query is correct for counting the number of distinct cities in the `station` table. Here it is wrapped in code formatting:
```
SELECT COUNT(DISTINCT city) FROM station;
``` | 72 | [
{
"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 station (city VARCHAR)\n\n Question: What is the number of distinct cities the stations are located at?\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 station (city VARCHAR)
Question: How many stations does Mountain View city has?
Here is the SQLite query to answer to the question: How many stations does Mountain View ... | Your query to count the number of stations in Mountain View city is correct. Here it is wrapped properly:
```
SELECT COUNT(*) FROM station WHERE city = "Mountain View";
``` | 73 | [
{
"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 station (city VARCHAR)\n\n Question: How many stations does Mountain View city has?\n\nHere is the SQLite query to answer to the q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available VARCHAR)
Question: Return the unique name for stations that have ever had 7 b... | Here is the SQLite query to answer the question of returning the unique names for stations that have ever had 7 bikes available:
```sql
SELECT DISTINCT T1.name
FROM station AS T1
JOIN status AS T2 ON T1.id = T2.station_id
WHERE T2.bikes_available = '7'
``` | 74 | [
{
"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 station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available VARCHAR)\n\n Question: Return the uni... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (start_station_name VARCHAR, start_station_id VARCHAR, start_date VARCHAR)
Question: Which start station had the most trips starting from August? Give me the name an... | Your SQLite query is mostly correct, but to ensure that all records starting in August are accurately counted, you might want to specify the year along with the month in the WHERE clause. Assuming the `start_date` is stored as a string in the format "YYYY/MM/DD", you can refine the query slightly. Here's an improved ve... | 75 | [
{
"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 trip (start_station_name VARCHAR, start_station_id VARCHAR, start_date VARCHAR)\n\n Question: Which start station had the most tri... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (bike_id VARCHAR, zip_code VARCHAR)
Question: Which bike traveled the most often in zip code 94002?
Here is the SQLite query to answer to the question: Which bike t... | The given SQLite query is almost correct, but there is a small issue with the way the zip code is specified. Since `zip_code` is a VARCHAR, it should be enclosed in single quotes. Here is the corrected version of the SQLite query:
```
SELECT bike_id
FROM trip
WHERE zip_code = '94002'
GROUP BY bike_id
ORDER BY COUN... | 76 | [
{
"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 trip (bike_id VARCHAR, zip_code VARCHAR)\n\n Question: Which bike traveled the most often in zip code 94002?\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 weather (mean_humidity VARCHAR, mean_visibility_miles VARCHAR)
Question: How many days had both mean humidity above 50 and mean visibility above 8?
Here is the SQLite qu... | Your query has the right idea, but since both `mean_humidity` and `mean_visibility_miles` are defined as `VARCHAR`, you'll need to convert them to a numeric type for proper comparison. Here’s the corrected version:
```sql
SELECT COUNT(*)
FROM weather
WHERE CAST(mean_humidity AS FLOAT) > 50
AND CAST(mean_visibilit... | 77 | [
{
"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 weather (mean_humidity VARCHAR, mean_visibility_miles VARCHAR)\n\n Question: How many days had both mean humidity above 50 and mea... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (start_station_id VARCHAR, duration VARCHAR); CREATE TABLE station (lat VARCHAR, long VARCHAR, city VARCHAR, id VARCHAR)
Question: What is the latitude, longitude, c... | Your query is very close to the correct answer, but it needs a minor adjustment regarding how duration is handled. If `duration` is stored as a string, you will need to convert it to a numerical format to accurately find the shortest trip.
Assuming the duration is in a format like "MM:SS" or "HH:MM:SS", you might nee... | 78 | [
{
"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 trip (start_station_id VARCHAR, duration VARCHAR); CREATE TABLE station (lat VARCHAR, long VARCHAR, city VARCHAR, 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 status (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER)
... | Your query is on the right track, but there are a couple of issues with how you're combining the results from the `station` and `status` tables. You should join the two tables based on `station_id` to accurately compute the average bike availability for each station. Here’s how you can structure your SQL query:
```sql... | 79 | [
{
"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 status (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR,... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE station (name VARCHAR, id VARCHAR, installation_date VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available INTEGE... | Here is the SQLite query that answers the question about the names and ids of stations that had more than 14 bikes available on average or were installed in December:
```
SELECT T1.name, T1.id
FROM station AS T1
JOIN status AS T2 ON T1.id = T2.station_id
GROUP BY T2.station_id
HAVING AVG(T2.bikes_available) > 14
... | 80 | [
{
"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 station (name VARCHAR, id VARCHAR); CREATE TABLE station (name VARCHAR, id VARCHAR, installation_date VARCHAR); CREATE TABLE status (... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (cloud_cover VARCHAR, zip_code VARCHAR)
Question: What is the 3 most common cloud cover rates in the region of zip code 94107?
Here is the SQLite query to answer... | Your SQLite query looks mostly correct but just needs a minor adjustment in the WHERE clause to ensure the zip code comparison is treated as a string, since it is defined as a VARCHAR in the schema. Here's the corrected query:
```
SELECT cloud_cover
FROM weather
WHERE zip_code = '94107'
GROUP BY cloud_cover
ORDER ... | 81 | [
{
"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 weather (cloud_cover VARCHAR, zip_code VARCHAR)\n\n Question: What is the 3 most common cloud cover rates in the region of zip cod... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (zip_code VARCHAR, mean_sea_level_pressure_inches INTEGER)
Question: What is the zip code in which the average mean sea level pressure is the lowest?
Here is the... | The SQL query to find the zip code with the lowest average mean sea level pressure should correctly calculate the average for each zip code and order the results. However, to compute the average correctly, we should use `AVG()` without the `GROUP BY` clause in the usual way, instead, we can use a subquery to make sure ... | 82 | [
{
"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 weather (zip_code VARCHAR, mean_sea_level_pressure_inches INTEGER)\n\n Question: What is the zip code in which the average mean se... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE status (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR); CREATE TABLE station (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR)
... | Here is the SQLite query to answer the question regarding the average bike availability in stations that are not located in Palo Alto:
```sql
SELECT AVG(bikes_available) FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE city = 'Palo Alto');
``` | 83 | [
{
"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 status (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR); CREATE TABLE station (bikes_available INTEGER, statio... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER); CREATE TABLE status (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER)
... | Here is the SQLite query to answer the question regarding the average longitude of stations that never had bike availability more than 10:
```sql
SELECT AVG(long)
FROM station
WHERE station_id NOT IN (
SELECT station_id
FROM status
GROUP BY station_id
HAVING MAX(bikes_available) > 10
);
``` | 84 | [
{
"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 station (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER); CREATE TABLE status (long INTEGER, id VARCHAR, stati... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (date VARCHAR, zip_code VARCHAR, max_temperature_f VARCHAR)
Question: When and in what zip code did max temperature reach 80?
Here is the SQLite query to answer ... | You have provided a query that retrieves dates and zip codes where the maximum temperature is greater than or equal to 80. To specifically answer the question of when and in what zip code the maximum temperature reached exactly 80, you need to modify the query to check for equality instead. Here’s the corrected SQL que... | 85 | [
{
"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 weather (date VARCHAR, zip_code VARCHAR, max_temperature_f VARCHAR)\n\n Question: When and in what zip code did max temperature re... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (id VARCHAR, zip_code VARCHAR); CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER)
Question: Give me ids for all the trip that took place in a zip c... | Your provided SQL query is close to what is needed, but it actually does not produce the correct result because of the `GROUP BY` and `AVG` usage. Since you're looking to get all `ids` for trips in zip codes with a mean temperature above 60, you should not group the results. Instead, you want to directly filter based o... | 86 | [
{
"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 trip (id VARCHAR, zip_code VARCHAR); CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER)\n\n Question: Give me ids... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (zip_code VARCHAR, max_wind_Speed_mph VARCHAR)
Question: For each zip code, return how many times max wind speed reached 25?
Here is the SQLite query to answer t... | The provided SQLite query will need a slight modification to accurately count the occurrences where the max wind speed exactly reached 25 mph, rather than being greater than or equal to 25. Here’s the corrected SQL query:
```
SELECT zip_code, COUNT(*) AS count_from_25
FROM weather
WHERE max_wind_Speed_mph = '25'
GROUP... | 87 | [
{
"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 weather (zip_code VARCHAR, max_wind_Speed_mph VARCHAR)\n\n Question: For each zip code, return how many times max wind speed reach... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (date VARCHAR, zip_code VARCHAR, min_dew_point_f INTEGER)
Question: On which day and in which zip code was the min dew point lower than any day in zip code 94107?... | Here is the SQLite query to answer the question:
```
SELECT date, zip_code FROM weather
WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = '94107');
``` | 88 | [
{
"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 weather (date VARCHAR, zip_code VARCHAR, min_dew_point_f INTEGER)\n\n Question: On which day and in which zip code was the min dew... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (installation_date VARCHAR, id VARCHAR); CREATE TABLE trip (id VARCHAR, end_station_id VARCHAR)
Question: For each trip, return its ending station's installation ... | Your SQL query to return each trip's ending station's installation date looks correct. Here it is wrapped in the requested format:
```
SELECT T1.id, T2.installation_date
FROM trip AS T1
JOIN station AS T2 ON T1.end_station_id = T2.id
``` | 89 | [
{
"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 station (installation_date VARCHAR, id VARCHAR); CREATE TABLE trip (id VARCHAR, end_station_id VARCHAR)\n\n Question: For each tri... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (id VARCHAR, start_station_id VARCHAR); CREATE TABLE station (id VARCHAR, dock_count VARCHAR)
Question: Which trip started from the station with the largest dock cou... | Your query to find the trip that started from the station with the largest dock count is correct. Here it is wrapped in code formatting:
```
SELECT T1.id
FROM trip AS T1
JOIN station AS T2 ON T1.start_station_id = T2.id
ORDER BY T2.dock_count DESC
LIMIT 1;
```
This query selects the trip ID from the `trip` table... | 90 | [
{
"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 trip (id VARCHAR, start_station_id VARCHAR); CREATE TABLE station (id VARCHAR, dock_count VARCHAR)\n\n Question: Which trip starte... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (end_station_id VARCHAR); CREATE TABLE station (id VARCHAR, city VARCHAR)
Question: Count the number of trips that did not end in San Francisco city.
Here is the SQ... | Here is the SQLite query to count the number of trips that did not end in San Francisco:
```
SELECT COUNT(*)
FROM trip AS T1
JOIN station AS T2 ON T1.end_station_id = T2.id
WHERE T2.city <> 'San Francisco';
``` | 91 | [
{
"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 trip (end_station_id VARCHAR); CREATE TABLE station (id VARCHAR, city VARCHAR)\n\n Question: Count the number of trips that did no... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (date VARCHAR, EVENTS VARCHAR, zip_code VARCHAR)
Question: In zip code 94107, on which day neither Fog nor Rain was not observed?
Here is the SQLite query to ans... | Your query is almost correct, but you need to account for cases where there might be multiple events recorded for a single day. It's also better to check for NULL or empty EVENTS that are neither "Fog" nor "Rain". Here's the corrected query to find the dates in zip code 94107 on which neither Fog nor Rain was observed:... | 92 | [
{
"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 weather (date VARCHAR, EVENTS VARCHAR, zip_code VARCHAR)\n\n Question: In zip code 94107, on which day neither Fog nor Rain was no... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE status (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER)
... | Your SQLite query looks good for answering the question about stations with a latitude above 37.4 and never having bike availability below 7. Here’s the code wrapped in the requested format:
```
SELECT id FROM station WHERE lat > 37.4
EXCEPT
SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_availabl... | 93 | [
{
"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 status (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR); CREATE TABLE station (name VARCHAR, city VARCHAR, bikes_available INTEGER)
Question: What ar... | It seems there is a minor error in the provided schema regarding the duplication of the `station` table. You need to ensure that the schema correctly reflects your intent. It seems like there should only be one `station` table representing all relevant information about each station, including its `name`, `city`, and `... | 94 | [
{
"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 station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR); CREATE TABLE station (name VARCHAR, city VARCHAR, bikes... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (name VARCHAR, lat VARCHAR, city VARCHAR)
Question: What are the name, latitude, and city of the station with the lowest latitude?
Here is the SQLite query to an... | Your provided query is almost correct, but to ensure that we find the station with the lowest latitude, we should convert the latitude values from VARCHAR to a numeric format for accurate comparison. Here's the corrected query:
```
SELECT name, lat, city
FROM station
ORDER BY CAST(lat AS REAL) ASC
LIMIT 1;
``` | 95 | [
{
"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 station (name VARCHAR, lat VARCHAR, city VARCHAR)\n\n Question: What are the name, latitude, and city of the station with the lowe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (date VARCHAR, mean_temperature_f VARCHAR, mean_humidity VARCHAR, max_gust_speed_mph VARCHAR)
Question: What are the date, mean temperature and mean humidity for ... | Your query has a small oversight regarding the `max_gust_speed_mph` column; since it is defined as a `VARCHAR`, it should be converted to a numerical type for proper ordering. Here’s the corrected query:
```sql
SELECT date, mean_temperature_f, mean_humidity
FROM weather
ORDER BY CAST(max_gust_speed_mph AS FLOAT) DES... | 96 | [
{
"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 weather (date VARCHAR, mean_temperature_f VARCHAR, mean_humidity VARCHAR, max_gust_speed_mph VARCHAR)\n\n Question: What are the d... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE station (city VARCHAR)
Question: List the name and the number of stations for all the cities that have at least 15 stations.
Here is the SQLite query to answer to the qu... | Here's the SQLite query to list the name and the number of stations for all the cities that have at least 15 stations:
```
SELECT city, COUNT(*) AS number_of_stations
FROM station
GROUP BY city
HAVING COUNT(*) >= 15;
``` | 97 | [
{
"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 station (city VARCHAR)\n\n Question: List the name and the number of stations for all the cities that have at least 15 stations.\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE trip (start_station_id VARCHAR, start_station_name VARCHAR)
Question: Find the ids and names of stations from which at least 200 trips started.
Here is the SQLite query ... | Your current query is almost correct, but it would be better to group by `start_station_id` as well to ensure unique station entries. Here’s the revised query:
```
SELECT start_station_id, start_station_name
FROM trip
GROUP BY start_station_id, start_station_name
HAVING COUNT(*) >= 200
```
This will return the id... | 98 | [
{
"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 trip (start_station_id VARCHAR, start_station_name VARCHAR)\n\n Question: Find the ids and names of stations from which at least 2... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE weather (zip_code VARCHAR, mean_visibility_miles INTEGER)
Question: Find the zip code in which the average mean visibility is lower than 10.
Here is the SQLite query to ... | Here is the SQLite query to find the zip code where the average mean visibility is lower than 10:
```sql
SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10;
``` | 99 | [
{
"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 weather (zip_code VARCHAR, mean_visibility_miles INTEGER)\n\n Question: Find the zip code in which the average mean visibility is ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.