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: comment refers to o_comment; furniture segment refers to c_mktsegment = 'FURNITURE'

Question: List the comments describing orders from customers in the furniture segment.

assistant: SELECT T1.o_comment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'FURNITURE'
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 langs (
  lid integer PRIMARY KEY,
  lang text,
  locale text,
  pages integer,
  words integer
);
CREATE TABLE pages (
  pid integer PRIMARY KEY,
  lid integer,
  page integer,
  revision integer,
  title text,
  words integer
);
CREATE TABLE words (
  wid integer PRIMARY KEY,
  word text,
  occurrences integer
);
CREATE TABLE langs_words (
  lid integer PRIMARY KEY,
  wid integer PRIMARY KEY,
  occurrences integer
);
CREATE TABLE pages_words (
  pid integer PRIMARY KEY,
  wid integer PRIMARY KEY,
  occurrences integer
);
CREATE TABLE biwords (
  lid integer PRIMARY KEY,
  w1st integer PRIMARY KEY,
  w2nd integer PRIMARY KEY,
  occurrences integer
);
-- foreign keys: pages.lid -> langs.lid; langs_words.wid -> words.wid; langs_words.lid -> langs.lid; pages_words.wid -> words.wid; pages_words.pid -> pages.pid; biwords.w2nd -> words.wid; biwords.w1st -> words.wid; biwords.lid -> langs.lid

Hint: highest number of different words refers to max(words)

Question: What is the title of the Catalan language Wikipedia page that has the highest number of different words?

assistant: SELECT title FROM pages WHERE words = ( SELECT MAX(words) FROM pages )
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 essays (
  projectid text,
  teacher_acctid text,
  title text,
  short_description text,
  need_statement text,
  essay text
);
CREATE TABLE projects (
  projectid text PRIMARY KEY,
  teacher_acctid text,
  schoolid text,
  school_ncesid text,
  school_latitude real,
  school_longitude real,
  school_city text,
  school_state text,
  school_zip integer,
  school_metro text,
  school_district text,
  school_county text,
  school_charter text,
  school_magnet text,
  school_year_round text,
  school_nlns text,
  school_kipp text,
  school_charter_ready_promise text,
  teacher_prefix text,
  teacher_teach_for_america text,
  teacher_ny_teaching_fellow text,
  primary_focus_subject text,
  primary_focus_area text,
  secondary_focus_subject text,
  secondary_focus_area text,
  resource_type text,
  poverty_level text,
  grade_level text,
  fulfillment_labor_materials real,
  total_price_excluding_optional_support real,
  total_price_including_optional_support real,
  students_reached integer,
  eligible_double_your_impact_match text,
  eligible_almost_home_match text,
  date_posted date
);
CREATE TABLE donations (
  donationid text PRIMARY KEY,
  projectid text,
  donor_acctid text,
  donor_city text,
  donor_state text,
  donor_zip text,
  is_teacher_acct text,
  donation_timestamp datetime,
  donation_to_project real,
  donation_optional_support real,
  donation_total real,
  dollar_amount text,
  donation_included_optional_support text,
  payment_method text,
  payment_included_acct_credit text,
  payment_included_campaign_gift_card text,
  payment_included_web_purchased_gift_card text,
  payment_was_promo_matched text,
  via_giving_page text,
  for_honoree text,
  donation_message text
);
CREATE TABLE resources (
  resourceid text PRIMARY KEY,
  projectid text,
  vendorid integer,
  vendor_name text,
  project_resource_type text,
  item_name text,
  item_number text,
  item_unit_price real,
  item_quantity integer
);
-- foreign keys: donations.projectid -> projects.projectid; resources.projectid -> projects.projectid

Hint: ABC School Supply refer to vendor_name; listed type as Other refer to project_resource_type = 'Other'; coordinates refer to coordinates(school_latitude, school_longitude); total price of items refer to SUM(MULTIPLY(item_unit_price, item_quantity where vendor_name = ’ABC School Supply’))

Question: What is the total price of items brought from ABC School Supply with a listed type of Other? Also include the list of the buyers' coordinates and school districts they belong to.

