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 country (
  id integer PRIMARY KEY,
  country_name text
);
CREATE TABLE ranking_system (
  id integer PRIMARY KEY,
  system_name text
);
CREATE TABLE ranking_criteria (
  id integer PRIMARY KEY,
  ranking_system_id integer,
  criteria_name text
);
CREATE TABLE university (
  id integer PRIMARY KEY,
  country_id integer,
  university_name text
);
CREATE TABLE university_ranking_year (
  university_id integer,
  ranking_criteria_id integer,
  year integer,
  score integer
);
CREATE TABLE university_year (
  university_id integer,
  year integer,
  num_students integer,
  student_staff_ratio real,
  pct_international_students integer,
  pct_female_students integer
);
-- foreign keys: ranking_criteria.ranking_system_id -> ranking_system.id; university.country_id -> country.id; university_ranking_year.university_id -> university.id; university_ranking_year.ranking_criteria_id -> ranking_criteria.id; university_year.university_id -> university.id

Hint: in 2011 refers to year 2011; in teaching refers to  criteria_name = 'Teaching'; score in teaching of over 90 refers to score > 90; name of university refers to university_name;

Question: Please list the names of the universities with a score in teaching of over 90 in 2011.

assistant: SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score > 90
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 course (
  course_id integer PRIMARY KEY,
  courseLevel text
);
CREATE TABLE person (
  p_id integer PRIMARY KEY,
  professor integer,
  student integer,
  hasPosition text,
  inPhase text,
  yearsInProgram text
);
CREATE TABLE advisedBy (
  p_id integer PRIMARY KEY,
  p_id_dummy integer PRIMARY KEY
);
CREATE TABLE taughtBy (
  course_id integer PRIMARY KEY,
  p_id integer PRIMARY KEY
);
-- foreign keys: advisedBy.p_id -> person.p_id; advisedBy.p_id_dummy -> person.p_id; taughtBy.course_id -> course.course_id; taughtBy.p_id -> person.p_id

Hint: ID of advisor refers to p_id_dummy; student ID 80 refers to advisedBy.p_id = 80; level of courses refers to courseLevel

Question: Find the ID of advisor of student ID 80 and state the level of courses taught by him/her.

assistant: SELECT T1.p_id_dummy, T2.courseLevel FROM advisedBy AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T1.p_id = 80
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 "artist" (
    "Artist_ID" int,
    "Artist" text,
    "Age" int,
    "Famous_Title" text,
    "Famous_Release_date" text,
    PRIMARY KEY ("Artist_ID")
);



CREATE TABLE "volume" (
    "Volume_ID" int,
    "Volume_Issue" text,
    "Issue_Date" text,
    "Weeks_on_Top" real,
    "Song" text,
    "Artist_ID" int,
    PRIMARY KEY ("Volume_ID"),
    FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)
);

Question: Return the average age across all artists.

assistant: SELECT avg(Age) FROM artist
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 ATT_CLASSES (
  ATT_CLASS_ID integer PRIMARY KEY,
  ATT_CLASS text
);
CREATE TABLE OBJ_CLASSES (
  OBJ_CLASS_ID integer PRIMARY KEY,
  OBJ_CLASS text
);
CREATE TABLE IMG_OBJ (
  IMG_ID integer PRIMARY KEY,
  OBJ_SAMPLE_ID integer PRIMARY KEY,
  OBJ_CLASS_ID integer,
  X integer,
  Y integer,
  W integer,
  H integer
);
CREATE TABLE IMG_OBJ_ATT (
  IMG_ID integer PRIMARY KEY,
  ATT_CLASS_ID integer PRIMARY KEY,
  OBJ_SAMPLE_ID integer PRIMARY KEY
);
CREATE TABLE PRED_CLASSES (
  PRED_CLASS_ID integer PRIMARY KEY,
  PRED_CLASS text
);
CREATE TABLE IMG_REL (
  IMG_ID integer PRIMARY KEY,
  PRED_CLASS_ID integer PRIMARY KEY,
  OBJ1_SAMPLE_ID integer PRIMARY KEY,
  OBJ2_SAMPLE_ID integer PRIMARY KEY
);
-- foreign keys: IMG_OBJ.OBJ_CLASS_ID -> OBJ_CLASSES.OBJ_CLASS_ID; IMG_OBJ_ATT.IMG_ID -> IMG_OBJ.IMG_ID; IMG_OBJ_ATT.OBJ_SAMPLE_ID -> IMG_OBJ.OBJ_SAMPLE_ID; IMG_OBJ_ATT.ATT_CLASS_ID -> ATT_CLASSES.ATT_CLASS_ID; IMG_REL.IMG_ID -> IMG_OBJ.IMG_ID; IMG_REL.OBJ2_SAMPLE_ID -> IMG_OBJ.OBJ_SAMPLE_ID; IMG_REL.IMG_ID -> IMG_OBJ.IMG_ID; IMG_REL.OBJ1_SAMPLE_ID -> IMG_OBJ.OBJ_SAMPLE_ID; IMG_REL.PRED_CLASS_ID -> PRED_CLASSES.PRED_CLASS_ID

