ajayk007/querysmith-spider-bird huggingface dataset:
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE customer (
  c_custkey integer PRIMARY KEY,
  c_mktsegment text,
  c_nationkey integer,
  c_name text,
  c_address text,
  c_phone text,
  c_acctbal real,
  c_comment text
);
CREATE TABLE lineitem (
  l_shipdate date,
  l_orderkey integer PRIMARY KEY,
  l_discount real,
  l_extendedprice real,
  l_suppkey integer,
  l_quantity integer,
  l_returnflag text,
  l_partkey integer,
  l_linestatus text,
  l_tax real,
  l_commitdate date,
  l_receiptdate date,
  l_shipmode text,
  l_linenumber integer PRIMARY KEY,
  l_shipinstruct text,
  l_comment text
);
CREATE TABLE nation (
  n_nationkey integer PRIMARY KEY,
  n_name text,
  n_regionkey integer,
  n_comment text
);
CREATE TABLE orders (
  o_orderdate date,
  o_orderkey integer PRIMARY KEY,
  o_custkey integer,
  o_orderpriority text,
  o_shippriority integer,
  o_clerk text,
  o_orderstatus text,
  o_totalprice real,
  o_comment text
);
CREATE TABLE part (
  p_partkey integer PRIMARY KEY,
  p_type text,
  p_size integer,
  p_brand text,
  p_name text,
  p_container text,
  p_mfgr text,
  p_retailprice real,
  p_comment text
);
CREATE TABLE partsupp (
  ps_partkey integer PRIMARY KEY,
  ps_suppkey integer PRIMARY KEY,
  ps_supplycost real,
  ps_availqty integer,
  ps_comment text
);
CREATE TABLE region (
  r_regionkey integer PRIMARY KEY,
  r_name text,
  r_comment text
);
CREATE TABLE supplier (
  s_suppkey integer PRIMARY KEY,
  s_nationkey integer,
  s_comment text,
  s_name text,
  s_address text,
  s_phone text,
  s_acctbal real
);
-- foreign keys: customer.c_nationkey -> nation.n_nationkey; lineitem.l_partkey -> partsupp.ps_partkey; lineitem.l_suppkey -> partsupp.ps_suppkey; lineitem.l_orderkey -> orders.o_orderkey; nation.n_regionkey -> region.r_regionkey; orders.o_custkey -> customer.c_custkey; partsupp.ps_suppkey -> supplier.s_suppkey; partsupp.ps_partkey -> part.p_partkey; supplier.s_nationkey -> nation.n_nationkey

Hint: type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; Manufacturer#5 refers to p_mfgr = 'Manufacturer#5'

Question: Among the products under the type "promo brushed steel", how many of them are manufactured by Manufacturer#5?

assistant: SELECT COUNT(p_partkey) FROM part WHERE p_type = 'PROMO BRUSHED STEEL' AND p_mfgr = 'Manufacturer#5'
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE Dish (
  id integer PRIMARY KEY,
  name text,
  description text,
  menus_appeared integer,
  times_appeared integer,
  first_appeared integer,
  last_appeared integer,
  lowest_price real,
  highest_price real
);
CREATE TABLE Menu (
  id integer PRIMARY KEY,
  name text,
  sponsor text,
  event text,
  venue text,
  place text,
  physical_description text,
  occasion text,
  notes text,
  call_number text,
  keywords text,
  language text,
  date date,
  location text,
  location_type text,
  currency text,
  currency_symbol text,
  status text,
  page_count integer,
  dish_count integer
);
CREATE TABLE MenuPage (
  id integer PRIMARY KEY,
  menu_id integer,
  page_number integer,
  image_id real,
  full_height integer,
  full_width integer,
  uuid text
);
CREATE TABLE MenuItem (
  id integer PRIMARY KEY,
  menu_page_id integer,
  price real,
  high_price real,
  dish_id integer,
  created_at text,
  updated_at text,
  xpos real,
  ypos real
);
-- foreign keys: MenuPage.menu_id -> Menu.id; MenuItem.menu_page_id -> MenuPage.id; MenuItem.dish_id -> Dish.id

