sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Please show the different statuses of cities and the average population of cities with each status.
Answer: SELECT Status ,  avg(Population) FROM city GROUP BY Status
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status ,  avg(Population) FROM city GROUP BY Status
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What are the statuses and average populations of each city?
Answer: SELECT Status ,  avg(Population) FROM city GROUP BY Status
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status ,  avg(Population) FROM city GROUP BY Status
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Please show the different statuses, ordered by the number of cities that have each.
Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Return the different statuses of cities, ascending by frequency.
Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: List the most common type of Status across cities.
Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What is the most common status across all cities?
Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: List the official names of cities that have not held any competition.
Answer: SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What are the official names of cities that have not hosted a farm competition?
Answer: SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Show the status shared by cities with population bigger than 1500 and smaller than 500.
Answer: SELECT Status FROM city WHERE Population  >  1500 INTERSECT SELECT Status FROM city WHERE Population  <  500
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status FROM city WHERE Population  >  1500 INTERSECT SELECT Status FROM city WHERE Population  <  500
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500?
Answer: SELECT Status FROM city WHERE Population  >  1500 INTERSECT SELECT Status FROM city WHERE Population  <  500
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Status FROM city WHERE Population  >  1500 INTERSECT SELECT Status FROM city WHERE Population  <  500
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Find the official names of cities with population bigger than 1500 or smaller than 500.
Answer: SELECT Official_Name FROM city WHERE Population  >  1500 OR Population  <  500
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Official_Name FROM city WHERE Population  >  1500 OR Population  <  500
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What are the official names of cities that have population over 1500 or less than 500?
Answer: SELECT Official_Name FROM city WHERE Population  >  1500 OR Population  <  500
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Official_Name FROM city WHERE Population  >  1500 OR Population  <  500
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Show the census ranking of cities whose status are not "Village".
Answer: SELECT Census_Ranking FROM city WHERE Status !=  "Village"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Census_Ranking FROM city WHERE Status !=  "Village"
##Instruction:
Database: farm
Total Tables: 4
Total Columns: 24

Table Schemas:

farm contains tables such as city, farm, farm_competition, competition_record.
Table city has columns such as City_ID, Official_Name, Status, Area_km_2, Population, Census_Ranking.
City_ID is the primary key.
Table farm has columns such as Farm_ID, Year, Total_Horses, Working_Horses, Total_Cattle, Oxen, Bulls, Cows, Pigs, Sheep_and_Goats.
Farm_ID is the primary key.
Table farm_competition has columns such as Competition_ID, Year, Theme, Host_city_ID, Hosts.
Competition_ID is the primary key.
Table competition_record has columns such as Competition_ID, Farm_ID, Rank.
Competition_ID is the primary key.
The Host_city_ID of farm_competition is the foreign key of City_ID of city.
The Farm_ID of competition_record is the foreign key of Farm_ID of farm.
The Competition_ID of competition_record is the foreign key of Competition_ID of farm_competition.

##Role Access Policy (Column-Level):
Role: CityPlanner
Accessible Columns: city: ALL COLUMNS; farm: Farm_ID, Year, Total_Horses, Total_Cattle, Pigs, Sheep_and_Goats; farm_competition: Competition_ID, Year, Host_city_ID, Hosts

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What are the census rankings of cities that do not have the status "Village"?
Answer: SELECT Census_Ranking FROM city WHERE Status !=  "Village"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Census_Ranking FROM city WHERE Status !=  "Village"