Hint: object in image 5 refers to OBJ_SAMPLE_ID where IMG_ID = 5; coordinates of (634, 468) refer to X and Y coordinates of the bounding box in which X = 634 and Y = 468;

Question: Find the object in image 5 where the object with the coordinate of (634, 468).

assistant: SELECT OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 5 AND X = 634 AND Y = 468
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 film_text (
  film_id integer PRIMARY KEY,
  title text,
  description text
);
CREATE TABLE actor (
  actor_id integer PRIMARY KEY,
  first_name text,
  last_name text,
  last_update datetime
);
CREATE TABLE address (
  address_id integer PRIMARY KEY,
  address text,
  address2 text,
  district text,
  city_id integer,
  postal_code text,
  phone text,
  last_update datetime
);
CREATE TABLE category (
  category_id integer PRIMARY KEY,
  name text,
  last_update datetime
);
CREATE TABLE city (
  city_id integer PRIMARY KEY,
  city text,
  country_id integer,
  last_update datetime
);
CREATE TABLE country (
  country_id integer PRIMARY KEY,
  country text,
  last_update datetime
);
CREATE TABLE customer (
  customer_id integer PRIMARY KEY,
  store_id integer,
  first_name text,
  last_name text,
  email text,
  address_id integer,
  active integer,
  create_date datetime,
  last_update datetime
);
CREATE TABLE film (
  film_id integer PRIMARY KEY,
  title text,
  description text,
  release_year text,
  language_id integer,
  original_language_id integer,
  rental_duration integer,
  rental_rate real,
  length integer,
  replacement_cost real,
  rating text,
  special_features text,
  last_update datetime
);
CREATE TABLE film_actor (
  actor_id integer PRIMARY KEY,
  film_id integer PRIMARY KEY,
  last_update datetime
);
CREATE TABLE film_category (
  film_id integer PRIMARY KEY,
  category_id integer PRIMARY KEY,
  last_update datetime
);
CREATE TABLE inventory (
  inventory_id integer PRIMARY KEY,
  film_id integer,
  store_id integer,
  last_update datetime
);
CREATE TABLE language (
  language_id integer PRIMARY KEY,
  name text,
  last_update datetime
);
CREATE TABLE payment (
  payment_id integer PRIMARY KEY,
  customer_id integer,
  staff_id integer,
  rental_id integer,
  amount real,
  payment_date datetime,
  last_update datetime
);
CREATE TABLE rental (
  rental_id integer PRIMARY KEY,
  rental_date datetime,
  inventory_id integer,
  customer_id integer,
  return_date datetime,
  staff_id integer,
  last_update datetime
);
CREATE TABLE staff (
  staff_id integer PRIMARY KEY,
  first_name text,
  last_name text,
  address_id integer,
  picture blob,
  email text,
  store_id integer,
  active integer,
  username text,
  password text,
  last_update datetime
);
CREATE TABLE store (
  store_id integer PRIMARY KEY,
  manager_staff_id integer,
  address_id integer,
  last_update datetime
);

Hint: full name refers to first_name, last_name; 692 Joliet Street refers to address = '692 Joliet Street'

Question: Please provide the full name of the customer at 692 Joliet Street.

assistant: SELECT T2.first_name, T2.last_name FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '692 Joliet Street'
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 city (
  city_id integer PRIMARY KEY,
  city_name text,
  state text,
  population integer,
  area real
);
CREATE TABLE customer (
  cust_id integer PRIMARY KEY,
  cust_name text,
  annual_revenue integer,
  cust_type text,
  address text,
  city text,
  state text,
  zip real,
  phone text
);
CREATE TABLE driver (
  driver_id integer PRIMARY KEY,
  first_name text,
  last_name text,
  address text,
  city text,
  state text,
  zip_code integer,
  phone text
);
CREATE TABLE truck (
  truck_id integer PRIMARY KEY,
  make text,
  model_year integer
);
CREATE TABLE shipment (
  ship_id integer PRIMARY KEY,
  cust_id integer,
  weight real,
  truck_id integer,
  driver_id integer,
  city_id integer,
  ship_date text
);
-- foreign keys: shipment.truck_id -> truck.truck_id; shipment.driver_id -> driver.driver_id; shipment.city_id -> city.city_id; shipment.cust_id -> customer.cust_id