Hint: page 1 refers to page_number = 1;

Question: How many dishes are there on page 1 of menu ID12882?

assistant: SELECT SUM(CASE WHEN T1.page_number = 1 THEN 1 ELSE 0 END) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id WHERE T1.menu_id = 12882
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE playstore (
  App text,
  Category text,
  Rating real,
  Reviews integer,
  Size text,
  Installs text,
  Type text,
  Price text,
  Content Rating text,
  Genres text
);
CREATE TABLE user_reviews (
  App text,
  Translated_Review text,
  Sentiment text,
  Sentiment_Polarity text,
  Sentiment_Subjectivity text
);
-- foreign keys: user_reviews.App -> playstore.App

Hint: user holds neutral attitude refers to Sentiment = 'Neutral';

Question: How many users holds neutral attitude towards the HTC Weather app? Indicate the app's rating on the Google Play Store.

assistant: SELECT COUNT(T1.Rating), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'HTC Weather' AND T2.Sentiment = 'Neutral'
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE Customers (
  CustomerID integer PRIMARY KEY,
  Customer Names text
);
CREATE TABLE Products (
  ProductID integer PRIMARY KEY,
  Product Name text
);
CREATE TABLE Regions (
  StateCode text PRIMARY KEY,
  State text,
  Region text
);
CREATE TABLE Sales Team (
  SalesTeamID integer PRIMARY KEY,
  Sales Team text,
  Region text
);
CREATE TABLE Store Locations (
  StoreID integer PRIMARY KEY,
  City Name text,
  County text,
  StateCode text,
  State text,
  Type text,
  Latitude real,
  Longitude real,
  AreaCode integer,
  Population integer,
  Household Income integer,
  Median Income integer,
  Land Area integer,
  Water Area integer,
  Time Zone text
);
CREATE TABLE Sales Orders (
  OrderNumber text PRIMARY KEY,
  Sales Channel text,
  WarehouseCode text,
  ProcuredDate text,
  OrderDate text,
  ShipDate text,
  DeliveryDate text,
  CurrencyCode text,
  _SalesTeamID integer,
  _CustomerID integer,
  _StoreID integer,
  _ProductID integer,
  Order Quantity integer,
  Discount Applied real,
  Unit Price text,
  Unit Cost text
);
-- foreign keys: Store Locations.StateCode -> Regions.StateCode; Sales Orders._ProductID -> Products.ProductID; Sales Orders._StoreID -> Store Locations.StoreID; Sales Orders._CustomerID -> Customers.CustomerID; Sales Orders._SalesTeamID -> Sales Team.SalesTeamID

Question: How many states located in the Midwest region?

assistant: SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN StateCode ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE chapters (
  id integer PRIMARY KEY,
  Act integer,
  Scene integer,
  Description text,
  work_id integer
);
CREATE TABLE characters (
  id integer PRIMARY KEY,
  CharName text,
  Abbrev text,
  Description text
);
CREATE TABLE paragraphs (
  id integer PRIMARY KEY,
  ParagraphNum integer,
  PlainText text,
  character_id integer,
  chapter_id integer
);
CREATE TABLE works (
  id integer PRIMARY KEY,
  Title text,
  LongTitle text,
  Date integer,
  GenreType text
);

Hint: "Comedy of Errors" refers to Title = 'Comedy of Errors'

Question: How many paragraphs are there in Act 5 Scene 1 of "Comedy of Errors"?

