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 sales_in_weather (
  date date PRIMARY KEY,
  store_nbr integer PRIMARY KEY,
  item_nbr integer PRIMARY KEY,
  units integer
);
CREATE TABLE weather (
  station_nbr integer PRIMARY KEY,
  date date PRIMARY KEY,
  tmax integer,
  tmin integer,
  tavg integer,
  depart integer,
  dewpoint integer,
  wetbulb integer,
  heat integer,
  cool integer,
  sunrise text,
  sunset text,
  codesum text,
  snowfall real,
  preciptotal real,
  stnpressure real,
  sealevel real,
  resultspeed real,
  resultdir integer,
  avgspeed real
);
CREATE TABLE relation (
  store_nbr integer PRIMARY KEY,
  station_nbr integer
);
-- foreign keys: relation.station_nbr -> weather.station_nbr; relation.store_nbr -> sales_in_weather.store_nbr

Hint: maximum average speed refers to Max(avgspeed)

Question: What is the maximum average speed?

assistant: SELECT MAX(avgspeed) FROM weather
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 "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
);

CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
);

Question: Show the names and main services for train stations that have the top three total number of passengers.

assistant: SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMIT 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 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: grains/cereals category refers to CategoryName = 'Grains/Cereals'; supplier with one digit ID refers to SupplierID between 1 and 10;

Question: Among the products under grains/cereals category, provide the contact person and title of the supplier with one digit ID.

assistant: SELECT DISTINCT T1.ContactName, T1.ContactTitle FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Grains/Cereals' AND T1.SupplierID BETWEEN 1 AND 10 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: predicted relation class refers to PRED_CLASS; self-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID; image no.5 refers to IMG_ID = 5

Question: To which predicted relation class does the self-relation of the object sample in image no.5 belong?

assistant: SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 5 AND T2.OBJ1_SAMPLE_ID = T2.OBJ2_SAMPLE_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 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: Abington is school_city;

Question: Please list the titles of projects by which schools in Abington was donated.

assistant: SELECT T2.title FROM projects AS T1 INNER JOIN essays AS T2 ON T1.projectid = T2.projectid WHERE T1.school_city LIKE 'Abington'
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:
-- phpMyAdmin SQL Dump
-- version 4.0.10.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 20, 2015 at 01:43 AM
-- Server version: 5.5.34-cll-lve
-- PHP Version: 5.4.23



/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
CREATE TABLE IF NOT EXISTS `regions` (
  `REGION_ID` decimal(5,0) NOT NULL,
  `REGION_NAME` varchar(25) DEFAULT NULL,
  PRIMARY KEY (`REGION_ID`)
);

--
-- Dumping data for table `regions`
--

Question: Which employees were hired after September 7th, 1987?

assistant: SELECT * FROM employees WHERE hire_date > '1987-09-07'
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 Air Carriers (
  Code integer PRIMARY KEY,
  Description text
);
CREATE TABLE Airports (
  Code text PRIMARY KEY,
  Description text
);
CREATE TABLE Airlines (
  FL_DATE text,
  OP_CARRIER_AIRLINE_ID integer,
  TAIL_NUM text,
  OP_CARRIER_FL_NUM integer,
  ORIGIN_AIRPORT_ID integer,
  ORIGIN_AIRPORT_SEQ_ID integer,
  ORIGIN_CITY_MARKET_ID integer,
  ORIGIN text,
  DEST_AIRPORT_ID integer,
  DEST_AIRPORT_SEQ_ID integer,
  DEST_CITY_MARKET_ID integer,
  DEST text,
  CRS_DEP_TIME integer,
  DEP_TIME integer,
  DEP_DELAY integer,
  DEP_DELAY_NEW integer,
  ARR_TIME integer,
  ARR_DELAY integer,
  ARR_DELAY_NEW integer,
  CANCELLED integer,
  CANCELLATION_CODE text,
  CRS_ELAPSED_TIME integer,
  ACTUAL_ELAPSED_TIME integer,
  CARRIER_DELAY integer,
  WEATHER_DELAY integer,
  NAS_DELAY integer,
  SECURITY_DELAY integer,
  LATE_AIRCRAFT_DELAY integer
);
-- foreign keys: Airlines.OP_CARRIER_AIRLINE_ID -> Air Carriers.Code; Airlines.DEST -> Airports.Code; Airlines.ORIGIN -> Airports.Code

Hint: Southwest Airlines Co.: WN refers to Description = 'Southwest Airlines Co.: WN'; tail number refers to TAIL_NUM; actual elapsed time lower than the 80% of the average actual elapsed time refers to ACTUAL_ELAPSED_TIME < (MULTIPLY AVG(ACTUAL_ELAPSED_TIME), 0.8);

Question: Among the flights with air carrier "Southwest Airlines Co.: WN", provide the tail number of flights with an actual elapsed time lower than the 80% of the average actual elapsed time of listed flights.

assistant: SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southwest Airlines Co.: WN' AND T2.ACTUAL_ELAPSED_TIME < ( SELECT AVG(ACTUAL_ELAPSED_TIME) * 0.8 FROM Airlines )
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: 'Diane Collins' is a full name of a customer; full name refers to first_name, last_name

Question: Calculate the total payment amount by Diane Collins.

assistant: SELECT SUM(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Diane' AND T1.last_name = 'Collins'
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 Voting_record (
       StuID    	INTEGER,
       Registration_Date		VARCHAR(12),
       Election_Cycle		VARCHAR(12),
       President_Vote		INTEGER,
       Vice_President_Vote		INTEGER,
       Secretary_Vote		INTEGER,
       Treasurer_Vote		INTEGER,
       Class_President_Vote		INTEGER,
       Class_Senator_Vote		INTEGER,
       FOREIGN KEY(StuID) REFERENCES Student(StuID), 
       FOREIGN KEY(President_Vote) REFERENCES Student(StuID),
       FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),
       FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),
       FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),
       FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),
       FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)
);

Question: What are the distinct last names of the students who have president votes and have 8741 as the advisor?

assistant: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741"
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: "Good for Kids" attribute refers to attribute_name = 'Good for Kids' AND attribute_value = 'true'; Calculation = DIVIDE(SUM(attribute_name = 'Good for Kids' AND attribute_value = 'true')), SUM(business_id) * 100

Question: What is the percentage of businesses with "Good for Kids" attribute over the other attributes?

assistant: SELECT CAST(SUM(CASE WHEN attribute_name = 'Good for Kids' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value = 'true'
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: Joseph Fourier University refers to university_name = 'Joseph Fourier University'; University of Ottawa refers to university_name = 'University of Ottawa'; in 2013 refers to year = 2013; how many times more refers to DIVIDE(SUM(num_students where university_name = 'University of Ottawa'), SUM(num_students where university_name = 'Joseph Fourier University'))

Question: How many times more was the number of students of University of Ottawa than Joseph Fourier University in 2013?

assistant: SELECT CAST(SUM(CASE WHEN T2.university_name = 'University of Ottawa' THEN T1.num_students ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.university_name = 'Joseph Fourier University' THEN T1.num_students ELSE 0 END) FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2013
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 Video_Games (
       GameID           INTEGER PRIMARY KEY,
       GName            VARCHAR(40),
       GType            VARCHAR(40)
);

create table Plays_Games (
       StuID                INTEGER,
       GameID            INTEGER,
       Hours_Played      INTEGER,
       FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
       FOREIGN KEY(StuID) REFERENCES Student(StuID)
);

create table SportsInfo (
  StuID INTEGER,
  SportName VARCHAR(32),
  HoursPerWeek INTEGER,
  GamesPlayed INTEGER,
  OnScholarship VARCHAR(1),
  FOREIGN KEY(StuID) REFERENCES Student(StuID)
);

Question: What are the ids for all sporty students who are on scholarship?

assistant: SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
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: What is the mail date of the document with id 7?

assistant: SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7;