Hint: shipment id 1003 refers to ship_id = 1003

Question: What is the model year of the truck used in shipment id 1003?

assistant: SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1003'
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 location (
  locationID integer PRIMARY KEY,
  locationcity text,
  address text,
  state text,
  zipcode integer,
  officephone text
);
CREATE TABLE position (
  positionID integer PRIMARY KEY,
  positiontitle text,
  educationrequired text,
  minsalary text,
  maxsalary text
);
CREATE TABLE employee (
  ssn text PRIMARY KEY,
  lastname text,
  firstname text,
  hiredate text,
  salary text,
  gender text,
  performance text,
  positionID integer,
  locationID integer
);
-- foreign keys: employee.positionID -> position.positionID; employee.locationID -> location.locationID

Hint: full name = firstname, lastname; social security number refers to ssn; account representative is a position title; average performance refers to performance = 'Average'

Question: List the full name and social security number of the account representative with average performance.

assistant: SELECT T1.firstname, T1.lastname, T1.ssn FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Average'
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 businesses (
  business_id integer PRIMARY KEY,
  name text,
  address text,
  city text,
  postal_code text,
  latitude real,
  longitude real,
  phone_number integer,
  tax_code text,
  business_certificate integer,
  application_date date,
  owner_name text,
  owner_address text,
  owner_city text,
  owner_state text,
  owner_zip text
);
CREATE TABLE inspections (
  business_id integer,
  score integer,
  date date,
  type text
);
CREATE TABLE violations (
  business_id integer,
  date date,
  violation_type_id text,
  risk_category text,
  description text
);
-- foreign keys: inspections.business_id -> businesses.business_id; violations.business_id -> businesses.business_id

Hint: eateries represent business; highest score in inspection refers to score = 100;

Question: When did eateries from San Bruno city get highest score in inspection?

assistant: SELECT T1.`date` FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'SAN BRUNO' ORDER BY T1.score 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_Payment_Methods (
payment_method_code CHAR(10) NOT NULL,
payment_method_description VARCHAR(80),
PRIMARY KEY (payment_method_code),
UNIQUE (payment_method_code)
);

Question: Give me all the phone numbers and email addresses of the workshop groups where services are performed.

assistant: SELECT T1.Store_Phone , T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_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 Ref_Document_Types (
document_type_code CHAR(15) NOT NULL,
document_type_description VARCHAR(255) NOT NULL,
PRIMARY KEY (document_type_code)
);

Question: How many employees do we have?

assistant: SELECT count(*) FROM Employees;
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 cites (
  cited_paper_id text PRIMARY KEY,
  citing_paper_id text PRIMARY KEY
);
CREATE TABLE paper (
  paper_id text PRIMARY KEY,
  class_label text
);
CREATE TABLE content (
  paper_id text PRIMARY KEY,
  word_cited_id text PRIMARY KEY
);
-- foreign keys: content.paper_id -> paper.paper_id

Question: Name the paper which is cited most times and the paper which is cited least times? Also, find the number of times each one is cited.

assistant: SELECT cited_paper_id, COUNT(cited_paper_id), ( SELECT cited_paper_id FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) ASC LIMIT 1 ), ( SELECT COUNT(cited_paper_id) FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) ASC LIMIT 1 ) FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) 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:
CREATE TABLE Categories (
  CategoryID integer PRIMARY KEY,
  CategoryName text,
  Description text
);
CREATE TABLE Customers (
  CustomerID integer PRIMARY KEY,
  CustomerName text,
  ContactName text,
  Address text,
  City text,
  PostalCode text,
  Country text
);
CREATE TABLE Employees (
  EmployeeID integer PRIMARY KEY,
  LastName text,
  FirstName text,
  BirthDate date,
  Photo text,
  Notes text
);
CREATE TABLE Shippers (
  ShipperID integer PRIMARY KEY,
  ShipperName text,
  Phone text
);
CREATE TABLE Suppliers (
  SupplierID integer PRIMARY KEY,
  SupplierName text,
  ContactName text,
  Address text,
  City text,
  PostalCode text,
  Country text,
  Phone text
);
CREATE TABLE Products (
  ProductID integer PRIMARY KEY,
  ProductName text,
  SupplierID integer,
  CategoryID integer,
  Unit text,
  Price real
);
CREATE TABLE Orders (
  OrderID integer PRIMARY KEY,
  CustomerID integer,
  EmployeeID integer,
  OrderDate datetime,
  ShipperID integer
);
CREATE TABLE OrderDetails (
  OrderDetailID integer PRIMARY KEY,
  OrderID integer,
  ProductID integer,
  Quantity integer
);
-- foreign keys: Products.SupplierID -> Suppliers.SupplierID; Products.CategoryID -> Categories.CategoryID; Orders.ShipperID -> Shippers.ShipperID; Orders.CustomerID -> Customers.CustomerID; Orders.EmployeeID -> Employees.EmployeeID; OrderDetails.ProductID -> Products.ProductID; OrderDetails.OrderID -> Orders.OrderID