assistant: SELECT T2.item_unit_price * T2.item_quantity price, T1.school_latitude, T1.school_longitude FROM projects AS T1 INNER JOIN resources AS T2 ON T1.projectid = T2.projectid WHERE T2.vendor_name = 'ABC School Supply' AND T2.project_resource_type = 'Other' AND T1.school_district = 'Hillsborough Co Pub Sch Dist'
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 address_status (
  status_id integer PRIMARY KEY,
  address_status text
);
CREATE TABLE author (
  author_id integer PRIMARY KEY,
  author_name text
);
CREATE TABLE book_language (
  language_id integer PRIMARY KEY,
  language_code text,
  language_name text
);
CREATE TABLE country (
  country_id integer PRIMARY KEY,
  country_name text
);
CREATE TABLE address (
  address_id integer PRIMARY KEY,
  street_number text,
  street_name text,
  city text,
  country_id integer
);
CREATE TABLE customer (
  customer_id integer PRIMARY KEY,
  first_name text,
  last_name text,
  email text
);
CREATE TABLE customer_address (
  customer_id integer PRIMARY KEY,
  address_id integer PRIMARY KEY,
  status_id integer
);
CREATE TABLE order_status (
  status_id integer PRIMARY KEY,
  status_value text
);
CREATE TABLE publisher (
  publisher_id integer PRIMARY KEY,
  publisher_name text
);
CREATE TABLE book (
  book_id integer PRIMARY KEY,
  title text,
  isbn13 text,
  language_id integer,
  num_pages integer,
  publication_date date,
  publisher_id integer
);
CREATE TABLE book_author (
  book_id integer PRIMARY KEY,
  author_id integer PRIMARY KEY
);
CREATE TABLE shipping_method (
  method_id integer PRIMARY KEY,
  method_name text,
  cost real
);
CREATE TABLE cust_order (
  order_id integer PRIMARY KEY,
  order_date datetime,
  customer_id integer,
  shipping_method_id integer,
  dest_address_id integer
);
CREATE TABLE order_history (
  history_id integer PRIMARY KEY,
  order_id integer,
  status_id integer,
  status_date datetime
);
CREATE TABLE order_line (
  line_id integer PRIMARY KEY,
  order_id integer,
  book_id integer,
  price real
);
-- foreign keys: address.country_id -> country.country_id; customer_address.customer_id -> customer.customer_id; customer_address.address_id -> address.address_id; book.publisher_id -> publisher.publisher_id; book.language_id -> book_language.language_id; book_author.book_id -> book.book_id; book_author.author_id -> author.author_id

Hint: shipped internationally refers to method_name = 'International'; percentage = Divide (Sum(price where method_name = 'International'), Sum(price)) * 100

Question: What percentage of the total prices of all orders are shipped internationally?

assistant: SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_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:
CREATE TABLE Person (
  name varchar(20) PRIMARY KEY,
  age INTEGER,
  city TEXT,
  gender TEXT,
  job TEXT
);

CREATE TABLE PersonFriend (
  name varchar(20),
  friend varchar(20),
  year INTEGER,
  FOREIGN KEY (name) REFERENCES Person(name),
  FOREIGN KEY (friend) REFERENCES Person(name)
);

Question: Find the female friends of Alice.

assistant: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'
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 (
  id integer PRIMARY KEY,
  city_name text
);
CREATE TABLE games (
  id integer PRIMARY KEY,
  games_year integer,
  games_name text,
  season text
);
CREATE TABLE games_city (
  games_id integer,
  city_id integer
);
CREATE TABLE medal (
  id integer PRIMARY KEY,
  medal_name text
);
CREATE TABLE noc_region (
  id integer PRIMARY KEY,
  noc text,
  region_name text
);
CREATE TABLE person (
  id integer PRIMARY KEY,
  full_name text,
  gender text,
  height integer,
  weight integer
);
CREATE TABLE games_competitor (
  id integer PRIMARY KEY,
  games_id integer,
  person_id integer,
  age integer
);
CREATE TABLE person_region (
  person_id integer,
  region_id integer
);
CREATE TABLE sport (
  id integer PRIMARY KEY,
  sport_name text
);
CREATE TABLE event (
  id integer PRIMARY KEY,
  sport_id integer,
  event_name text
);
CREATE TABLE competitor_event (
  event_id integer,
  competitor_id integer,
  medal_id integer
);
-- foreign keys: games_city.games_id -> games.id; games_city.city_id -> city.id; games_competitor.person_id -> person.id; games_competitor.games_id -> games.id; person_region.region_id -> noc_region.id; person_region.person_id -> person.id; event.sport_id -> sport.id; competitor_event.medal_id -> medal.id; competitor_event.event_id -> event.id; competitor_event.competitor_id -> games_competitor.id

Hint: age is the most numerous refers to age where MAX(COUNT(person_id));

Question: What age of the competitors is the most numerous?

assistant: SELECT age FROM games_competitor GROUP BY age ORDER BY COUNT(person_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:
PRAGMA foreign_keys = ON;


CREATE TABLE "film" (
"Film_ID" int,
"Rank_in_series" int,
"Number_in_season" int,
"Title" text,
"Directed_by" text,
"Original_air_date" text,
"Production_code" text,
PRIMARY KEY ("Film_ID")
);

CREATE TABLE "cinema" (
"Cinema_ID" int,
"Name" text,
"Openning_year" int,
"Capacity" int,
"Location" text,
PRIMARY KEY ("Cinema_ID"));

Question: Show all directors.

assistant: SELECT DISTINCT directed_by FROM film
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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
);

Question: What are the types and countries of competitions?

assistant: SELECT Competition_type , Country FROM competition
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 offices (
  officeCode text PRIMARY KEY,
  city text,
  phone text,
  addressLine1 text,
  addressLine2 text,
  state text,
  country text,
  postalCode text,
  territory text
);
CREATE TABLE employees (
  employeeNumber integer PRIMARY KEY,
  lastName text,
  firstName text,
  extension text,
  email text,
  officeCode text,
  reportsTo integer,
  jobTitle text
);
CREATE TABLE customers (
  customerNumber integer PRIMARY KEY,
  customerName text,
  contactLastName text,
  contactFirstName text,
  phone text,
  addressLine1 text,
  addressLine2 text,
  city text,
  state text,
  postalCode text,
  country text,
  salesRepEmployeeNumber integer,
  creditLimit real
);
CREATE TABLE orders (
  orderNumber integer PRIMARY KEY,
  orderDate date,
  requiredDate date,
  shippedDate date,
  status text,
  comments text,
  customerNumber integer
);
CREATE TABLE payments (
  customerNumber integer PRIMARY KEY,
  checkNumber text PRIMARY KEY,
  paymentDate date,
  amount real
);
CREATE TABLE productlines (
  productLine text PRIMARY KEY,
  textDescription text,
  htmlDescription text,
  image blob
);
CREATE TABLE products (
  productCode text PRIMARY KEY,
  productName text,
  productLine text,
  productScale text,
  productVendor text,
  productDescription text,
  quantityInStock integer,
  buyPrice real,
  MSRP real
);
CREATE TABLE orderdetails (
  orderNumber integer PRIMARY KEY,
  productCode text PRIMARY KEY,
  quantityOrdered integer,
  priceEach real,
  orderLineNumber integer
);
-- foreign keys: employees.reportsTo -> employees.employeeNumber; employees.officeCode -> offices.officeCode; customers.salesRepEmployeeNumber -> employees.employeeNumber; orders.customerNumber -> customers.customerNumber; payments.customerNumber -> customers.customerNumber; products.productLine -> productlines.productLine

Hint: Boston is a city; amount of order = MULTIPLY(quantityOrdered, priceEach);

Question: What is the highest amount of order made by the sales representative in Boston? Please give the name of the product and amount.

assistant: SELECT T2.productName, T1.quantityOrdered * T1.priceEach FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T1.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T4.city = 'Boston' AND T4.salesRepEmployeeNumber IN ( SELECT employeeNumber FROM employees WHERE jobTitle = 'Sales Rep' ) ORDER BY T1.quantityOrdered 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 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 elements refers to OBJ_CLASS_ID; average = divide(count(OBJ_CLASS_ID), count(IMG_ID))

Question: How many object elements are there on average in each image?

assistant: SELECT CAST(COUNT(OBJ_CLASS_ID) AS REAL) / COUNT(DISTINCT IMG_ID) FROM IMG_OBJ
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: What are the codes of the locations with at least three documents?

assistant: SELECT location_code FROM Document_locations GROUP BY location_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 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: general description refers to primary_description; 'BATTERY' is the primary_description

Question: Please list the case numbers of all the incidents with the generic description of "BATTERY" in the IUCR classification.

assistant: SELECT T2.case_number FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.primary_description = 'BATTERY'
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 users (
  userid integer PRIMARY KEY,
  age text,
  u_gender text,
  occupation text
);
CREATE TABLE directors (
  directorid integer PRIMARY KEY,
  d_quality integer,
  avg_revenue integer
);
CREATE TABLE actors (
  actorid integer PRIMARY KEY,
  a_gender text,
  a_quality integer
);
CREATE TABLE movies (
  movieid integer PRIMARY KEY,
  year integer,
  isEnglish text,
  country text,
  runningtime integer
);
CREATE TABLE movies2actors (
  movieid integer PRIMARY KEY,
  actorid integer PRIMARY KEY,
  cast_num integer
);
CREATE TABLE movies2directors (
  movieid integer PRIMARY KEY,
  directorid integer PRIMARY KEY,
  genre text
);
CREATE TABLE u2base (
  userid integer PRIMARY KEY,
  movieid integer PRIMARY KEY,
  rating text
);

Hint: female actresses mean that a_gender = 'F'

Question: How many female actresses appeared in the movie 2312852, what country was it in, and what was it's running time?

assistant: SELECT SUM(IIF(T1.a_gender = 'F', 1, 0)) , T3.country, T3.runningtime FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T2.movieid = 2312852 GROUP BY T3.country, T3.runningtime