assistant: SELECT COUNT(T3.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T2.Act = 5 AND T2.Scene = 1 AND T1.Title = 'Comedy of Errors'
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE "Songs" ( 
	"SongId" INTEGER PRIMARY KEY, 
	"Title" TEXT 
);
CREATE TABLE "Albums" ( 
	"AId" INTEGER PRIMARY KEY, 
	"Title" TEXT, 
	"Year" INTEGER, 
	"Label" TEXT, 
	"Type" TEXT );
CREATE TABLE "Band" ( 
	"Id" INTEGER PRIMARY KEY, 
	"Firstname" TEXT, 
	"Lastname" TEXT );
CREATE TABLE "Instruments" ( 
	"SongId" INTEGER, 
	"BandmateId" INTEGER, 
	"Instrument" TEXT ,
	PRIMARY KEY(SongId, BandmateId, Instrument),
	FOREIGN KEY (SongId) REFERENCES Songs(SongId),
	FOREIGN KEY (BandmateId) REFERENCES Band(Id)
);
CREATE TABLE "Performance" ( 
	"SongId" INTEGER, 
	"Bandmate" INTEGER, 
	"StagePosition" TEXT,
	PRIMARY KEY(SongId, Bandmate),
	FOREIGN KEY (SongId) REFERENCES Songs(SongId),
	FOREIGN KEY (Bandmate) REFERENCES Band(Id)
);
CREATE TABLE "Tracklists" ( 
	"AlbumId" INTEGER, 
	"Position" INTEGER, 
	"SongId" INTEGER ,
	PRIMARY KEY(AlbumId, Position),
	FOREIGN KEY (SongId) REFERENCES Songs(SongId),
	FOREIGN KEY (AlbumId) REFERENCES Albums(AId)
);
CREATE TABLE "Vocals" ( 
	"SongId" INTEGER, 
	"Bandmate" INTEGER, 
	"Type" TEXT,
	PRIMARY KEY(SongId, Bandmate),
	FOREIGN KEY (SongId) REFERENCES Songs(SongId),
	FOREIGN KEY (Bandmate) REFERENCES Band(Id)
);

Question: Who performed the song named "Le Pop"?

assistant: SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Le Pop"
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE customer (
  c_custkey integer PRIMARY KEY,
  c_mktsegment text,
  c_nationkey integer,
  c_name text,
  c_address text,
  c_phone text,
  c_acctbal real,
  c_comment text
);
CREATE TABLE lineitem (
  l_shipdate date,
  l_orderkey integer PRIMARY KEY,
  l_discount real,
  l_extendedprice real,
  l_suppkey integer,
  l_quantity integer,
  l_returnflag text,
  l_partkey integer,
  l_linestatus text,
  l_tax real,
  l_commitdate date,
  l_receiptdate date,
  l_shipmode text,
  l_linenumber integer PRIMARY KEY,
  l_shipinstruct text,
  l_comment text
);
CREATE TABLE nation (
  n_nationkey integer PRIMARY KEY,
  n_name text,
  n_regionkey integer,
  n_comment text
);
CREATE TABLE orders (
  o_orderdate date,
  o_orderkey integer PRIMARY KEY,
  o_custkey integer,
  o_orderpriority text,
  o_shippriority integer,
  o_clerk text,
  o_orderstatus text,
  o_totalprice real,
  o_comment text
);
CREATE TABLE part (
  p_partkey integer PRIMARY KEY,
  p_type text,
  p_size integer,
  p_brand text,
  p_name text,
  p_container text,
  p_mfgr text,
  p_retailprice real,
  p_comment text
);
CREATE TABLE partsupp (
  ps_partkey integer PRIMARY KEY,
  ps_suppkey integer PRIMARY KEY,
  ps_supplycost real,
  ps_availqty integer,
  ps_comment text
);
CREATE TABLE region (
  r_regionkey integer PRIMARY KEY,
  r_name text,
  r_comment text
);
CREATE TABLE supplier (
  s_suppkey integer PRIMARY KEY,
  s_nationkey integer,
  s_comment text,
  s_name text,
  s_address text,
  s_phone text,
  s_acctbal real
);
-- foreign keys: customer.c_nationkey -> nation.n_nationkey; lineitem.l_partkey -> partsupp.ps_partkey; lineitem.l_suppkey -> partsupp.ps_suppkey; lineitem.l_orderkey -> orders.o_orderkey; nation.n_regionkey -> region.r_regionkey; orders.o_custkey -> customer.c_custkey; partsupp.ps_suppkey -> supplier.s_suppkey; partsupp.ps_partkey -> part.p_partkey; supplier.s_nationkey -> nation.n_nationkey

Hint: part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'

Question: The part "hot spring dodger dim light" is ordered in how many orders?

assistant: SELECT COUNT(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light'
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE "basketball_match" (
"Team_ID" int,
"School_ID" int,
"Team_Name" text,
"ACC_Regular_Season" text,
"ACC_Percent" text,
"ACC_Home" text,
"ACC_Road" text,
"All_Games" text,
"All_Games_Percent" int,
"All_Home" text,
"All_Road" text,
"All_Neutral" text,
PRIMARY KEY ("Team_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `university`(`School_ID`)
);

CREATE TABLE "university" (
"School_ID" int,
"School" text,
"Location" text,
"Founded" real,
"Affiliation" text,
"Enrollment" real,
"Nickname" text,
"Primary_conference" text,
PRIMARY KEY ("School_ID")
);

Question: Return the primary conference of the school with the lowest acc percentage score.

assistant: SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE Attributes (
  attribute_id integer PRIMARY KEY,
  attribute_name text
);
CREATE TABLE Categories (
  category_id integer PRIMARY KEY,
  category_name text
);
CREATE TABLE Compliments (
  compliment_id integer PRIMARY KEY,
  compliment_type text
);
CREATE TABLE Days (
  day_id integer PRIMARY KEY,
  day_of_week text
);
CREATE TABLE Years (
  year_id integer PRIMARY KEY,
  actual_year integer
);
CREATE TABLE Business_Attributes (
  attribute_id integer PRIMARY KEY,
  business_id integer PRIMARY KEY,
  attribute_value text
);
CREATE TABLE Business_Categories (
  business_id integer PRIMARY KEY,
  category_id integer PRIMARY KEY
);
CREATE TABLE Business_Hours (
  business_id integer PRIMARY KEY,
  day_id integer PRIMARY KEY,
  opening_time text,
  closing_time text
);
CREATE TABLE Checkins (
  business_id integer PRIMARY KEY,
  day_id integer PRIMARY KEY,
  label_time_0 text,
  label_time_1 text,
  label_time_2 text,
  label_time_3 text,
  label_time_4 text,
  label_time_5 text,
  label_time_6 text,
  label_time_7 text,
  label_time_8 text,
  label_time_9 text,
  label_time_10 text,
  label_time_11 text,
  label_time_12 text,
  label_time_13 text,
  label_time_14 text,
  label_time_15 text,
  label_time_16 text,
  label_time_17 text,
  label_time_18 text,
  label_time_19 text,
  label_time_20 text,
  label_time_21 text,
  label_time_22 text,
  label_time_23 text
);
CREATE TABLE Elite (
  user_id integer PRIMARY KEY,
  year_id integer PRIMARY KEY
);
CREATE TABLE Reviews (
  business_id integer PRIMARY KEY,
  user_id integer PRIMARY KEY,
  review_stars integer,
  review_votes_funny text,
  review_votes_useful text,
  review_votes_cool text,
  review_length text
);
CREATE TABLE Tips (
  business_id integer PRIMARY KEY,
  user_id integer PRIMARY KEY,
  likes integer,
  tip_length text
);
CREATE TABLE Users_Compliments (
  compliment_id integer PRIMARY KEY,
  user_id integer PRIMARY KEY,
  number_of_compliments text
);
CREATE TABLE Business (
  business_id integer PRIMARY KEY,
  active text,
  city text,
  state text,
  stars real,
  review_count text
);
CREATE TABLE Users (
  user_id integer PRIMARY KEY,
  user_yelping_since_year integer,
  user_average_stars text,
  user_votes_funny text,
  user_votes_useful text,
  user_votes_cool text,
  user_review_count text,
  user_fans text
);

Hint: businesses in "Pets" category refers to category_name = 'Pets'; percentage refers to DIVIDE(COUNT(category_name = 'Pets'), COUNT(business_id)) * 100%

Question: What is the percentage for the Yelp businesses in "Pets" category of all businesses?

assistant: SELECT CAST(SUM(CASE WHEN T2.category_name = 'Pets' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category_name) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;

CREATE TABLE `Third_Party_Companies` (
`company_id` INTEGER PRIMARY KEY ,
`company_type` VARCHAR(5) NOT NULL,
`company_name` VARCHAR(255),
`company_address` VARCHAR(255),
`other_company_details` VARCHAR(255)
);

Question: What is the description of the type of the company who concluded its contracts most recently?

assistant: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code = T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;
CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);

CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
);
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
);

CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
);

CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
);

CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
);

CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
);

CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
);

Question: Show all role codes with at least 3 employees.

assistant: SELECT role_code FROM Employees GROUP BY role_code HAVING count(*) >= 3
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
create table Student (
        StuID        INTEGER PRIMARY KEY,
        LName        VARCHAR(12),
        Fname        VARCHAR(12),
        Age      INTEGER,
        Sex      VARCHAR(1),
        Major        INTEGER,
        Advisor      INTEGER,
        city_code    VARCHAR(3)
 );
 

create table Dorm (
       dormid		INTEGER,
       dorm_name	VARCHAR(20),
       student_capacity	INTEGER,
       gender			VARCHAR(1)
) ;

create table Dorm_amenity (
       amenid			INTEGER,
       amenity_name		VARCHAR(25)
) ;

create table Has_amenity (
       dormid			INTEGER,
       amenid				INTEGER,
	FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),
	FOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)
);

create table Lives_in (
       stuid 	      INTEGER,
       dormid		INTEGER,
       room_number	INTEGER,
	FOREIGN KEY (stuid) REFERENCES `Student`(StuID),
        FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)
);

Question: Find the average age of all students living in the each city.

assistant: SELECT avg(age) , city_code FROM student GROUP BY city_code
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;

CREATE TABLE "mountain" (
"Mountain_ID" int,
"Name" text,
"Height" real,
"Prominence" real,
"Range" text,
"Country" text,
PRIMARY KEY ("Mountain_ID")
);