Hint: supplied by "G'day, Mate" refers to CompanyName = 'G''day, Mate';

Question: Which products are being supplied by "G'day, Mate"? List all of their names.

assistant: SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'G%day, Mate'
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 Classification (
  GeneID text PRIMARY KEY,
  Localization text
);
CREATE TABLE Genes (
  GeneID text,
  Essential text,
  Class text,
  Complex text,
  Phenotype text,
  Motif text,
  Chromosome integer,
  Function text,
  Localization text
);
CREATE TABLE Interactions (
  GeneID1 text PRIMARY KEY,
  GeneID2 text PRIMARY KEY,
  Type text,
  Expression_Corr real
);
-- foreign keys: Genes.GeneID -> Classification.GeneID; Interactions.GeneID2 -> Classification.GeneID; Interactions.GeneID1 -> Classification.GeneID

Hint: If the Expression_Corr value is negative then it's negatively correlated; Percentage of Essensity = [count(negatively correlated, genetical interaction, non-essential) / count(negatively correlated, genetical interaction, non-essential+negatively correlated, genetical interaction, essential)] * 100%

Question: Which negatively correlated, genetically interacting genes are non-essential? What percentage do they represent with respect to those that are essential?

assistant: SELECT CAST(COUNT(T1.GeneID) AS REAL) * 100 / ( SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 ) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Essential = 'Non-Essential'
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: Chicken gumbo is a name of dish; biggest width refers to MAX(full_width);

Question: Among the menu pages on which the dish "Chicken gumbo" had appeared, what is the menu ID of the one with the biggest width?

assistant: SELECT T1.id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo' ORDER BY T1.full_width 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:
CREATE TABLE Community_Area (
  community_area_no integer PRIMARY KEY,
  community_area_name text,
  side text,
  population text
);
CREATE TABLE District (
  district_no integer PRIMARY KEY,
  district_name text,
  address text,
  zip_code integer,
  commander text,
  email text,
  phone text,
  fax text,
  tty text,
  twitter text
);
CREATE TABLE FBI_Code (
  fbi_code_no text PRIMARY KEY,
  title text,
  description text,
  crime_against text
);
CREATE TABLE IUCR (
  iucr_no text PRIMARY KEY,
  primary_description text,
  secondary_description text,
  index_code text
);
CREATE TABLE Neighborhood (
  neighborhood_name text PRIMARY KEY,
  community_area_no integer
);
CREATE TABLE Ward (
  ward_no integer PRIMARY KEY,
  alderman_first_name text,
  alderman_last_name text,
  alderman_name_suffix text,
  ward_office_address text,
  ward_office_zip text,
  ward_email text,
  ward_office_phone text,
  ward_office_fax text,
  city_hall_office_room integer,
  city_hall_office_phone text,
  city_hall_office_fax text,
  Population integer
);
CREATE TABLE Crime (
  report_no integer PRIMARY KEY,
  case_number text,
  date text,
  block text,
  iucr_no text,
  location_description text,
  arrest text,
  domestic text,
  beat integer,
  district_no integer,
  ward_no integer,
  community_area_no integer,
  fbi_code_no text,
  latitude text,
  longitude text
);
-- foreign keys: Neighborhood.community_area_no -> Community_Area.community_area_no; Crime.fbi_code_no -> FBI_Code.fbi_code_no; Crime.community_area_no -> Community_Area.community_area_no; Crime.district_no -> District.district_no; Crime.iucr_no -> IUCR.iucr_no; Crime.ward_no -> Ward.ward_no

Hint: case No. JB103470 refers to case_number = 'JB103470'; full name refers to alderman_first_name, alderman_last_name

Question: Who was the alderman of the legislative district where case No. JB103470 took place? Give the full name.

assistant: SELECT T1.alderman_first_name, T1.alderman_last_name FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.case_number = 'JB103470'