[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: books over $13 refers to price > 13; percentage = Divide (Sum (order_id where price > 13), Count (order_id)) * 100

Question: Among the books ordered by Lucas Wyldbore, what is the percentage of those books over $13?

[Assistant] SELECT CAST(SUM(CASE WHEN T1.price > 13 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'


[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 Scientists (
  SSN int,
  Name Char(30) not null,
  Primary Key (SSN)
);

Create table Projects (
  Code Char(4),
  Name Char(50) not null,
  Hours int,
  Primary Key (Code)
);

create table AssignedTo (
  Scientist int not null,
  Project char(4) not null,
  Primary Key (Scientist, Project),
  Foreign Key (Scientist) references Scientists (SSN),
  Foreign Key (Project) references Projects (Code)
);

Question: Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it.

[Assistant] SELECT T2.name , T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT min(hours) FROM projects)


[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: appear in the right upper corner of the menu page refers to xpos > 0.75 and ypos < 0.25;

Question: How many dishes appear in the right upper corner of the menu page?

[Assistant] SELECT COUNT(*) FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T1.dish_id = T2.id WHERE T1.xpos > 0.75 AND T1.ypos < 0.25


[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: 'Exotic Liquids' is a CompanyName; units in stock over 100 refers to UnitsInStock > 100

Question: List all category name of Exotic Liquids 's product with units in stock over 100.

[Assistant] SELECT T3.CategoryName 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 T2.UnitsInStock > 100 AND T1.CompanyName = 'Exotic Liquids'


[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 bool (
  name text PRIMARY KEY
);
CREATE TABLE person (
  name text PRIMARY KEY
);
CREATE TABLE disabled (
  name text PRIMARY KEY
);
CREATE TABLE enlist (
  name text,
  organ text
);
CREATE TABLE filed_for_bankrupcy (
  name text PRIMARY KEY
);
CREATE TABLE longest_absense_from_school (
  name text PRIMARY KEY,
  month integer
);
CREATE TABLE male (
  name text PRIMARY KEY
);
CREATE TABLE no_payment_due (
  name text PRIMARY KEY,
  bool text
);
CREATE TABLE unemployed (
  name text PRIMARY KEY
);
CREATE TABLE enrolled (
  name text PRIMARY KEY,
  school text PRIMARY KEY,
  month integer
);
-- foreign keys: disabled.name -> person.name; enlist.name -> person.name; filed_for_bankrupcy.name -> person.name; longest_absense_from_school.name -> person.name; male.name -> person.name; no_payment_due.bool -> bool.name; no_payment_due.name -> person.name; unemployed.name -> person.name; enrolled.name -> person.name

Hint: employed students refers to disabled.name who are NOT in unemployed.name; zero absences refers to month = 0;

Question: How many employed disabled students have zero absences?

[Assistant] SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name INNER JOIN unemployed AS T3 ON T3.name = T2.name WHERE T1.month = 0


[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 authors (
  au_id text PRIMARY KEY,
  au_lname text,
  au_fname text,
  phone text,
  address text,
  city text,
  state text,
  zip text,
  contract text
);
CREATE TABLE jobs (
  job_id integer PRIMARY KEY,
  job_desc text,
  min_lvl integer,
  max_lvl integer
);
CREATE TABLE publishers (
  pub_id text PRIMARY KEY,
  pub_name text,
  city text,
  state text,
  country text
);
CREATE TABLE employee (
  emp_id text PRIMARY KEY,
  fname text,
  minit text,
  lname text,
  job_id integer,
  job_lvl integer,
  pub_id text,
  hire_date datetime
);
CREATE TABLE pub_info (
  pub_id text PRIMARY KEY,
  logo blob,
  pr_info text
);
CREATE TABLE stores (
  stor_id text PRIMARY KEY,
  stor_name text,
  stor_address text,
  city text,
  state text,
  zip text
);
CREATE TABLE discounts (
  discounttype text,
  stor_id text,
  lowqty integer,
  highqty integer,
  discount real
);
CREATE TABLE titles (
  title_id text PRIMARY KEY,
  title text,
  type text,
  pub_id text,
  price real,
  advance real,
  royalty integer,
  ytd_sales integer,
  notes text,
  pubdate datetime
);
CREATE TABLE roysched (
  title_id text,
  lorange integer,
  hirange integer,
  royalty integer
);
CREATE TABLE sales (
  stor_id text PRIMARY KEY,
  ord_num text PRIMARY KEY,
  ord_date datetime,
  qty integer,
  payterms text,
  title_id text PRIMARY KEY
);
CREATE TABLE titleauthor (
  au_id text PRIMARY KEY,
  title_id text PRIMARY KEY,
  au_ord integer,
  royaltyper integer
);
-- foreign keys: employee.pub_id -> publishers.pub_id; employee.job_id -> jobs.job_id; pub_info.pub_id -> publishers.pub_id; discounts.stor_id -> stores.stor_id; titles.pub_id -> publishers.pub_id; roysched.title_id -> titles.title_id; sales.title_id -> titles.title_id; sales.stor_id -> stores.stor_id; titleauthor.title_id -> titles.title_id; titleauthor.au_id -> authors.au_id

Hint: job level greater than 200 refers to job_lvl>200; job description refers to job_desc

Question: Among all employees, who have job level greater than 200. State the employee name and job description.

[Assistant] SELECT T1.fname, T1.lname, T2.job_desc FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl > 200


[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 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)
);

create table Department (
       DNO   		INTEGER PRIMARY KEY,
       Division		VARCHAR(2),
       DName		VARCHAR(25),
       Room		VARCHAR(5),
       Building		VARCHAR(13),
       DPhone		INTEGER
);

create table Member_of (
       FacID 	       INTEGER,
       DNO	       INTEGER,
       Appt_Type       VARCHAR(15),
       FOREIGN KEY(FacID) REFERENCES Faculty(FacID),
       FOREIGN KEY(DNO) REFERENCES Department(DNO)
);

create table Course (
       CID   	    	VARCHAR(7) PRIMARY KEY,
       CName		VARCHAR(40),
       Credits		INTEGER,
       Instructor	INTEGER,
       Days		VARCHAR(5),
       Hours		VARCHAR(11),
       DNO		INTEGER,
       FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),
       FOREIGN KEY(DNO) REFERENCES Department(DNO)
);

create table Minor_in (
       StuID 	      INTEGER,
       DNO		INTEGER,
       FOREIGN KEY(StuID) REFERENCES Student(StuID),
       FOREIGN KEY(DNO) REFERENCES Department(DNO)
);

create table Enrolled_in (
       StuID 		 INTEGER,
       CID		VARCHAR(7),
       Grade		VARCHAR(2),
       FOREIGN KEY(StuID) REFERENCES Student(StuID),
       FOREIGN KEY(CID) REFERENCES Course(CID),
       FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)
);

create table Gradeconversion (
       lettergrade	     VARCHAR(2) PRIMARY KEY,
       gradepoint	     FLOAT
);

Question: Which building does the instructor who teaches the most number of courses live in?

[Assistant] SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor 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 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: names of all territories refers to TerritoryDescription;

Question: Please list the names of all the territories whose sales are taken in charge by Nancy Davolio.

[Assistant] SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.FirstName = 'Nancy' AND T1.LastName = 'Davolio'


[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: "New Orleans Cajun Delights" is the CompanyName; discontinued refers to Discontinued = 1

Question: How many products have been discountinued by New Orleans Cajun Delights?

[Assistant] SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'New Orleans Cajun Delights'


[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: businesses with a high risk category refer to business_id where risk_category = 'High Risk';

Question: Among the businesses within the postal code 94117, what is total number of businesses with a high risk category?

[Assistant] SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.postal_code = 94117 AND T1.risk_category = 'High Risk'


[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 Customers (
Customer_ID INTEGER NOT NULL,
Customer_name VARCHAR(40),
PRIMARY KEY (Customer_ID)
);

Question: Count the total number of available services.

[Assistant] SELECT count(*) FROM services


[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:
--data definition

create table genre(
	g_name varchar2(20) not null,
	rating varchar2(10),
	most_popular_in varchar2(50),
	primary key(g_name)
);

create table artist(
	artist_name varchar2(50) not null,
	country varchar2(20),
	gender varchar2(20),
	preferred_genre varchar2(50),
	constraint a_name primary key(artist_name),
	foreign key(preferred_genre) references genre(g_name) ON DELETE CASCADE
);

create table files(
	f_id number(10) not null,
	artist_name varchar2(50),
	file_size varchar2(20),
	duration varchar2(20),
	formats varchar2(20),
	primary key(f_id),
	foreign key(artist_name) references artist(artist_name) ON DELETE CASCADE
);

create table song(
	song_name varchar2(50),
	artist_name varchar2(50),
	country varchar2(20),
	f_id number(10),
    	genre_is varchar2(20),
	rating number(10) check(rating>0 and rating<11),
	languages varchar2(20),
	releasedate Date,
	resolution number(10) not null,
	constraint s_name primary key(song_name),
	foreign key(artist_name) references artist(artist_name) ON DELETE CASCADE,
	foreign key(f_id) references files(f_id) ON DELETE CASCADE,
	foreign key(genre_is) references genre(g_name) ON DELETE CASCADE
);

--insertion of attributes in the table

Question: Find the id of the song that lasts the longest.

[Assistant] SELECT f_id FROM files ORDER BY duration 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 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: name of the movie refers to movie_title;

Question: Give the name of the movie which the song "I Thought I Lost You" is associated with.

[Assistant] SELECT movie_title FROM characters WHERE song = 'I Thought I Lost You'


[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: What is the average age for all people in the table?

[Assistant] SELECT avg(age) FROM Person


[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

Hint: most cited word refers to max(count(word_cited_id);

Question: What is the most cited word? How many papers was that word cited in?

[Assistant] SELECT word_cited_id, COUNT(paper_id) FROM content GROUP BY word_cited_id ORDER BY COUNT(word_cited_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 app_all (
  app_id integer PRIMARY KEY
);
CREATE TABLE app_events (
  event_id integer PRIMARY KEY,
  app_id integer PRIMARY KEY,
  is_installed integer,
  is_active integer
);
CREATE TABLE app_events_relevant (
  event_id integer PRIMARY KEY,
  app_id integer PRIMARY KEY,
  is_installed integer,
  is_active integer
);
CREATE TABLE app_labels (
  app_id integer,
  label_id integer
);
CREATE TABLE events (
  event_id integer PRIMARY KEY,
  device_id integer,
  timestamp datetime,
  longitude real,
  latitude real
);
CREATE TABLE events_relevant (
  event_id integer PRIMARY KEY,
  device_id integer,
  timestamp datetime,
  longitude real,
  latitude real
);
CREATE TABLE gender_age (
  device_id integer PRIMARY KEY,
  gender text,
  age integer,
  group text
);
CREATE TABLE gender_age_test (
  device_id integer PRIMARY KEY
);
CREATE TABLE gender_age_train (
  device_id integer PRIMARY KEY,
  gender text,
  age integer,
  group text
);
CREATE TABLE label_categories (
  label_id integer PRIMARY KEY,
  category text
);
CREATE TABLE phone_brand_device_model2 (
  device_id integer PRIMARY KEY,
  phone_brand text PRIMARY KEY,
  device_model text PRIMARY KEY
);
CREATE TABLE sample_submission (
  device_id integer PRIMARY KEY,
  F23- real,
  F24-26 real,
  F27-28 real,
  F29-32 real,
  F33-42 real,
  F43+ real,
  M22- real,
  M23-26 real,
  M27-28 real,
  M29-31 real,
  M32-38 real,
  M39+ real
);
-- foreign keys: app_events.event_id -> events.event_id; app_events_relevant.app_id -> app_all.app_id; app_events_relevant.event_id -> events_relevant.event_id; app_labels.app_id -> app_all.app_id; app_labels.label_id -> label_categories.label_id; events_relevant.device_id -> gender_age.device_id; gender_age.device_id -> phone_brand_device_model2.device_id

Hint: active refers to is_active = 1;

Question: How many active users are there in the event?

[Assistant] SELECT COUNT(app_id) FROM app_events WHERE is_active = 1


[System] You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

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

Hint: opened for 24/7 refers to Business_Hours WHERE opening_time = closing_time and business_id COUNT(day_id) = 7; business attribute refers to attribute_name

Question: Find out which business is opened for 24/7 and list out what is the business attribute.

[Assistant] SELECT T5.attribute_name FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id INNER JOIN Business_Attributes AS T4 ON T3.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T2.day_id LIKE '1' AND '2' AND '3' AND '4' AND '5' AND '6' AND '7' AND T1.opening_time = T1.closing_time GROUP BY T5.attribute_name


[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: How many students are attending English courses?

[Assistant] SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English"


[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 `Investors` (
`investor_id` INTEGER PRIMARY KEY,
`Investor_details` VARCHAR(255)
);

Question: What are the dates of transactions with at least 100 share count or amount bigger than 100?

[Assistant] SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count >= 100 OR amount_of_transaction >= 100


[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 "Rooms" (
	"RoomId" TEXT PRIMARY KEY,
	"roomName" TEXT,
	"beds" INTEGER,
	"bedType" TEXT,
	"maxOccupancy" INTEGER,
	"basePrice" INTEGER,
	"decor" TEXT

);

CREATE TABLE "Reservations" (
	"Code" INTEGER PRIMARY KEY,
	"Room" TEXT,
	"CheckIn" TEXT,
	"CheckOut" TEXT,
	"Rate" REAL,
	"LastName" TEXT,
	"FirstName" TEXT,
	"Adults" INTEGER,
	"Kids" INTEGER,
	FOREIGN KEY (Room) REFERENCES Rooms(RoomId)
);

Question: How many times does ROY SWEAZY has reserved a room.

[Assistant] SELECT count(*) FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY";


[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 actor (
  ActorID integer PRIMARY KEY,
  Name text,
  Date of Birth date,
  Birth City text,
  Birth Country text,
  Height (Inches) integer,
  Biography text,
  Gender text,
  Ethnicity text,
  NetWorth text
);
CREATE TABLE movie (
  MovieID integer PRIMARY KEY,
  Title text,
  MPAA Rating text,
  Budget integer,
  Gross integer,
  Release Date text,
  Genre text,
  Runtime integer,
  Rating real,
  Rating Count integer,
  Summary text
);
CREATE TABLE characters (
  MovieID integer PRIMARY KEY,
  ActorID integer PRIMARY KEY,
  Character Name text,
  creditOrder integer,
  pay text,
  screentime text
);
-- foreign keys: characters.MovieID -> movie.MovieID; characters.ActorID -> actor.ActorID

Hint: biggest budget refers to max(Budget); name of the movie refers to Title

Question: Which movie had the biggest budget? Give the name of the movie.

[Assistant] SELECT Title FROM movie ORDER BY Budget 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 torrents (
  groupName text,
  totalSnatched integer,
  artist text,
  groupYear integer,
  releaseType text,
  groupId integer,
  id integer PRIMARY KEY
);
CREATE TABLE tags (
  index integer PRIMARY KEY,
  id integer,
  tag text
);

Hint: tag = 'pop';

Question: How many releases by the artist michael jackson are tagged "pop"?

[Assistant] SELECT COUNT(T1.groupName) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'pop' AND T1.artist = 'michael jackson'


[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,
  Name text,
  CountryCode text,
  District text,
  Population integer
);
CREATE TABLE Country (
  Code text PRIMARY KEY,
  Name text,
  Continent text,
  Region text,
  SurfaceArea real,
  IndepYear integer,
  Population integer,
  LifeExpectancy real,
  GNP real,
  GNPOld real,
  LocalName text,
  GovernmentForm text,
  HeadOfState text,
  Capital integer,
  Code2 text
);
CREATE TABLE CountryLanguage (
  CountryCode text PRIMARY KEY,
  Language text PRIMARY KEY,
  IsOfficial text,
  Percentage real
);
-- foreign keys: City.CountryCode -> Country.Code; CountryLanguage.CountryCode -> Country.Code

Hint: independence year between 1980 to 1995 refers to IndepYear BETWEEN 1980 AND 1995;

Question: List down the languages of countries with an independence year between 1980 to 1995.

[Assistant] SELECT T2.Name, T1.Language FROM CountryLanguage AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code WHERE T2.IndepYear BETWEEN 1980 AND 1995


[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: average number of students refers to avg(num_students); in 2012 refers to year = 2012

Question: Calculate the average number of students of all universities in 2012.

[Assistant] SELECT AVG(num_students) FROM university_year WHERE year = 2012


[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: duration between 100 to 110 minutes refers to length between 100 and 110

Question: How many films have a duration between 100 to 110 minutes?

[Assistant] SELECT COUNT(film_id) FROM film WHERE length BETWEEN 100 AND 110


[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 lists (
  user_id integer,
  list_id integer PRIMARY KEY,
  list_title text,
  list_movie_number integer,
  list_update_timestamp_utc text,
  list_creation_timestamp_utc text,
  list_followers integer,
  list_url text,
  list_comments integer,
  list_description text,
  list_cover_image_url text,
  list_first_image_url text,
  list_second_image_url text,
  list_third_image_url text
);
CREATE TABLE movies (
  movie_id integer PRIMARY KEY,
  movie_title text,
  movie_release_year integer,
  movie_url text,
  movie_title_language text,
  movie_popularity integer,
  movie_image_url text,
  director_id text,
  director_name text,
  director_url text
);
CREATE TABLE ratings_users (
  user_id integer,
  rating_date_utc text,
  user_trialist integer,
  user_subscriber integer,
  user_avatar_image_url text,
  user_cover_image_url text,
  user_eligible_for_trial integer,
  user_has_payment_method integer
);
CREATE TABLE lists_users (
  user_id integer PRIMARY KEY,
  list_id integer PRIMARY KEY,
  list_update_date_utc text,
  list_creation_date_utc text,
  user_trialist integer,
  user_subscriber integer,
  user_avatar_image_url text,
  user_cover_image_url text,
  user_eligible_for_trial text,
  user_has_payment_method text
);
CREATE TABLE ratings (
  movie_id integer,
  rating_id integer,
  rating_url text,
  rating_score integer,
  rating_timestamp_utc text,
  critic text,
  critic_likes integer,
  critic_comments integer,
  user_id integer,
  user_trialist integer,
  user_subscriber integer,
  user_eligible_for_trial integer,
  user_has_payment_method integer
);
-- foreign keys: lists.user_id -> lists_users.user_id; ratings_users.user_id -> lists_users.user_id; lists_users.user_id -> lists.user_id; lists_users.list_id -> lists.list_id; ratings.user_id -> ratings_users.user_id; ratings.user_id -> lists_users.user_id; ratings.movie_id -> movies.movie_id

Hint: movie released in 2021 refers to movie_release_year = 2021; popularity refers to movie_popularity;

Question: What are the movie popularity of the movies released in 2021 that were directed by Steven Spielberg? List the names of the movies and their corresponding popularity.

[Assistant] SELECT movie_title, movie_popularity FROM movies WHERE movie_release_year = 2021 AND director_name = 'Steven Spielberg'


[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 "people" (
"People_ID" int,
"District" text,
"Name" text,
"Party" text,
"Age" int,
PRIMARY KEY ("People_ID")
);

CREATE TABLE "debate" (
"Debate_ID" int,
"Date" text,
"Venue" text,
"Num_of_Audience" int,
PRIMARY KEY ("Debate_ID")
);

Question: How many debates are there?

[Assistant] SELECT count(*) FROM debate


[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 Customers (
Customer_ID INTEGER NOT NULL,
Customer_Details VARCHAR(255) NOT NULL,
PRIMARY KEY (Customer_ID)
);

Question: Count the number of distinct claim outcome codes.

[Assistant] SELECT count(DISTINCT claim_outcome_code) FROM claims_processing


[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 (
  country_id integer PRIMARY KEY,
  country_iso_code text,
  country_name text
);
CREATE TABLE department (
  department_id integer PRIMARY KEY,
  department_name text
);
CREATE TABLE gender (
  gender_id integer PRIMARY KEY,
  gender text
);
CREATE TABLE genre (
  genre_id integer PRIMARY KEY,
  genre_name text
);
CREATE TABLE keyword (
  keyword_id integer PRIMARY KEY,
  keyword_name text
);
CREATE TABLE language (
  language_id integer PRIMARY KEY,
  language_code text,
  language_name text
);
CREATE TABLE language_role (
  role_id integer PRIMARY KEY,
  language_role text
);
CREATE TABLE movie (
  movie_id integer PRIMARY KEY,
  title text,
  budget integer,
  homepage text,
  overview text,
  popularity real,
  release_date date,
  revenue integer,
  runtime integer,
  movie_status text,
  tagline text,
  vote_average real,
  vote_count integer
);
CREATE TABLE movie_genres (
  movie_id integer,
  genre_id integer
);
CREATE TABLE movie_languages (
  movie_id integer,
  language_id integer,
  language_role_id integer
);
CREATE TABLE person (
  person_id integer PRIMARY KEY,
  person_name text
);
CREATE TABLE movie_crew (
  movie_id integer,
  person_id integer,
  department_id integer,
  job text
);
CREATE TABLE production_company (
  company_id integer PRIMARY KEY,
  company_name text
);
CREATE TABLE production_country (
  movie_id integer,
  country_id integer
);
CREATE TABLE movie_cast (
  movie_id integer,
  person_id integer,
  character_name text,
  gender_id integer,
  cast_order integer
);
CREATE TABLE movie_keywords (
  movie_id integer,
  keyword_id integer
);
CREATE TABLE movie_company (
  movie_id integer,
  company_id integer
);
-- foreign keys: movie_genres.movie_id -> movie.movie_id; movie_genres.genre_id -> genre.genre_id; movie_languages.language_role_id -> language_role.role_id; movie_languages.movie_id -> movie.movie_id; movie_languages.language_id -> language.language_id; movie_crew.person_id -> person.person_id; movie_crew.movie_id -> movie.movie_id; movie_crew.department_id -> department.department_id; production_country.movie_id -> movie.movie_id; production_country.country_id -> country.country_id; movie_cast.person_id -> person.person_id; movie_cast.movie_id -> movie.movie_id; movie_cast.gender_id -> gender.gender_id

Hint: Warner Bros. Pictures' movies refers to company_name = 'Warner Bros. Pictures'; highest revenue refers to max(revenue)

Question: Among Warner Bros. Pictures' movies, which title made the highest revenue?

[Assistant] SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Warner Bros. Pictures' ORDER BY T3.revenue 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 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: customer phone refers to c_phone; Customer#000000001 refers to c_name;

Question: What is the phone number of Customer#000000001?

[Assistant] SELECT c_phone FROM customer WHERE c_name = 'Customer#000000001'


[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=OFF;
BEGIN TRANSACTION;
CREATE TABLE station (
    id INTEGER PRIMARY KEY,
    name TEXT,
    lat NUMERIC,
    long NUMERIC,
    dock_count INTEGER,
    city TEXT,
    installation_date TEXT);

Question: Find the ids and names of stations from which at least 200 trips started.

[Assistant] SELECT start_station_id , start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200


[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: DIVIDE(COUNT(OBJ_SAMPLE_ID where OBJ_CLASS = 'street lights'), COUNT(OBJ_SAMPLE_ID)) as percentage;

Question: Calculate the percentage of object samples that are related to street lights.

[Assistant] SELECT CAST(SUM(CASE WHEN T2.OBJ_CLASS = 'street lights' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OBJ_SAMPLE_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_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 "publication" (
"Publication_ID" int,
"Book_ID" int,
"Publisher" text,
"Publication_Date" text,
"Price" real,
PRIMARY KEY ("Publication_ID"),
FOREIGN KEY ("Book_ID") REFERENCES "book"("Book_ID")
);

CREATE TABLE "book" (
"Book_ID" int,
"Title" text,
"Issues" real,
"Writer" text,
PRIMARY KEY ("Book_ID")
);

Question: Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000.

[Assistant] SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000


[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 the locations where no cinema has capacity over 800.

[Assistant] SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800


[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 station (
  id integer PRIMARY KEY,
  name text,
  lat real,
  long real,
  dock_count integer,
  city text,
  installation_date text
);
CREATE TABLE status (
  station_id integer,
  bikes_available integer,
  docks_available integer,
  time text
);
CREATE TABLE trip (
  id integer PRIMARY KEY,
  duration integer,
  start_date text,
  start_station_name text,
  start_station_id integer,
  end_date text,
  end_station_name text,
  end_station_id integer,
  bike_id integer,
  subscription_type text,
  zip_code integer
);
CREATE TABLE weather (
  date text,
  max_temperature_f integer,
  mean_temperature_f integer,
  min_temperature_f integer,
  max_dew_point_f integer,
  mean_dew_point_f integer,
  min_dew_point_f integer,
  max_humidity integer,
  mean_humidity integer,
  min_humidity integer,
  max_sea_level_pressure_inches real,
  mean_sea_level_pressure_inches real,
  min_sea_level_pressure_inches real,
  max_visibility_miles integer,
  mean_visibility_miles integer,
  min_visibility_miles integer,
  max_wind_Speed_mph integer,
  mean_wind_speed_mph integer,
  max_gust_speed_mph integer,
  precipitation_inches text,
  cloud_cover integer,
  events text,
  wind_dir_degrees integer,
  zip_code text
);

Hint: 37.331415 and -121.8932 are latitude (lat) and longitude (long) coordinates indicating location; returned at refers to end_station_name; the date the bike was borrowed refers to start_date;

Question: List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed.

[Assistant] SELECT T2.end_station_name, T2.start_date FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T1.lat = 37.331415 AND T1.long = -121.8932


[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: What is minimum age for different job title?

[Assistant] SELECT min(age) , job FROM Person GROUP BY job


[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 PRIMARY KEY,
`address_content` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50),
`other_address_details` VARCHAR(255)
);

Question: What are the cities no customers live in?

[Assistant] SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_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 `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
);

Question: Sort the information about course authors and tutors in alphabetical order of the personal name.

[Assistant] SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name


[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: "Klett & Sons Repair" is the cust_name

Question: What is the annual revenue of Klett & Sons Repair?

[Assistant] SELECT annual_revenue FROM customer WHERE cust_name = 'Klett & Sons Repair'


[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 genre (
  id integer PRIMARY KEY,
  genre_name text
);
CREATE TABLE game (
  id integer PRIMARY KEY,
  genre_id integer,
  game_name text
);
CREATE TABLE platform (
  id integer PRIMARY KEY,
  platform_name text
);
CREATE TABLE publisher (
  id integer PRIMARY KEY,
  publisher_name text
);
CREATE TABLE game_publisher (
  id integer PRIMARY KEY,
  game_id integer,
  publisher_id integer
);
CREATE TABLE game_platform (
  id integer PRIMARY KEY,
  game_publisher_id integer,
  platform_id integer,
  release_year integer
);
CREATE TABLE region (
  id integer PRIMARY KEY,
  region_name text
);
CREATE TABLE region_sales (
  region_id integer,
  game_platform_id integer,
  num_sales real
);
-- foreign keys: game.genre_id -> genre.id; game_publisher.publisher_id -> publisher.id; game_publisher.game_id -> game.id; game_platform.platform_id -> platform.id; game_platform.game_publisher_id -> game_publisher.id; region_sales.region_id -> region.id; region_sales.game_platform_id -> game_platform.id

Hint: name of games refers to game_name;  'SCD' platform refers to platform_name = 'SCD';

Question: Indicate the name of all the games published for the 'SCD' platform.

[Assistant] SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T4.platform_name = 'SCD'


[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 bool (
  name text PRIMARY KEY
);
CREATE TABLE person (
  name text PRIMARY KEY
);
CREATE TABLE disabled (
  name text PRIMARY KEY
);
CREATE TABLE enlist (
  name text,
  organ text
);
CREATE TABLE filed_for_bankrupcy (
  name text PRIMARY KEY
);
CREATE TABLE longest_absense_from_school (
  name text PRIMARY KEY,
  month integer
);
CREATE TABLE male (
  name text PRIMARY KEY
);
CREATE TABLE no_payment_due (
  name text PRIMARY KEY,
  bool text
);
CREATE TABLE unemployed (
  name text PRIMARY KEY
);
CREATE TABLE enrolled (
  name text PRIMARY KEY,
  school text PRIMARY KEY,
  month integer
);
-- foreign keys: disabled.name -> person.name; enlist.name -> person.name; filed_for_bankrupcy.name -> person.name; longest_absense_from_school.name -> person.name; male.name -> person.name; no_payment_due.bool -> bool.name; no_payment_due.name -> person.name; unemployed.name -> person.name; enrolled.name -> person.name

Hint: no due payments refers to bool = 'neg'; not males refers to not in male table

Question: List 10 students that have no due payments and are not males.

[Assistant] SELECT T1.name FROM no_payment_due AS T1 INNER JOIN person AS T2 ON T1.`name` = T2.`name` WHERE T2.`name` NOT IN ( SELECT name FROM male ) AND T1.bool = 'neg'


[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: predicate class of image ID 68 refers to PRED_CLASS where IMG_ID = 68;

Question: What is the predicate class of image ID 68?

[Assistant] SELECT T2.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 68


[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 app_all (
  app_id integer PRIMARY KEY
);
CREATE TABLE app_events (
  event_id integer PRIMARY KEY,
  app_id integer PRIMARY KEY,
  is_installed integer,
  is_active integer
);
CREATE TABLE app_events_relevant (
  event_id integer PRIMARY KEY,
  app_id integer PRIMARY KEY,
  is_installed integer,
  is_active integer
);
CREATE TABLE app_labels (
  app_id integer,
  label_id integer
);
CREATE TABLE events (
  event_id integer PRIMARY KEY,
  device_id integer,
  timestamp datetime,
  longitude real,
  latitude real
);
CREATE TABLE events_relevant (
  event_id integer PRIMARY KEY,
  device_id integer,
  timestamp datetime,
  longitude real,
  latitude real
);
CREATE TABLE gender_age (
  device_id integer PRIMARY KEY,
  gender text,
  age integer,
  group text
);
CREATE TABLE gender_age_test (
  device_id integer PRIMARY KEY
);
CREATE TABLE gender_age_train (
  device_id integer PRIMARY KEY,
  gender text,
  age integer,
  group text
);
CREATE TABLE label_categories (
  label_id integer PRIMARY KEY,
  category text
);
CREATE TABLE phone_brand_device_model2 (
  device_id integer PRIMARY KEY,
  phone_brand text PRIMARY KEY,
  device_model text PRIMARY KEY
);
CREATE TABLE sample_submission (
  device_id integer PRIMARY KEY,
  F23- real,
  F24-26 real,
  F27-28 real,
  F29-32 real,
  F33-42 real,
  F43+ real,
  M22- real,
  M23-26 real,
  M27-28 real,
  M29-31 real,
  M32-38 real,
  M39+ real
);
-- foreign keys: app_events.event_id -> events.event_id; app_events_relevant.app_id -> app_all.app_id; app_events_relevant.event_id -> events_relevant.event_id; app_labels.app_id -> app_all.app_id; app_labels.label_id -> label_categories.label_id; events_relevant.device_id -> gender_age.device_id; gender_age.device_id -> phone_brand_device_model2.device_id

Hint: brand of phone refers to phone_brand; most applications are installed refers to MAX(COUNT(is_installed = 1));

Question: On which brand of phone are the most applications installed?

[Assistant] SELECT T.phone_brand FROM ( SELECT T1.phone_brand, COUNT(T4.is_active) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id INNER JOIN events_relevant AS T3 ON T2.device_id = T3.device_id INNER JOIN app_events_relevant AS T4 ON T3.event_id = T4.event_id WHERE T4.is_active = 1 GROUP BY T1.phone_brand ) AS T ORDER BY T.num 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 Author (
  Id integer PRIMARY KEY,
  Name text,
  Affiliation text
);
CREATE TABLE Conference (
  Id integer PRIMARY KEY,
  ShortName text,
  FullName text,
  HomePage text
);
CREATE TABLE Journal (
  Id integer PRIMARY KEY,
  ShortName text,
  FullName text,
  HomePage text
);
CREATE TABLE Paper (
  Id integer PRIMARY KEY,
  Title text,
  Year integer,
  ConferenceId integer,
  JournalId integer,
  Keyword text
);
CREATE TABLE PaperAuthor (
  PaperId integer,
  AuthorId integer,
  Name text,
  Affiliation text
);
-- foreign keys: Paper.JournalId -> Journal.Id; Paper.ConferenceId -> Conference.Id; PaperAuthor.AuthorId -> Author.Id; PaperAuthor.PaperId -> Paper.Id

Hint: "University of Oulu" is the Affiliation Organization

Question: Write down the author's name and IDs who are affiliated with Univeristiy of Oulu.

[Assistant] SELECT Name, id FROM Author WHERE Affiliation = 'University of Oulu'


[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 `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_first_name` VARCHAR(50),
`customer_middle_initial` VARCHAR(1),
`customer_last_name` VARCHAR(50),
`gender` VARCHAR(1),
`email_address` VARCHAR(255),
`login_name` VARCHAR(80),
`login_password` VARCHAR(20),
`phone_number` VARCHAR(255),
`town_city` VARCHAR(50),
`state_county_province` VARCHAR(50),
`country` VARCHAR(50)
);

Question: Show first name and id for all customers with at least 2 accounts.

[Assistant] SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id 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:
/*
 * SQL scripts for CS61 Intro to SQL lectures
 * FILENAME SOCCER2.SQL
 */

DROP TABLE  IF EXISTS Player;
DROP TABLE  IF EXISTS Tryout;
DROP TABLE  IF EXISTS College;

CREATE TABLE 	College
  ( cName   	varchar(20) NOT NULL,
    state   	varchar(2),
    enr     	numeric(5,0),
    PRIMARY KEY (cName)
  );

CREATE TABLE 	Player
  ( pID			numeric(5,0) NOT NULL,
  	pName   	varchar(20),
    yCard   	varchar(3),
    HS      	numeric(5,0),
    PRIMARY KEY (pID)
  );

CREATE TABLE 	Tryout
  ( pID			numeric(5,0),
  	cName   	varchar(20),
    pPos    	varchar(8),
    decision    varchar(3),
    PRIMARY KEY (pID, cName),
    FOREIGN KEY (pID) REFERENCES Player(pID),
    FOREIGN KEY (cName) REFERENCES College(cName)
  );

/* note that "left" and "right" are reserved words in SQL */

Question: Find the name of players whose card is yes in the descending order of training hours.

[Assistant] SELECT pName FROM Player WHERE yCard = 'yes' ORDER BY HS DESC


[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 `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_first_name` VARCHAR(50),
`customer_middle_initial` VARCHAR(1),
`customer_last_name` VARCHAR(50),
`gender` VARCHAR(1),
`email_address` VARCHAR(255),
`login_name` VARCHAR(80),
`login_password` VARCHAR(20),
`phone_number` VARCHAR(255),
`town_city` VARCHAR(50),
`state_county_province` VARCHAR(50),
`country` VARCHAR(50)
);

Question: Show the transaction types and the total amount of transactions.

[Assistant] SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type


[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:
-- dbext:type=SQLITE:dbname=movie_rating.db

/* Delete the tables if they already exist */
drop table if exists Movie;
drop table if exists Reviewer;
drop table if exists Rating;

/* Create the schema for our tables */
create table Movie(
	mID int primary key,
	title text,
	year int,
	director text
);
create table Reviewer(
	rID int primary key,
	name text);

create table Rating(
	rID int,
	mID int,
	stars int,
	ratingDate date,
	FOREIGN KEY (mID) references Movie(mID),
	FOREIGN KEY (rID) references Reviewer(rID)
);

/* Populate the tables with our data */

Question: What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies?

[Assistant] SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5


[System] You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

[User]
Schema:
PRAGMA foreign_keys = ON;

CREATE TABLE "country" (
    "Country_id" int,
    "Country_name" text,
    "Capital" text,
    "Official_native_language" text,
    PRIMARY KEY ("Country_id")
);

CREATE TABLE `team` (
      `Team_id` int,
      `Name` text,
      PRIMARY KEY (`Team_id`)
) ;

Question: Return the official native languages of countries who have players from Maryland or Duke colleges.

[Assistant] SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = "Maryland" OR T2.College = "Duke"


[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: attributes of polka dot refer to ATT_CLASS = 'polka dot'; images refer to IMG_ID;

Question: How many images have objects with the attributes of polka dot?

[Assistant] SELECT COUNT(T2.OBJ_SAMPLE_ID) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.ATT_CLASS = 'polka dot'


[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 lists (
  user_id integer,
  list_id integer PRIMARY KEY,
  list_title text,
  list_movie_number integer,
  list_update_timestamp_utc text,
  list_creation_timestamp_utc text,
  list_followers integer,
  list_url text,
  list_comments integer,
  list_description text,
  list_cover_image_url text,
  list_first_image_url text,
  list_second_image_url text,
  list_third_image_url text
);
CREATE TABLE movies (
  movie_id integer PRIMARY KEY,
  movie_title text,
  movie_release_year integer,
  movie_url text,
  movie_title_language text,
  movie_popularity integer,
  movie_image_url text,
  director_id text,
  director_name text,
  director_url text
);
CREATE TABLE ratings_users (
  user_id integer,
  rating_date_utc text,
  user_trialist integer,
  user_subscriber integer,
  user_avatar_image_url text,
  user_cover_image_url text,
  user_eligible_for_trial integer,
  user_has_payment_method integer
);
CREATE TABLE lists_users (
  user_id integer PRIMARY KEY,
  list_id integer PRIMARY KEY,
  list_update_date_utc text,
  list_creation_date_utc text,
  user_trialist integer,
  user_subscriber integer,
  user_avatar_image_url text,
  user_cover_image_url text,
  user_eligible_for_trial text,
  user_has_payment_method text
);
CREATE TABLE ratings (
  movie_id integer,
  rating_id integer,
  rating_url text,
  rating_score integer,
  rating_timestamp_utc text,
  critic text,
  critic_likes integer,
  critic_comments integer,
  user_id integer,
  user_trialist integer,
  user_subscriber integer,
  user_eligible_for_trial integer,
  user_has_payment_method integer
);
-- foreign keys: lists.user_id -> lists_users.user_id; ratings_users.user_id -> lists_users.user_id; lists_users.user_id -> lists.user_id; lists_users.list_id -> lists.list_id; ratings.user_id -> ratings_users.user_id; ratings.user_id -> lists_users.user_id; ratings.movie_id -> movies.movie_id

Hint: head portrait refers to user_avatar_image_url; "5" ratings refers to rating_score = 5

Question: Show the head portrait of the user who gave the most "5" ratings.

[Assistant] SELECT T2.user_avatar_image_url FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id WHERE T1.rating_score = 5


[System] You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

[User]
Schema:
CREATE TABLE 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: arrest refers to arrest = 'TRUE'; in 2018 refers to date LIKE '%2018%'; in an animal hospital refers to location_description = 'ANIMAL HOSPITAL'; FBI code 08B refers to fbi_code_no = '08B'

Question: How many arrests were made in 2018 in an animal hospital under FBI code 08B?

[Assistant] SELECT SUM(CASE WHEN arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND location_description = 'ANIMAL HOSPITAL' AND fbi_code_no = '08B'


[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: people refers to taughtBy.p_id; course no.11 refers to course_id = 11

Question: How many people teaches course no.11?

[Assistant] SELECT COUNT(*) FROM taughtBy WHERE course_id = 11


[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 `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`gender` VARCHAR(1),
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`email_address` VARCHAR(255),
`phone_number` VARCHAR(80)
);

Question: Find the emails and phone numbers of all the customers, ordered by email address and phone number.

[Assistant] SELECT email_address , phone_number FROM customers ORDER BY email_address , phone_number


[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 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)
);

create table Department (
       DNO   		INTEGER PRIMARY KEY,
       Division		VARCHAR(2),
       DName		VARCHAR(25),
       Room		VARCHAR(5),
       Building		VARCHAR(13),
       DPhone		INTEGER
);

create table Member_of (
       FacID 	       INTEGER,
       DNO	       INTEGER,
       Appt_Type       VARCHAR(15),
       FOREIGN KEY(FacID) REFERENCES Faculty(FacID),
       FOREIGN KEY(DNO) REFERENCES Department(DNO)
);

create table Course (
       CID   	    	VARCHAR(7) PRIMARY KEY,
       CName		VARCHAR(40),
       Credits		INTEGER,
       Instructor	INTEGER,
       Days		VARCHAR(5),
       Hours		VARCHAR(11),
       DNO		INTEGER,
       FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),
       FOREIGN KEY(DNO) REFERENCES Department(DNO)
);

create table Minor_in (
       StuID 	      INTEGER,
       DNO		INTEGER,
       FOREIGN KEY(StuID) REFERENCES Student(StuID),
       FOREIGN KEY(DNO) REFERENCES Department(DNO)
);

create table Enrolled_in (
       StuID 		 INTEGER,
       CID		VARCHAR(7),
       Grade		VARCHAR(2),
       FOREIGN KEY(StuID) REFERENCES Student(StuID),
       FOREIGN KEY(CID) REFERENCES Course(CID),
       FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)
);

create table Gradeconversion (
       lettergrade	     VARCHAR(2) PRIMARY KEY,
       gradepoint	     FLOAT
);

Question: What are the course names, ordered by credits?

[Assistant] SELECT CName FROM COURSE ORDER BY Credits


[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: List all statement ids and statement details.

[Assistant] SELECT STATEMENT_ID , statement_details FROM Statements


[System] You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

[User]
Schema:
PRAGMA foreign_keys = ON;

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

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

Question: Return the average and minimum age of captains in each class.

[Assistant] SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS


[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 CBSA (
  CBSA integer PRIMARY KEY,
  CBSA_name text,
  CBSA_type text
);
CREATE TABLE state (
  abbreviation text PRIMARY KEY,
  name text
);
CREATE TABLE congress (
  cognress_rep_id text PRIMARY KEY,
  first_name text,
  last_name text,
  CID text,
  party text,
  state text,
  abbreviation text,
  House text,
  District integer,
  land_area real
);
CREATE TABLE zip_data (
  zip_code integer PRIMARY KEY,
  city text,
  state text,
  multi_county text,
  type text,
  organization text,
  time_zone text,
  daylight_savings text,
  latitude real,
  longitude real,
  elevation integer,
  state_fips integer,
  county_fips integer,
  region text,
  division text,
  population_2020 integer,
  population_2010 integer,
  households integer,
  avg_house_value integer,
  avg_income_per_household integer,
  persons_per_household real,
  white_population integer,
  black_population integer,
  hispanic_population integer,
  asian_population integer,
  american_indian_population integer,
  hawaiian_population integer,
  other_population integer,
  male_population integer,
  female_population integer,
  median_age real,
  male_median_age real,
  female_median_age real,
  residential_mailboxes integer,
  business_mailboxes integer,
  total_delivery_receptacles integer,
  businesses integer,
  1st_quarter_payroll integer,
  annual_payroll integer,
  employees integer,
  water_area real,
  land_area real,
  single_family_delivery_units integer,
  multi_family_delivery_units integer,
  total_beneficiaries integer,
  retired_workers integer,
  disabled_workers integer,
  parents_and_widowed integer,
  spouses integer,
  children integer,
  over_65 integer,
  monthly_benefits_all integer,
  monthly_benefits_retired_workers integer,
  monthly_benefits_widowed integer,
  CBSA integer
);
CREATE TABLE alias (
  zip_code integer PRIMARY KEY,
  alias text
);
CREATE TABLE area_code (
  zip_code integer PRIMARY KEY,
  area_code integer PRIMARY KEY
);
CREATE TABLE avoid (
  zip_code integer PRIMARY KEY,
  bad_alias text PRIMARY KEY
);
CREATE TABLE country (
  zip_code integer PRIMARY KEY,
  county text PRIMARY KEY,
  state text
);
CREATE TABLE zip_congress (
  zip_code integer PRIMARY KEY,
  district text PRIMARY KEY
);
-- foreign keys: congress.abbreviation -> state.abbreviation; zip_data.CBSA -> CBSA.CBSA; zip_data.state -> state.abbreviation; alias.zip_code -> zip_data.zip_code; area_code.zip_code -> zip_data.zip_code; avoid.zip_code -> zip_data.zip_code; country.state -> state.abbreviation; country.zip_code -> zip_data.zip_code; zip_congress.zip_code -> zip_data.zip_code; zip_congress.district -> congress.cognress_rep_id

Hint: micro CBSA refers to CBSA_type = 'Micro';

Question: List all the cities with micro CBSA.

[Assistant] SELECT T2.city FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_type = 'Micro'


[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: ranking system called Shanghai Ranking refers to system_name = 'Shanghai Ranking';

Question: What is the total number of ranking criteria under the ranking system called Shanghai Ranking?

[Assistant] SELECT COUNT(*) FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T1.system_name = 'Shanghai Ranking'


[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 lists (
  user_id integer,
  list_id integer PRIMARY KEY,
  list_title text,
  list_movie_number integer,
  list_update_timestamp_utc text,
  list_creation_timestamp_utc text,
  list_followers integer,
  list_url text,
  list_comments integer,
  list_description text,
  list_cover_image_url text,
  list_first_image_url text,
  list_second_image_url text,
  list_third_image_url text
);
CREATE TABLE movies (
  movie_id integer PRIMARY KEY,
  movie_title text,
  movie_release_year integer,
  movie_url text,
  movie_title_language text,
  movie_popularity integer,
  movie_image_url text,
  director_id text,
  director_name text,
  director_url text
);
CREATE TABLE ratings_users (
  user_id integer,
  rating_date_utc text,
  user_trialist integer,
  user_subscriber integer,
  user_avatar_image_url text,
  user_cover_image_url text,
  user_eligible_for_trial integer,
  user_has_payment_method integer
);
CREATE TABLE lists_users (
  user_id integer PRIMARY KEY,
  list_id integer PRIMARY KEY,
  list_update_date_utc text,
  list_creation_date_utc text,
  user_trialist integer,
  user_subscriber integer,
  user_avatar_image_url text,
  user_cover_image_url text,
  user_eligible_for_trial text,
  user_has_payment_method text
);
CREATE TABLE ratings (
  movie_id integer,
  rating_id integer,
  rating_url text,
  rating_score integer,
  rating_timestamp_utc text,
  critic text,
  critic_likes integer,
  critic_comments integer,
  user_id integer,
  user_trialist integer,
  user_subscriber integer,
  user_eligible_for_trial integer,
  user_has_payment_method integer
);
-- foreign keys: lists.user_id -> lists_users.user_id; ratings_users.user_id -> lists_users.user_id; lists_users.user_id -> lists.user_id; lists_users.list_id -> lists.list_id; ratings.user_id -> ratings_users.user_id; ratings.user_id -> lists_users.user_id; ratings.movie_id -> movies.movie_id

Hint: 5 ratings refers to rating_score = 5; name of the movie refers to movie_title

Question: Give the name of the movie that got the most "5" ratings.

[Assistant] SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 5


[System] You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

[User]
Schema:
PRAGMA foreign_keys = ON;

CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);

Question: List the names of buildings that have no company office.

[Assistant] SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations)


[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:
-- LINK: https://en.wikibooks.org/wiki/SQL_Exercises/The_computer_store

CREATE TABLE Manufacturers (
  Code INTEGER,
  Name VARCHAR(255) NOT NULL,
  Headquarter VARCHAR(255) NOT NULL,
  Founder VARCHAR(255) NOT NULL,
  Revenue REAL,
  PRIMARY KEY (Code)
);

CREATE TABLE Products (
  Code INTEGER,
  Name VARCHAR(255) NOT NULL ,
  Price DECIMAL NOT NULL ,
  Manufacturer INTEGER NOT NULL,
  PRIMARY KEY (Code),
  FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)
);

Question: Find all information of all the products with a price between $60 and $120.

[Assistant] SELECT * FROM products WHERE price BETWEEN 60 AND 120


[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 height_info (
  height_id integer PRIMARY KEY,
  height_in_cm integer,
  height_in_inch text
);
CREATE TABLE weight_info (
  weight_id integer PRIMARY KEY,
  weight_in_kg integer,
  weight_in_lbs integer
);
CREATE TABLE PlayerInfo (
  ELITEID integer PRIMARY KEY,
  PlayerName text,
  birthdate text,
  birthyear date,
  birthmonth integer,
  birthday integer,
  birthplace text,
  nation text,
  height integer,
  weight integer,
  position_info text,
  shoots text,
  draftyear integer,
  draftround integer,
  overall integer,
  overallby text,
  CSS_rank integer,
  sum_7yr_GP integer,
  sum_7yr_TOI integer,
  GP_greater_than_0 text
);
CREATE TABLE SeasonStatus (
  ELITEID integer,
  SEASON text,
  TEAM text,
  LEAGUE text,
  GAMETYPE text,
  GP integer,
  G integer,
  A integer,
  P integer,
  PIM integer,
  PLUSMINUS integer
);
-- foreign keys: PlayerInfo.weight -> weight_info.weight_id; PlayerInfo.height -> height_info.height_id; SeasonStatus.ELITEID -> PlayerInfo.ELITEID

Hint: players refers to PlayerName; 1997-1998 season refers to SEASON = '1997-1998';

Question: List out the nation of players who played for the 1997-1998 season .

[Assistant] SELECT DISTINCT T2.nation FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1997-1998'


[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 "people" (
"People_ID" int,
"Name" text,
"Country" text,
"Is_Male" text,
"Age" int,
PRIMARY KEY ("People_ID")
);

Question: Show the church names for the weddings of all people older than 30.

[Assistant] SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30


[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

Question: Please list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.

[Assistant] SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7


[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 of all students who are not video game players?

[Assistant] SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games


[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: country refers to n_name; the least number of suppliers refers to min(count(s_name))

Question: Which country has the least number of suppliers?

[Assistant] SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey GROUP BY T1.s_nationkey ORDER BY COUNT(T1.s_name) 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 City (
  ID integer PRIMARY KEY,
  Name text,
  CountryCode text,
  District text,
  Population integer
);
CREATE TABLE Country (
  Code text PRIMARY KEY,
  Name text,
  Continent text,
  Region text,
  SurfaceArea real,
  IndepYear integer,
  Population integer,
  LifeExpectancy real,
  GNP real,
  GNPOld real,
  LocalName text,
  GovernmentForm text,
  HeadOfState text,
  Capital integer,
  Code2 text
);
CREATE TABLE CountryLanguage (
  CountryCode text PRIMARY KEY,
  Language text PRIMARY KEY,
  IsOfficial text,
  Percentage real
);
-- foreign keys: City.CountryCode -> Country.Code; CountryLanguage.CountryCode -> Country.Code

Hint: smallest surface area refers to MIN(smallest surface area);

Question: Which country has the smallest surface area?

[Assistant] SELECT Name FROM Country ORDER BY SurfaceArea 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:
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE station (
    id INTEGER PRIMARY KEY,
    name TEXT,
    lat NUMERIC,
    long NUMERIC,
    dock_count INTEGER,
    city TEXT,
    installation_date TEXT);

Question: What are the names of all stations that have more than 10 bikes available and are not located in San Jose?

[Assistant] SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING avg(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "San Jose"