sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Which delegates are from counties with population smaller than 100000?
Answer: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  <  100000
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  <  100000
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Find the delegates who are from counties with population below 100000.
Answer: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  <  100000
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  <  100000
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: How many distinct delegates are from counties with population larger than 50000?
Answer: SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  >  50000
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  >  50000
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Count the number of distinct delegates who are from counties with population above 50000.
Answer: SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  >  50000
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  >  50000
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: What are the names of the county that the delegates on "Appropriations" committee belong to?
Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T2.Committee  =  "Appropriations"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T2.Committee  =  "Appropriations"
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Which county do the delegates on "Appropriations" committee belong to? Give me the county names.
Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T2.Committee  =  "Appropriations"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T2.Committee  =  "Appropriations"
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Show the delegates and the names of the party they belong to.
Answer: SELECT T1.Delegate ,  T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.Delegate ,  T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: For each delegate, find the names of the party they are part of.
Answer: SELECT T1.Delegate ,  T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.Delegate ,  T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Who were the governors of the parties associated with delegates from district 1?
Answer: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Find the parties associated with the delegates from district 1. Who served as governors of the parties?
Answer: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Who were the comptrollers of the parties associated with the delegates from district 1 or district 2?
Answer: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1 OR T1.District  =  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1 OR T1.District  =  2
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
Answer: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1 OR T1.District  =  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1 OR T1.District  =  2
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Return all the committees that have delegates from Democratic party.
Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic"
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Which committees have delegates from the Democratic party?
Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic"
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Show the name of each county along with the corresponding number of delegates from that county.
Answer: SELECT T1.County_name ,  COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.County_name ,  COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: For each county, find the name of the county and the number of delegates from that county.
Answer: SELECT T1.County_name ,  COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.County_name ,  COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Show the name of each party and the corresponding number of delegates from that party.
Answer: SELECT T2.Party ,  COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Party ,  COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: For each party, return the name of the party and the number of delegates from that party.
Answer: SELECT T2.Party ,  COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.Party ,  COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party
##Instruction:
Database: election
Total Tables: 3
Total Columns: 19

Table Schemas:

election contains tables such as county, party, election.
Table county has columns such as County_Id, County_name, Population, Zip_code.
County_Id is the primary key.
Table party has columns such as Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate.
Party_ID is the primary key.
Table election has columns such as Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee.
Election_ID is the primary key.
The District of election is the foreign key of County_Id of county.
The Party of election is the foreign key of Party_ID of party.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns:
  - county: * (all columns)
  - election: * (all columns)
  - party: * (all columns)

Question: Return the names of all counties sorted by population in ascending order.
Answer: SELECT County_name FROM county ORDER BY Population ASC
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT County_name FROM county ORDER BY Population ASC