db_id stringclasses 140 values | question stringlengths 16 224 | schema_items stringlengths 12 238 | qpl stringlengths 65 1.55k |
|---|---|---|---|
department_management | List 1 for each head of the departments that older than 56. | {"head": ["age"]} | #1 = Scan Table [ head ] Predicate [ age > 56.0 ] Output [ age ] ; --List 1 for each head of the departments that older than 56. |
department_management | How many heads of the departments are older than 56 ? | {"head": ["age"]} | #1 = Scan Table [ head ] Predicate [ age > 56.0 ] Output [ age ] ; -- List 1 for each head of the departments that older than 56.
#2 = Aggregate [ #1 ] Output [ countstar AS Count_Star ] ; --How many heads of the departments are older than 56 ? |
department_management | List the name, born state and age of the heads of departments. | {"head": ["born_state", "age", "name"]} | #1 = Scan Table [ head ] Output [ name , born_state , age ] ; --List the name, born state and age of the heads of departments. |
department_management | List the name, born state and age of the heads of departments ordered by age. | {"head": ["born_state", "age", "name"]} | #1 = Scan Table [ head ] Output [ name , born_state , age ] ; -- List the name, born state and age of the heads of departments.
#2 = Sort [ #1 ] OrderBy [ age ASC ] Output [ name , born_state , age ] ; --List the name, born state and age of the heads of departments ordered by age. |
department_management | List the creation year, name and budget of each department. | {"department": ["budget_in_billions", "name", "creation"]} | #1 = Scan Table [ department ] Output [ Creation , Name , Budget_in_Billions ] ; --List the creation year, name and budget of each department. |
department_management | What are the budgets of the departments? | {"department": ["budget_in_billions"]} | #1 = Scan Table [ department ] Output [ Budget_in_Billions ] ; --What are the budgets of the departments? |
department_management | What are the maximum and minimum budget of the departments? | {"department": ["budget_in_billions"]} | #1 = Scan Table [ department ] Output [ Budget_in_Billions ] ; -- What are the budgets of the departments?
#2 = Aggregate [ #1 ] Output [ MIN(Budget_in_Billions) AS Min_Budget_in_Billions , MAX(Budget_in_Billions) AS Max_Budget_in_Billions ] ; --What are the maximum and minimum budget of the departments? |
department_management | What are the number of employees of the departments whose rank is between 10 and 15? | {"department": ["num_employees", "ranking"]} | #1 = Scan Table [ department ] Predicate [ Ranking >= 10 AND Ranking <= 15 ] Output [ Ranking , Num_Employees ] ; --What are the number of employees of the departments whose rank is between 10 and 15? |
department_management | What is the average number of employees of the departments whose rank is between 10 and 15? | {"department": ["num_employees", "ranking"]} | #1 = Scan Table [ department ] Predicate [ Ranking >= 10 AND Ranking <= 15 ] Output [ Ranking , Num_Employees ] ; -- What are the number of employees of the departments whose rank is between 10 and 15?
#2 = Aggregate [ #1 ] Output [ AVG(Num_Employees) AS Avg_Num_Employees ] ; --What is the average number of employees of the departments whose rank is between 10 and 15? |
department_management | What are the names of the heads who are born outside the California state? | {"head": ["born_state", "name"]} | #1 = Scan Table [ head ] Predicate [ born_state <> 'California' ] Output [ name , born_state ] ; --What are the names of the heads who are born outside the California state? |
department_management | What are the ids of secretaries that born in state 'Alabama'? | {"head": ["born_state", "head_id"]} | #1 = Scan Table [ head ] Predicate [ born_state = 'Alabama' ] Output [ head_ID , born_state ] ; --What are the ids of secretaries that born in state 'Alabama'? |
department_management | What are the secretary ids and department ids of all management. | {"management": ["head_id", "department_id"]} | #2 = Scan Table [ management ] Output [ head_ID , department_ID ] ; --What are the secretary ids and department ids of all management. |
department_management | What are the ids of the departments managed by a secretary born in state 'Alabama'? | {"management": ["head_id", "department_id"], "head": ["born_state", "head_id"]} | #1 = Scan Table [ head ] Predicate [ born_state = 'Alabama' ] Output [ head_ID , born_state ] ; -- What are the ids of secretaries that born in state 'Alabama'?
#2 = Scan Table [ management ] Output [ head_ID , department_ID ] ; -- What are the secretary ids and department ids of all management.
#3 = Join [ #1 , #2 ] Predicate [ #1.head_ID = #2.head_ID ] Output [ #2.department_ID ] ; --What are the ids of the departments managed by a secretary born in state 'Alabama'? |
department_management | What are the ids and creation years of all department? | {"department": ["department_id", "creation"]} | #4 = Scan Table [ department ] Output [ Creation , Department_ID ] ; --What are the ids and creation years of all department? |
department_management | What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? | {"management": ["head_id", "department_id"], "department": ["department_id", "creation"], "head": ["born_state", "head_id"]} | #1 = Scan Table [ head ] Predicate [ born_state = 'Alabama' ] Output [ head_ID , born_state ] ;
#2 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#3 = Join [ #1 , #2 ] Predicate [ #1.head_ID = #2.head_ID ] Output [ #2.department_ID ] ; -- What are the ids of the departments managed by a secretary born in state 'Alabama'?
#4 = Scan Table [ department ] Output [ Creation , Department_ID ] ; -- What are the ids and creation years of all department?
#5 = Join [ #3 , #4 ] Predicate [ #3.department_ID = #4.Department_ID ] Distinct [ true ] Output [ #4.Creation ] ; --What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? |
department_management | What are the born states of all heads? | {"head": ["born_state"]} | #1 = Scan Table [ head ] Output [ born_state ] ; --What are the born states of all heads? |
department_management | What are the different born states and the number of heads born there? | {"head": ["born_state"]} | #1 = Scan Table [ head ] Output [ born_state ] ; -- What are the born states of all heads?
#2 = Aggregate [ #1 ] GroupBy [ born_state ] Output [ countstar AS Count_Star , born_state ] ; --What are the different born states and the number of heads born there? |
department_management | What are the names of the states where at least 3 heads were born? | {"head": ["born_state"]} | #1 = Scan Table [ head ] Output [ born_state ] ;
#2 = Aggregate [ #1 ] GroupBy [ born_state ] Output [ countstar AS Count_Star , born_state ] ; -- What are the different born states and the number of heads born there?
#3 = Filter [ #2 ] Predicate [ Count_Star >= 3 ] Output [ born_state ] ; --What are the names of the states where at least 3 heads were born? |
department_management | What is the establishment year of all departments? | {"department": ["creation"]} | #1 = Scan Table [ department ] Output [ Creation ] ; --What is the establishment year of all departments? |
department_management | What are the number of departments established for each establishment year? | {"department": ["creation"]} | #1 = Scan Table [ department ] Output [ Creation ] ; -- What is the establishment year of all departments?
#2 = Aggregate [ #1 ] GroupBy [ Creation ] Output [ Creation , countstar AS Count_Star ] ; --What are the number of departments established for each establishment year? |
department_management | In which year were most departments established? | {"department": ["creation"]} | #1 = Scan Table [ department ] Output [ Creation ] ;
#2 = Aggregate [ #1 ] GroupBy [ Creation ] Output [ Creation , countstar AS Count_Star ] ; -- What are the number of departments established for each establishment year?
#3 = TopSort [ #2 ] Rows [ 1 ] OrderBy [ Count_Star DESC ] Output [ Creation , Count_Star ] ; --In which year were most departments established? |
department_management | Show the id for the departments managed by heads whose temporary acting value is 'Yes'. | {"management": ["temporary_acting", "department_id"]} | #1 = Scan Table [ management ] Predicate [ temporary_acting = 'Yes' ] Output [ temporary_acting , department_ID ] ; --Show the id for the departments managed by heads whose temporary acting value is 'Yes'. |
department_management | Show the id, name and number of employees of all departments. | {"department": ["num_employees", "name", "department_id"]} | #2 = Scan Table [ department ] Output [ Name , Department_ID , Num_Employees ] ; --Show the id, name and number of employees of all departments. |
department_management | Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? | {"management": ["temporary_acting", "department_id"], "department": ["num_employees", "name", "department_id"]} | #1 = Scan Table [ management ] Predicate [ temporary_acting = 'Yes' ] Output [ temporary_acting , department_ID ] ; -- Show the id for the departments managed by heads whose temporary acting value is 'Yes'.
#2 = Scan Table [ department ] Output [ Name , Department_ID , Num_Employees ] ; -- Show the id, name and number of employees of all departments.
#3 = Join [ #1 , #2 ] Predicate [ #1.department_ID = #2.Department_ID ] Output [ #2.Name , #2.Num_Employees ] ; --Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? |
department_management | List the different acting statuses. | {"management": ["temporary_acting"]} | #1 = Scan Table [ management ] Distinct [ true ] Output [ temporary_acting ] ; --List the different acting statuses. |
department_management | How many acting statuses are there? | {"management": ["temporary_acting"]} | #1 = Scan Table [ management ] Distinct [ true ] Output [ temporary_acting ] ; -- List the different acting statuses.
#2 = Aggregate [ #1 ] Output [ COUNT(DISTINCT temporary_acting) AS Count_Dist_temporary_acting ] ; --How many acting statuses are there? |
department_management | Find the ids of all departments. | {"department": ["department_id"]} | #1 = Scan Table [ department ] Output [ Department_ID ] ; --Find the ids of all departments. |
department_management | Find the department ids that are led by heads who are mentioned. | {"management": ["department_id"]} | #2 = Scan Table [ management ] Output [ department_ID ] ; --Find the department ids that are led by heads who are mentioned. |
department_management | Find the different department ids that are led by heads who are mentioned. | {"management": ["department_id"]} | #2 = Scan Table [ management ] Output [ department_ID ] ; -- Find the department ids that are led by heads who are mentioned.
#3 = Aggregate [ #2 ] GroupBy [ department_ID ] Output [ department_ID ] ; --Find the different department ids that are led by heads who are mentioned. |
department_management | List 1 for each department led by heads who are not mentioned. | {"management": ["department_id"], "department": ["department_id"]} | #1 = Scan Table [ department ] Output [ Department_ID ] ; -- Find the ids of all departments.
#2 = Scan Table [ management ] Output [ department_ID ] ;
#3 = Aggregate [ #2 ] GroupBy [ department_ID ] Output [ department_ID ] ; -- Find the different department ids that are led by heads who are mentioned.
#4 = Except [ #1 , #3 ] Predicate [ #3.department_ID = #1.Department_ID ] Output [ 1 AS One ] ; --List 1 for each department led by heads who are not mentioned. |
department_management | How many departments are led by heads who are not mentioned? | {"management": ["department_id"], "department": ["department_id"]} | #1 = Scan Table [ department ] Output [ Department_ID ] ;
#2 = Scan Table [ management ] Output [ department_ID ] ;
#3 = Aggregate [ #2 ] GroupBy [ department_ID ] Output [ department_ID ] ;
#4 = Except [ #1 , #3 ] Predicate [ #3.department_ID = #1.Department_ID ] Output [ 1 AS One ] ; -- List 1 for each department led by heads who are not mentioned.
#5 = Aggregate [ #4 ] Output [ countstar AS Count_Star ] ; --How many departments are led by heads who are not mentioned? |
department_management | What are the ids of the heads who are acting? | {"management": ["head_id", "temporary_acting"]} | #1 = Scan Table [ management ] Predicate [ temporary_acting = 'Yes' ] Output [ head_ID , temporary_acting ] ; --What are the ids of the heads who are acting? |
department_management | What are the ids and ages of all heads? | {"head": ["age", "head_id"]} | #2 = Scan Table [ head ] Output [ head_ID , age ] ; --What are the ids and ages of all heads? |
department_management | What are the distinct ages of the heads who are acting? | {"management": ["head_id", "temporary_acting"], "head": ["age", "head_id"]} | #1 = Scan Table [ management ] Predicate [ temporary_acting = 'Yes' ] Output [ head_ID , temporary_acting ] ; -- What are the ids of the heads who are acting?
#2 = Scan Table [ head ] Output [ head_ID , age ] ; -- What are the ids and ages of all heads?
#3 = Join [ #1 , #2 ] Predicate [ #1.head_ID = #2.head_ID ] Distinct [ true ] Output [ #2.age ] ; --What are the distinct ages of the heads who are acting? |
department_management | List the id of 'Treasury' department. | {"department": ["name", "department_id"]} | #1 = Scan Table [ department ] Predicate [ Name = 'Treasury' ] Output [ Name , Department_ID ] ; --List the id of 'Treasury' department. |
department_management | List the department ids and their secretary ids. | {"management": ["head_id", "department_id"]} | #7 = Scan Table [ management ] Output [ head_ID , department_ID ] ; --List the department ids and their secretary ids. |
department_management | List the secretary id of 'Treasury' department. | {"management": ["head_id", "department_id"], "department": ["name", "department_id"]} | #1 = Scan Table [ department ] Predicate [ Name = 'Treasury' ] Output [ Name , Department_ID ] ; -- List the id of 'Treasury' department.
#2 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#3 = Join [ #1 , #2 ] Predicate [ #1.Department_ID = #2.department_ID ] Output [ #2.head_ID ] ; --List the secretary id of 'Treasury' department. |
department_management | List the secretary ids and born states of all heads. | {"head": ["born_state", "head_id"]} | #9 = Scan Table [ head ] Output [ head_ID , born_state ] ; --List the secretary ids and born states of all heads. |
department_management | List the state where the secretary of 'Treasury' department was born. | {"management": ["head_id", "department_id"], "department": ["name", "department_id"], "head": ["born_state", "head_id"]} | #1 = Scan Table [ department ] Predicate [ Name = 'Treasury' ] Output [ Name , Department_ID ] ;
#2 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#3 = Join [ #1 , #2 ] Predicate [ #1.Department_ID = #2.department_ID ] Output [ #2.head_ID ] ; -- List the secretary id of 'Treasury' department.
#4 = Scan Table [ head ] Output [ head_ID , born_state ] ;
#5 = Join [ #3 , #4 ] Predicate [ #3.head_ID = #4.head_ID ] Distinct [ true ] Output [ #4.born_state ] ; --List the state where the secretary of 'Treasury' department was born. |
department_management | List the id of 'Homeland Security' department. | {"department": ["name", "department_id"]} | #6 = Scan Table [ department ] Predicate [ Name = 'Homeland Security' ] Output [ Name , Department_ID ] ; --List the id of 'Homeland Security' department. |
department_management | List the department ids and their secretary ids. | {"management": ["head_id", "department_id"]} | #7 = Scan Table [ management ] Output [ head_ID , department_ID ] ; --List the department ids and their secretary ids. |
department_management | List the secretary id of 'Homeland Security' department. | {"management": ["head_id", "department_id"], "department": ["name", "department_id"]} | #6 = Scan Table [ department ] Predicate [ Name = 'Homeland Security' ] Output [ Name , Department_ID ] ; -- List the id of 'Homeland Security' department.
#7 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#8 = Join [ #6 , #7 ] Predicate [ #6.Department_ID = #7.department_ID ] Output [ #7.head_ID ] ; --List the secretary id of 'Homeland Security' department. |
department_management | List the secretary ids and born states of all heads. | {"head": ["born_state", "head_id"]} | #9 = Scan Table [ head ] Output [ head_ID , born_state ] ; --List the secretary ids and born states of all heads. |
department_management | List the state where the secretary of 'Homeland Security' department was born. | {"management": ["head_id", "department_id"], "department": ["name", "department_id"], "head": ["born_state", "head_id"]} | #6 = Scan Table [ department ] Predicate [ Name = 'Homeland Security' ] Output [ Name , Department_ID ] ;
#7 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#8 = Join [ #6 , #7 ] Predicate [ #6.Department_ID = #7.department_ID ] Output [ #7.head_ID ] ; -- List the secretary id of 'Homeland Security' department.
#9 = Scan Table [ head ] Output [ head_ID , born_state ] ;
#10 = Join [ #8 , #9 ] Predicate [ #8.head_ID = #9.head_ID ] Output [ #9.born_state ] ; --List the state where the secretary of 'Homeland Security' department was born. |
department_management | List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. | {"management": ["head_id", "department_id"], "department": ["name", "department_id"], "head": ["born_state", "head_id"]} | #1 = Scan Table [ department ] Predicate [ Name = 'Treasury' ] Output [ Name , Department_ID ] ;
#2 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#3 = Join [ #1 , #2 ] Predicate [ #1.Department_ID = #2.department_ID ] Output [ #2.head_ID ] ;
#4 = Scan Table [ head ] Output [ head_ID , born_state ] ;
#5 = Join [ #3 , #4 ] Predicate [ #3.head_ID = #4.head_ID ] Distinct [ true ] Output [ #4.born_state ] ; -- List the state where the secretary of 'Treasury' department was born.
#6 = Scan Table [ department ] Predicate [ Name = 'Homeland Security' ] Output [ Name , Department_ID ] ;
#7 = Scan Table [ management ] Output [ head_ID , department_ID ] ;
#8 = Join [ #6 , #7 ] Predicate [ #6.Department_ID = #7.department_ID ] Output [ #7.head_ID ] ;
#9 = Scan Table [ head ] Output [ head_ID , born_state ] ;
#10 = Join [ #8 , #9 ] Predicate [ #8.head_ID = #9.head_ID ] Output [ #9.born_state ] ; -- List the state where the secretary of 'Homeland Security' department was born.
#11 = Intersect [ #5 , #10 ] Predicate [ #5.born_state = #10.born_state ] Output [ #5.born_state ] ; --List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. |
department_management | Which head's name has the substring 'Ha'? List the id and name. | {"head": ["head_id", "name"]} | #1 = Scan Table [ head ] Predicate [ name like '%Ha%' ] Output [ name , head_ID ] ; --Which head's name has the substring 'Ha'? List the id and name. |
farm | List 1 for each farm. | {"farm": []} | #1 = Scan Table [ farm ] Output [ 1 AS One ] ; --List 1 for each farm. |
farm | How many farms are there? | {"farm": []} | #1 = Scan Table [ farm ] Output [ 1 AS One ] ; -- List 1 for each farm.
#2 = Aggregate [ #1 ] Output [ countstar AS Count_Star ] ; --How many farms are there? |
farm | List the total number of horses of all farms. | {"farm": ["total_horses"]} | #1 = Scan Table [ farm ] Output [ Total_Horses ] ; --List the total number of horses of all farms. |
farm | List the total number of horses on farms in ascending order. | {"farm": ["total_horses"]} | #1 = Scan Table [ farm ] Output [ Total_Horses ] ; -- List the total number of horses of all farms.
#2 = Sort [ #1 ] OrderBy [ Total_Horses ASC ] Output [ Total_Horses ] ; --List the total number of horses on farms in ascending order. |
farm | What are the hosts of competitions whose theme is not "Aliens"? | {"farm_competition": ["hosts", "theme"]} | #1 = Scan Table [ farm_competition ] Predicate [ Theme <> 'Aliens' ] Output [ Hosts , Theme ] ; --What are the hosts of competitions whose theme is not "Aliens"? |
farm | Return the hosts of competitions for which the theme is not Aliens? | {"farm_competition": ["hosts", "theme"]} | #1 = Scan Table [ farm_competition ] Predicate [ Theme <> 'Aliens' ] Output [ Hosts , Theme ] ; --Return the hosts of competitions for which the theme is not Aliens? |
farm | What are the themes and years of all farm competitions? | {"farm_competition": ["year", "theme"]} | #1 = Scan Table [ farm_competition ] Output [ Theme , Year ] ; --What are the themes and years of all farm competitions? |
farm | What are the themes of farm competitions sorted by year in ascending order? | {"farm_competition": ["year", "theme"]} | #1 = Scan Table [ farm_competition ] Output [ Theme , Year ] ; -- What are the themes and years of all farm competitions?
#2 = Sort [ #1 ] OrderBy [ Year ASC ] Output [ Theme , Year ] ; --What are the themes of farm competitions sorted by year in ascending order? |
farm | Give the number of working horses on farms with more than 5000 total horses. | {"farm": ["working_horses", "total_horses"]} | #1 = Scan Table [ farm ] Predicate [ Total_Horses > 5000.0 ] Output [ Total_Horses , Working_Horses ] ; --Give the number of working horses on farms with more than 5000 total horses. |
farm | Give the average number of working horses on farms with more than 5000 total horses. | {"farm": ["working_horses", "total_horses"]} | #1 = Scan Table [ farm ] Predicate [ Total_Horses > 5000.0 ] Output [ Total_Horses , Working_Horses ] ; -- Give the number of working horses on farms with more than 5000 total horses.
#2 = Aggregate [ #1 ] Output [ AVG(Working_Horses) AS Avg_Working_Horses ] ; --Give the average number of working horses on farms with more than 5000 total horses. |
farm | Return the number of cows on farms. | {"farm": ["cows"]} | #1 = Scan Table [ farm ] Output [ Cows ] ; --Return the number of cows on farms. |
farm | Return the maximum and minimum number of cows across all farms. | {"farm": ["cows"]} | #1 = Scan Table [ farm ] Output [ Cows ] ; -- Return the number of cows on farms.
#2 = Aggregate [ #1 ] Output [ MIN(Cows) AS Min_Cows , MAX(Cows) AS Max_Cows ] ; --Return the maximum and minimum number of cows across all farms. |
farm | List the different statuses. | {"city": ["status"]} | #1 = Scan Table [ city ] Distinct [ true ] Output [ Status ] ; --List the different statuses. |
farm | Count the number of different statuses. | {"city": ["status"]} | #1 = Scan Table [ city ] Distinct [ true ] Output [ Status ] ; -- List the different statuses.
#2 = Aggregate [ #1 ] Output [ COUNT(DISTINCT Status) AS Count_Dist_Status ] ; --Count the number of different statuses. |
farm | What are the official names and population of all cities? | {"city": ["official_name", "population"]} | #1 = Scan Table [ city ] Output [ Population , Official_Name ] ; --What are the official names and population of all cities? |
farm | What are the official names of cities, ordered descending by population? | {"city": ["official_name", "population"]} | #1 = Scan Table [ city ] Output [ Population , Official_Name ] ; -- What are the official names and population of all cities?
#2 = Sort [ #1 ] OrderBy [ Population DESC ] Output [ Population , Official_Name ] ; --What are the official names of cities, ordered descending by population? |
farm | List the official name, status and population of all cities. | {"city": ["status", "official_name", "population"]} | #1 = Scan Table [ city ] Output [ Population , Status , Official_Name ] ; --List the official name, status and population of all cities. |
farm | List the official name and status of the city with the largest population. | {"city": ["status", "official_name", "population"]} | #1 = Scan Table [ city ] Output [ Population , Status , Official_Name ] ; -- List the official name, status and population of all cities.
#2 = TopSort [ #1 ] Rows [ 1 ] OrderBy [ Population DESC ] Output [ Population , Status , Official_Name ] ; --List the official name and status of the city with the largest population. |
farm | Show the years and the ids of the host cities of competitions. | {"farm_competition": ["year", "host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Year , Host_city_ID ] ; --Show the years and the ids of the host cities of competitions. |
farm | Show the ids and official names of all cities. | {"city": ["city_id", "official_name"]} | #2 = Scan Table [ city ] Output [ City_ID , Official_Name ] ; --Show the ids and official names of all cities. |
farm | Show the years and the official names of the host cities of competitions. | {"city": ["city_id", "official_name"], "farm_competition": ["year", "host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Year , Host_city_ID ] ; -- Show the years and the ids of the host cities of competitions.
#2 = Scan Table [ city ] Output [ City_ID , Official_Name ] ; -- Show the ids and official names of all cities.
#3 = Join [ #1 , #2 ] Predicate [ #1.Host_city_ID = #2.City_ID ] Output [ #1.Year , #2.Official_Name ] ; --Show the years and the official names of the host cities of competitions. |
farm | Show the host city ids of all competitions. | {"farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ; --Show the host city ids of all competitions. |
farm | Show the ids and official names of all the cities. | {"city": ["city_id", "official_name"]} | #2 = Scan Table [ city ] Output [ City_ID , Official_Name ] ; --Show the ids and official names of all the cities. |
farm | Show the host city ids and official names of all competitions. | {"city": ["city_id", "official_name"], "farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ; -- Show the host city ids of all competitions.
#2 = Scan Table [ city ] Output [ City_ID , Official_Name ] ; -- Show the ids and official names of all the cities.
#3 = Join [ #1 , #2 ] Predicate [ #1.Host_city_ID = #2.City_ID ] Output [ #1.Host_city_ID , #2.Official_Name , #2.City_ID ] ; --Show the host city ids and official names of all competitions. |
farm | Show the the official names of the cities and the number of competitions have hosted for each host city id. | {"city": ["city_id", "official_name"], "farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ;
#2 = Scan Table [ city ] Output [ City_ID , Official_Name ] ;
#3 = Join [ #1 , #2 ] Predicate [ #1.Host_city_ID = #2.City_ID ] Output [ #1.Host_city_ID , #2.Official_Name , #2.City_ID ] ; -- Show the host city ids and official names of all competitions.
#4 = Aggregate [ #3 ] GroupBy [ Host_city_ID ] Output [ countstar AS Count_Star , Official_Name ] ; --Show the the official names of the cities and the number of competitions have hosted for each host city id. |
farm | Show the official names of the cities that have hosted more than one competition. | {"city": ["city_id", "official_name"], "farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ;
#2 = Scan Table [ city ] Output [ City_ID , Official_Name ] ;
#3 = Join [ #1 , #2 ] Predicate [ #1.Host_city_ID = #2.City_ID ] Output [ #1.Host_city_ID , #2.Official_Name , #2.City_ID ] ;
#4 = Aggregate [ #3 ] GroupBy [ Host_city_ID ] Output [ countstar AS Count_Star , Official_Name ] ; -- Show the the official names of the cities and the number of competitions have hosted for each host city id.
#5 = Filter [ #4 ] Predicate [ Count_Star > 1 ] Output [ Official_Name ] ; --Show the official names of the cities that have hosted more than one competition. |
farm | What is the host city id of all competitions? | {"farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ; --What is the host city id of all competitions? |
farm | What are the different host city ids and the number of competitions has hosted? | {"farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ; -- What is the host city id of all competitions?
#2 = Aggregate [ #1 ] GroupBy [ Host_city_ID ] Output [ countstar AS Count_Star , Host_city_ID ] ; --What are the different host city ids and the number of competitions has hosted? |
farm | What is the id and status of all cities? | {"city": ["city_id", "status"]} | #3 = Scan Table [ city ] Output [ Status , City_ID ] ; --What is the id and status of all cities? |
farm | For each host city id, what is the status of the city and the number of competitions has hosted. | {"city": ["city_id", "status"], "farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ;
#2 = Aggregate [ #1 ] GroupBy [ Host_city_ID ] Output [ countstar AS Count_Star , Host_city_ID ] ; -- What are the different host city ids and the number of competitions has hosted?
#3 = Scan Table [ city ] Output [ Status , City_ID ] ; -- What is the id and status of all cities?
#4 = Join [ #2 , #3 ] Predicate [ #2.Host_city_ID = #3.City_ID ] Output [ #3.Status , #2.Count_Star ] ; --For each host city id, what is the status of the city and the number of competitions has hosted. |
farm | What is the status of the city that has hosted the most competitions? | {"city": ["city_id", "status"], "farm_competition": ["host_city_id"]} | #1 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ;
#2 = Aggregate [ #1 ] GroupBy [ Host_city_ID ] Output [ countstar AS Count_Star , Host_city_ID ] ;
#3 = Scan Table [ city ] Output [ Status , City_ID ] ;
#4 = Join [ #2 , #3 ] Predicate [ #2.Host_city_ID = #3.City_ID ] Output [ #3.Status , #2.Count_Star ] ; -- For each host city id, what is the status of the city and the number of competitions has hosted.
#5 = TopSort [ #4 ] Rows [ 1 ] OrderBy [ Count_Star DESC ] Output [ Count_Star , Status ] ; --What is the status of the city that has hosted the most competitions? |
farm | What are the city ids of cities with more than 1000 residents? | {"city": ["city_id", "population"]} | #1 = Scan Table [ city ] Predicate [ Population > 1000.0 ] Output [ Population , City_ID ] ; --What are the city ids of cities with more than 1000 residents? |
farm | What are the themes and host cities ids of all competitions? | {"farm_competition": ["host_city_id", "theme"]} | #2 = Scan Table [ farm_competition ] Output [ Theme , Host_city_ID ] ; --What are the themes and host cities ids of all competitions? |
farm | What are the themes of competitions that have corresponding host cities with more than 1000 residents? | {"city": ["city_id", "population"], "farm_competition": ["host_city_id", "theme"]} | #1 = Scan Table [ city ] Predicate [ Population > 1000.0 ] Output [ Population , City_ID ] ; -- What are the city ids of cities with more than 1000 residents?
#2 = Scan Table [ farm_competition ] Output [ Theme , Host_city_ID ] ; -- What are the themes and host cities ids of all competitions?
#3 = Join [ #1 , #2 ] Predicate [ #1.City_ID = #2.Host_city_ID ] Output [ #2.Theme ] ; --What are the themes of competitions that have corresponding host cities with more than 1000 residents? |
farm | Please show the statuses and population of cities. | {"city": ["status", "population"]} | #1 = Scan Table [ city ] Output [ Population , Status ] ; --Please show the statuses and population of cities. |
farm | Please show the different statuses of cities and the average population of cities with each status. | {"city": ["status", "population"]} | #1 = Scan Table [ city ] Output [ Population , Status ] ; -- Please show the statuses and population of cities.
#2 = Aggregate [ #1 ] GroupBy [ Status ] Output [ Status , AVG(Population) AS Avg_Population ] ; --Please show the different statuses of cities and the average population of cities with each status. |
farm | Return the status of all cities. | {"city": ["status"]} | #1 = Scan Table [ city ] Output [ Status ] ; --Return the status of all cities. |
farm | Return the different statuses and their frequency. | {"city": ["status"]} | #1 = Scan Table [ city ] Output [ Status ] ; -- Return the status of all cities.
#2 = Aggregate [ #1 ] GroupBy [ Status ] Output [ countstar AS Count_Star , Status ] ; --Return the different statuses and their frequency. |
farm | Return the different statuses of cities, ascending by frequency. | {"city": ["status"]} | #1 = Scan Table [ city ] Output [ Status ] ;
#2 = Aggregate [ #1 ] GroupBy [ Status ] Output [ countstar AS Count_Star , Status ] ; -- Return the different statuses and their frequency.
#3 = Sort [ #2 ] OrderBy [ Count_Star ASC ] Output [ Count_Star , Status ] ; --Return the different statuses of cities, ascending by frequency. |
farm | List the status of all cities. | {"city": ["status"]} | #1 = Scan Table [ city ] Output [ Status ] ; --List the status of all cities. |
farm | List the different statuses and the number of cities that have each. | {"city": ["status"]} | #1 = Scan Table [ city ] Output [ Status ] ; -- List the status of all cities.
#2 = Aggregate [ #1 ] GroupBy [ Status ] Output [ countstar AS Count_Star , Status ] ; --List the different statuses and the number of cities that have each. |
farm | List the most common type of Status across cities. | {"city": ["status"]} | #1 = Scan Table [ city ] Output [ Status ] ;
#2 = Aggregate [ #1 ] GroupBy [ Status ] Output [ countstar AS Count_Star , Status ] ; -- List the different statuses and the number of cities that have each.
#3 = TopSort [ #2 ] Rows [ 1 ] OrderBy [ Count_Star DESC ] Output [ Count_Star , Status ] ; --List the most common type of Status across cities. |
farm | List the city ids and official names of all cities. | {"city": ["city_id", "official_name"]} | #1 = Scan Table [ city ] Output [ City_ID , Official_Name ] ; --List the city ids and official names of all cities. |
farm | List the host city ids of all competitions. | {"farm_competition": ["host_city_id"]} | #2 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ; --List the host city ids of all competitions. |
farm | List the official names of cities that have not held any competition. | {"city": ["city_id", "official_name"], "farm_competition": ["host_city_id"]} | #1 = Scan Table [ city ] Output [ City_ID , Official_Name ] ; -- List the city ids and official names of all cities.
#2 = Scan Table [ farm_competition ] Output [ Host_city_ID ] ; -- List the host city ids of all competitions.
#3 = Except [ #1 , #2 ] Predicate [ #2.Host_city_ID IS NULL OR #1.City_ID = #2.Host_city_ID ] Output [ #1.Official_Name ] ; --List the official names of cities that have not held any competition. |
farm | Show the status by cities with population bigger than 1500. | {"city": ["status", "population"]} | #1 = Scan Table [ city ] Predicate [ Population > 1500.0 ] Distinct [ true ] Output [ Population , Status ] ; --Show the status by cities with population bigger than 1500. |
farm | Show the status by cities with population smaller than 500. | {"city": ["status", "population"]} | #2 = Scan Table [ city ] Predicate [ Population < 500.0 ] Output [ Population , Status ] ; --Show the status by cities with population smaller than 500. |
farm | Show the status shared by cities with population bigger than 1500 and smaller than 500. | {"city": ["status", "population"]} | #1 = Scan Table [ city ] Predicate [ Population > 1500.0 ] Distinct [ true ] Output [ Population , Status ] ; -- Show the status by cities with population bigger than 1500.
#2 = Scan Table [ city ] Predicate [ Population < 500.0 ] Output [ Population , Status ] ; -- Show the status by cities with population smaller than 500.
#3 = Intersect [ #1 , #2 ] Predicate [ #1.Status = #2.Status ] Output [ #1.Status ] ; --Show the status shared by cities with population bigger than 1500 and smaller than 500. |
farm | Find the official names of cities with population bigger than 1500 or smaller than 500. | {"city": ["official_name", "population"]} | #1 = Scan Table [ city ] Predicate [ Population < 500.0 OR Population > 1500.0 ] Output [ Population , Official_Name ] ; --Find the official names of cities with population bigger than 1500 or smaller than 500. |
farm | What are the official names of cities that have population over 1500 or less than 500? | {"city": ["official_name", "population"]} | #1 = Scan Table [ city ] Predicate [ Population < 500.0 OR Population > 1500.0 ] Output [ Population , Official_Name ] ; --What are the official names of cities that have population over 1500 or less than 500? |
farm | Show the census ranking of cities whose status are not "Village". | {"city": ["status", "census_ranking"]} | #1 = Scan Table [ city ] Predicate [ Status <> 'Village' ] Output [ Census_Ranking , Status ] ; --Show the census ranking of cities whose status are not "Village". |
farm | What are the census rankings of cities that do not have the status "Village"? | {"city": ["status", "census_ranking"]} | #1 = Scan Table [ city ] Predicate [ Status <> 'Village' ] Output [ Census_Ranking , Status ] ; --What are the census rankings of cities that do not have the status "Village"? |
student_assessment | What is the course id of all student registrations? | {"Student_Course_Registrations": ["course_id"]} | #1 = Scan Table [ Student_Course_Registrations ] Output [ course_id ] ; --What is the course id of all student registrations? |
student_assessment | What is the number of registered students for each course id? | {"Student_Course_Registrations": ["course_id"]} | #1 = Scan Table [ Student_Course_Registrations ] Output [ course_id ] ; -- What is the course id of all student registrations?
#2 = Aggregate [ #1 ] GroupBy [ course_id ] Output [ countstar AS Count_Star , course_id ] ; --What is the number of registered students for each course id? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.