CREATE TABLE "climber" (
"Climber_ID" int,
"Name" text,
"Country" text,
"Time" text,
"Points" real,
"Mountain_ID" int,
PRIMARY KEY ("Climber_ID"),
FOREIGN KEY ("Mountain_ID") REFERENCES "mountain"("Mountain_ID")
);

Question: What is the maximum point for climbers whose country is United Kingdom?

assistant: SELECT max(Points) FROM climber WHERE Country = "United Kingdom"
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;

CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);

CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);

Question: Find the captain rank that has no captain in Third-rate ship of the line class.

assistant: SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;

CREATE TABLE "School" (
"School_id" text,
"School_name" text,
"Location" text,
"Mascot" text,
"Enrollment" int,
"IHSAA_Class" text,
"IHSAA_Football_Class" text,
"County" text,
PRIMARY KEY ("School_id")
);

CREATE TABLE "budget" (
"School_id" int,
"Year" int,
"Budgeted" int,
"total_budget_percent_budgeted" real,
"Invested" int,
"total_budget_percent_invested" real,
"Budget_invested_percent" text,
PRIMARY KEY("School_id","YEAR"),
FOREIGN KEY("School_id") REFERENCES "School"("School_id")

);

CREATE TABLE "endowment" (
"endowment_id" int,
"School_id" int,
"donator_name" text,
"amount" real,
PRIMARY KEY("endowment_id"),
FOREIGN KEY("School_id") REFERENCES "School"("School_id")
);

Question: Find the number of schools that have more than one donator whose donation amount is less than 8.5.

assistant: SELECT count(*) FROM (SELECT * FROM endowment WHERE amount > 8.5 GROUP BY school_id HAVING count(*) > 1)
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
);

Question: What are all the dates of enrollment and completion in record?

assistant: SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment