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:
PRAGMA foreign_keys = ON;

CREATE TABLE `Accounts` (
`account_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`account_name` VARCHAR(50),
`other_account_details` VARCHAR(255)
);
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_first_name` VARCHAR(20),
`customer_last_name` VARCHAR(20),
`customer_address` VARCHAR(255),
`customer_phone` VARCHAR(255),
`customer_email` VARCHAR(255),
`other_customer_details` VARCHAR(255)
);
CREATE TABLE `Customers_Cards` (
`card_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`card_type_code` VARCHAR(15) NOT NULL,
`card_number` VARCHAR(80),
`date_valid_from` DATETIME,
`date_valid_to` DATETIME,
`other_card_details` VARCHAR(255)
);
CREATE TABLE `Financial_Transactions` (
`transaction_id` INTEGER NOT NULL ,
`previous_transaction_id` INTEGER,
`account_id` INTEGER NOT NULL,
`card_id` INTEGER NOT NULL,
`transaction_type` VARCHAR(15) NOT NULL,
`transaction_date` DATETIME,
`transaction_amount` DOUBLE NULL,
`transaction_comment` VARCHAR(255),
`other_transaction_details` VARCHAR(255),
FOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),
FOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )
);

Question: What is the customer id of the customer with the most accounts, and how many accounts does this person have?

assistant: SELECT customer_id , count(*) FROM Accounts GROUP BY customer_id ORDER BY count(*) 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 Method (
  Id integer PRIMARY KEY,
  Name text,
  FullComment text,
  Summary text,
  ApiCalls text,
  CommentIsXml integer,
  SampledAt integer,
  SolutionId integer,
  Lang text,
  NameTokenized text
);
CREATE TABLE MethodParameter (
  Id integer PRIMARY KEY,
  MethodId text,
  Type text,
  Name text
);
CREATE TABLE Repo (
  Id integer PRIMARY KEY,
  Url text,
  Stars integer,
  Forks integer,
  Watchers integer,
  ProcessedTime integer
);
CREATE TABLE Solution (
  Id integer PRIMARY KEY,
  RepoId integer,
  Path text,
  ProcessedTime integer,
  WasCompiled integer
);

Hint: solution refers to Solution.Id; Solution.Id = 1;

Question: What is the url of solution 1?

assistant: SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Id = 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 Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);

Question: Show the names of products that are in at least two events.

assistant: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*) >= 2
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 `Problem_Category_Codes` (
`problem_category_code` VARCHAR(20) PRIMARY KEY,
`problem_category_description` VARCHAR(80)
);

Question: What are the three products that have the most problems?s

assistant: SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name ORDER BY count(*) 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:
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_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);

Question: Show all document type codes, document type names, document type descriptions.

assistant: SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
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

Hint: Rochester Ltd is the name of the customer; orders refer to OrderNumber;

Question: How many orders made by Rochester Ltd?

assistant: SELECT SUM(CASE WHEN T1.`Customer Names` = 'Rochester Ltd' THEN 1 ELSE 0 END) FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID
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 Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);

Question: Find id of the candidate who most recently accessed the course?

assistant: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_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:
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: professor refers to taughtBy.p_id; most courses refers to max(taughtBy.p_id); position refers to hasPosition

Question: Which professor taught the most courses and what is the position of this person in the university?

assistant: SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_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: company in Spain refers to Country = 'Spain'; product supplied refers to ProductName

Question: What were the products supplied by the company in Spain?

assistant: SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Spain'
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 Episode (
  episode_id text PRIMARY KEY,
  series text,
  season integer,
  episode integer,
  number_in_series integer,
  title text,
  summary text,
  air_date date,
  episode_image text,
  rating real,
  votes integer
);
CREATE TABLE Keyword (
  episode_id text PRIMARY KEY,
  keyword text PRIMARY KEY
);
CREATE TABLE Person (
  person_id text PRIMARY KEY,
  name text,
  birthdate date,
  birth_name text,
  birth_place text,
  birth_region text,
  birth_country text,
  height_meters real,
  nickname text
);
CREATE TABLE Award (
  award_id integer PRIMARY KEY,
  organization text,
  year integer,
  award_category text,
  award text,
  series text,
  episode_id text,
  person_id text,
  role text,
  result text
);
CREATE TABLE Credit (
  episode_id text PRIMARY KEY,
  person_id text PRIMARY KEY,
  category text,
  role text,
  credited text
);
CREATE TABLE Vote (
  episode_id text,
  stars integer,
  votes integer,
  percent real
);
-- foreign keys: Keyword.episode_id -> Episode.episode_id; Award.person_id -> Person.person_id; Award.episode_id -> Episode.episode_id; Credit.person_id -> Person.person_id; Credit.episode_id -> Episode.episode_id; Vote.episode_id -> Episode.episode_id

Hint: who refers to name; portraying "Alex Brown" refers to role = 'Alex Brown'; has been credited refers to credited = 'true'

Question: Who was the actor who was portraying "Alex Brown" and has been credited?

assistant: SELECT T1.name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id WHERE T2.role = 'Alex Brown' AND T2.credited = '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:
PRAGMA foreign_keys = ON;

CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);

Question: Find id of candidates whose assessment code is "Pass"?

assistant: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass"
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 "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
);
CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
);

Question: Which grade is studying in room 105?

assistant: SELECT DISTINCT grade FROM list WHERE classroom = 105
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

Hint: sales order 'SO - 0001004' refers to OrderNumber = 'SO - 0001004'; store location refers to City Name

Question: Identify the store location and sales team who processed the sales order 'SO - 0001004'.

assistant: SELECT T3.`Sales Team`, T1.`City Name` FROM `Store Locations` AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._StoreID = T1.StoreID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.OrderNumber = 'SO - 0001004'
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: professor refers to taughtBy.p_id; least amount of courses refers to min(count(course_id))

Question: Which professor taught the least amount of courses?

assistant: SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) ASC 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 Activity (
  actid INTEGER PRIMARY KEY,
  activity_name varchar(25)
);

create table Participates_in (
  stuid INTEGER,
  actid INTEGER,
  FOREIGN KEY(stuid) REFERENCES Student(StuID),
  FOREIGN KEY(actid) REFERENCES Activity(actid)
);

create table Faculty_Participates_in (
  FacID INTEGER,
  actid INTEGER,
  FOREIGN KEY(FacID) REFERENCES Faculty(FacID),
  FOREIGN KEY(actid) REFERENCES Activity(actid)
);

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 Faculty (
       FacID 	       INTEGER PRIMARY KEY,
       Lname		VARCHAR(15),
       Fname		VARCHAR(15),
       Rank		VARCHAR(15),
       Sex		VARCHAR(1),
       Phone		INTEGER,
       Room		VARCHAR(5),
       Building		VARCHAR(13)
);

Question: Show all the distinct buildings that have faculty rooms.

assistant: SELECT DISTINCT building FROM Faculty
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 characters (
  movie_title text PRIMARY KEY,
  release_date text,
  hero text,
  villian text,
  song text
);
CREATE TABLE director (
  name text PRIMARY KEY,
  director text
);
CREATE TABLE movies_total_gross (
  movie_title text PRIMARY KEY,
  release_date text PRIMARY KEY,
  genre text,
  MPAA_rating text,
  total_gross text,
  inflation_adjusted_gross text
);
CREATE TABLE revenue (
  Year integer PRIMARY KEY,
  Studio Entertainment[NI 1] real,
  Disney Consumer Products[NI 2] real,
  Disney Interactive[NI 3][Rev 1] integer,
  Walt Disney Parks and Resorts real,
  Disney Media Networks text,
  Total integer
);
CREATE TABLE voice-actors (
  character text PRIMARY KEY,
  voice-actor text,
  movie text
);
-- foreign keys: characters.hero -> voice-actors.character; director.name -> characters.movie_title; movies_total_gross.movie_title -> characters.movie_title; voice-actors.movie -> characters.movie_title

Hint: released between 1937 and 1950 refers to substr(release_date, length(release_date) - 1,length(release_date)) between '37' and '50';

Question: How many movies were released between 1937 and 1950?

assistant: SELECT COUNT(movie_title) FROM characters WHERE SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) BETWEEN '37' AND '50'
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 Restaurant (
       ResID       INTEGER PRIMARY KEY,
       ResName     VARCHAR(100),
       Address     VARCHAR(100),
       Rating INTEGER
);

create table Type_Of_Restaurant (
       ResID       INTEGER,
       ResTypeID   INTEGER,
       FOREIGN KEY(ResID) REFERENCES Restaurant(ResID),
       FOREIGN KEY(ResTypeID) REFERENCES Restaurant_Type(ResTypeID)
);

create table Restaurant_Type (
       ResTypeID            INTEGER PRIMARY KEY,
       ResTypeName          VARCHAR(40),
       ResTypeDescription   VARCHAR(100)
);

create table Visits_Restaurant (
       StuID      INTEGER,
       ResID      INTEGER,
       Time       TIMESTAMP,
       Spent      FLOAT,
       FOREIGN KEY(StuID) REFERENCES Student(StuID),
       FOREIGN KEY(ResID) REFERENCES Restaurant(ResID)
);

Question: Which city does student Linda Smith live in?

assistant: SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
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_Address_Types` (
`address_type_code` VARCHAR(15) PRIMARY KEY,
`address_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Detention_Type` (
`detention_type_code` VARCHAR(10) PRIMARY KEY,
`detention_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Incident_Type` (
`incident_type_code` VARCHAR(10) PRIMARY KEY,
`incident_type_description` VARCHAR(80)
);

Question: Return all distinct detention type codes.

assistant: SELECT DISTINCT detention_type_code FROM Detention
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: weather station 12 refers to station_nbr = 12; item 5 refers to item_nbr = 5; 10 store refers to store_nbr = 10; in 2014 refers to SUBSTR(date, 1, 4) = '2014'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100

Question: Between the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014?

assistant: SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE station_nbr = 12 AND item_nbr = 5 AND T2.`date` LIKE '%2014%'