ajayk007/querysmith-spider-bird huggingface dataset:
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE state (
  StateCode text PRIMARY KEY,
  State text,
  Region text
);
CREATE TABLE callcenterlogs (
  Date received date,
  Complaint ID text PRIMARY KEY,
  rand client text,
  phonefinal text,
  vru+line text,
  call_id integer,
  priority integer,
  type text,
  outcome text,
  server text,
  ser_start text,
  ser_exit text,
  ser_time text
);
CREATE TABLE client (
  client_id text PRIMARY KEY,
  sex text,
  day integer,
  month integer,
  year integer,
  age integer,
  social text,
  first text,
  middle text,
  last text,
  phone text,
  email text,
  address_1 text,
  address_2 text,
  city text,
  state text,
  zipcode integer,
  district_id integer
);
CREATE TABLE district (
  district_id integer PRIMARY KEY,
  city text,
  state_abbrev text,
  division text
);
CREATE TABLE events (
  Date received date,
  Product text,
  Sub-product text,
  Issue text,
  Sub-issue text,
  Consumer complaint narrative text,
  Tags text,
  Consumer consent provided? text,
  Submitted via text,
  Date sent to company text,
  Company response to consumer text,
  Timely response? text,
  Consumer disputed? text,
  Complaint ID text PRIMARY KEY,
  Client_ID text PRIMARY KEY
);
CREATE TABLE reviews (
  Date date PRIMARY KEY,
  Stars integer,
  Reviews text,
  Product text,
  district_id integer
);
-- foreign keys: callcenterlogs.rand client -> client.client_id; client.district_id -> district.district_id; district.state_abbrev -> state.StateCode; events.Client_ID -> client.client_id; events.Complaint ID -> callcenterlogs.Complaint ID; reviews.district_id -> district.district_id

Hint: in North Central refers to Region = 'North Central'; highest number of customers refers to max(count(client_id)); over the age of 60 refers to age > 60

Question: Which city in West North Central has the highest number of customers over the age of 60?

assistant: SELECT T2.city FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'West North Central' AND T1.age > 60 GROUP BY T2.city ORDER BY COUNT(T2.city) 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 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: Asian population of 7 refers to asian_population = 7;

Question: Give the alias of the cities with an Asian population of 7.

assistant: SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.asian_population = 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 Episode (
  episode_id text PRIMARY KEY,
  season integer,
  episode integer,
  number_in_series integer,
  title text,
  summary text,
  air_date text,
  episode_image text,
  rating real,
  votes integer
);
CREATE TABLE Person (
  name text PRIMARY KEY,
  birthdate text,
  birth_name text,
  birth_place text,
  birth_region text,
  birth_country text,
  height_meters real,
  nickname text
);
CREATE TABLE Award (
  award_id integer PRIMARY KEY,
  organization text,
  year integer,
  award_category text,
  award text,
  person text,
  role text,
  episode_id text,
  season text,
  song text,
  result text
);
CREATE TABLE Character_Award (
  award_id integer,
  character text
);
CREATE TABLE Credit (
  episode_id text,
  category text,
  person text,
  role text,
  credited text
);
CREATE TABLE Keyword (
  episode_id text PRIMARY KEY,
  keyword text PRIMARY KEY
);
CREATE TABLE Vote (
  episode_id text,
  stars integer,
  votes integer,
  percent real
);
-- foreign keys: Award.episode_id -> Episode.episode_id; Award.person -> Person.name; Character_Award.award_id -> Award.award_id; Credit.person -> Person.name; Credit.episode_id -> Episode.episode_id; Keyword.episode_id -> Episode.episode_id; Vote.episode_id -> Episode.episode_id

Hint: 2-star refers to stars = 2; average rating refers to 5 < rating < = 7; more than 20 of 2-star votes refers to votes > 20

Question: What are the episodes that have the average rating with more than 20 of 2-star votes?

assistant: SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 2 AND T2.votes > 20 AND T1.rating > 5.0 AND T1.rating <= 7.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 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: ratio =  DIVIDE(COUNT(name WHERE `bool` = 'pos'), COUNT(name WHERE `bool` = 'neg')); have payment due refers to `bool` = 'pos'; no payment due refers to `bool` = 'neg';

Question: What is the ratio of students who have payment due and those who do not have payment due?

assistant: SELECT CAST(SUM(IIF(`bool` = 'pos', 1, 0)) AS REAL) / SUM(IIF(`bool` = 'neg', 1, 0)) FROM no_payment_due
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 (
  CountryCode text PRIMARY KEY,
  ShortName text,
  TableName text,
  LongName text,
  Alpha2Code text,
  CurrencyUnit text,
  SpecialNotes text,
  Region text,
  IncomeGroup text,
  Wb2Code text,
  NationalAccountsBaseYear text,
  NationalAccountsReferenceYear text,
  SnaPriceValuation text,
  LendingCategory text,
  OtherGroups text,
  SystemOfNationalAccounts text,
  AlternativeConversionFactor text,
  PppSurveyYear text,
  BalanceOfPaymentsManualInUse text,
  ExternalDebtReportingStatus text,
  SystemOfTrade text,
  GovernmentAccountingConcept text,
  ImfDataDisseminationStandard text,
  LatestPopulationCensus text,
  LatestHouseholdSurvey text,
  SourceOfMostRecentIncomeAndExpenditureData text,
  VitalRegistrationComplete text,
  LatestAgriculturalCensus text,
  LatestIndustrialData integer,
  LatestTradeData integer,
  LatestWaterWithdrawalData integer
);
CREATE TABLE Series (
  SeriesCode text PRIMARY KEY,
  Topic text,
  IndicatorName text,
  ShortDefinition text,
  LongDefinition text,
  UnitOfMeasure text,
  Periodicity text,
  BasePeriod text,
  OtherNotes integer,
  AggregationMethod text,
  LimitationsAndExceptions text,
  NotesFromOriginalSource text,
  GeneralComments text,
  Source text,
  StatisticalConceptAndMethodology text,
  DevelopmentRelevance text,
  RelatedSourceLinks text,
  OtherWebLinks integer,
  RelatedIndicators integer,
  LicenseType text
);
CREATE TABLE CountryNotes (
  Countrycode text PRIMARY KEY,
  Seriescode text PRIMARY KEY,
  Description text
);
CREATE TABLE Footnotes (
  Countrycode text PRIMARY KEY,
  Seriescode text PRIMARY KEY,
  Year text PRIMARY KEY,
  Description text
);
CREATE TABLE Indicators (
  CountryName text,
  CountryCode text PRIMARY KEY,
  IndicatorName text,
  IndicatorCode text PRIMARY KEY,
  Year integer PRIMARY KEY,
  Value integer
);
CREATE TABLE SeriesNotes (
  Seriescode text PRIMARY KEY,
  Year text PRIMARY KEY,
  Description text
);
-- foreign keys: CountryNotes.Countrycode -> Country.CountryCode; CountryNotes.Seriescode -> Series.SeriesCode; Footnotes.Countrycode -> Country.CountryCode; Footnotes.Seriescode -> Series.SeriesCode; Indicators.CountryCode -> Country.CountryCode; SeriesNotes.Seriescode -> Series.SeriesCode

Hint: Finland is the short name of the country; year 2000 refers to Year = 'YR2000';

Question: What are the footnote description of Finland in year 2000?

assistant: SELECT DISTINCT T2.Description FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.TableName = 'Finland' AND T2.Year = 'YR2000'
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: store no. 22 refers to store_id = 2; detailed address refers to address, address2, district

Question: Give the detailed address for store No.2.

assistant: SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
PRAGMA foreign_keys = ON;
CREATE TABLE `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 all product names and the number of customers having an order on each product.

assistant: SELECT T2.product_name , count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_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 `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: What are the ids for transactions that have an amount greater than the average amount of a transaction?

assistant: SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
system: You are a text-to-SQL generator. Given a database schema and a question, reply with a single valid SQLite query that answers it. Output only the SQL on one line, with no explanation and no markdown.

user: Schema:
CREATE TABLE Episode (
  episode_id text PRIMARY KEY,
  series text,
  season integer,
  episode integer,
  number_in_series integer,
  title text,
  summary text,
  air_date date,
  episode_image text,
  rating real,
  votes integer
);
CREATE TABLE Keyword (
  episode_id text PRIMARY KEY,
  keyword text PRIMARY KEY
);
CREATE TABLE Person (
  person_id text PRIMARY KEY,
  name text,
  birthdate date,
  birth_name text,
  birth_place text,
  birth_region text,
  birth_country text,
  height_meters real,
  nickname text
);
CREATE TABLE Award (
  award_id integer PRIMARY KEY,
  organization text,
  year integer,
  award_category text,
  award text,
  series text,
  episode_id text,
  person_id text,
  role text,
  result text
);
CREATE TABLE Credit (
  episode_id text PRIMARY KEY,
  person_id text PRIMARY KEY,
  category text,
  role text,
  credited text
);
CREATE TABLE Vote (
  episode_id text,
  stars integer,
  votes integer,
  percent real
);
-- foreign keys: Keyword.episode_id -> Episode.episode_id; Award.person_id -> Person.person_id; Award.episode_id -> Episode.episode_id; Credit.person_id -> Person.person_id; Credit.episode_id -> Episode.episode_id; Vote.episode_id -> Episode.episode_id

Hint: the 2nd-highest number of votes refers to second max(votes)

Question: What are the keywords of the episode which received the 2nd-highest number of votes?

assistant: SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.votes NOT IN ( SELECT MAX(T1.votes) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ) ORDER BY T1.votes 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 Country (
  CountryCode text PRIMARY KEY,
  ShortName text,
  TableName text,
  LongName text,
  Alpha2Code text,
  CurrencyUnit text,
  SpecialNotes text,
  Region text,
  IncomeGroup text,
  Wb2Code text,
  NationalAccountsBaseYear text,
  NationalAccountsReferenceYear text,
  SnaPriceValuation text,
  LendingCategory text,
  OtherGroups text,
  SystemOfNationalAccounts text,
  AlternativeConversionFactor text,
  PppSurveyYear text,
  BalanceOfPaymentsManualInUse text,
  ExternalDebtReportingStatus text,
  SystemOfTrade text,
  GovernmentAccountingConcept text,
  ImfDataDisseminationStandard text,
  LatestPopulationCensus text,
  LatestHouseholdSurvey text,
  SourceOfMostRecentIncomeAndExpenditureData text,
  VitalRegistrationComplete text,
  LatestAgriculturalCensus text,
  LatestIndustrialData integer,
  LatestTradeData integer,
  LatestWaterWithdrawalData integer
);
CREATE TABLE Series (
  SeriesCode text PRIMARY KEY,
  Topic text,
  IndicatorName text,
  ShortDefinition text,
  LongDefinition text,
  UnitOfMeasure text,
  Periodicity text,
  BasePeriod text,
  OtherNotes integer,
  AggregationMethod text,
  LimitationsAndExceptions text,
  NotesFromOriginalSource text,
  GeneralComments text,
  Source text,
  StatisticalConceptAndMethodology text,
  DevelopmentRelevance text,
  RelatedSourceLinks text,
  OtherWebLinks integer,
  RelatedIndicators integer,
  LicenseType text
);
CREATE TABLE CountryNotes (
  Countrycode text PRIMARY KEY,
  Seriescode text PRIMARY KEY,
  Description text
);
CREATE TABLE Footnotes (
  Countrycode text PRIMARY KEY,
  Seriescode text PRIMARY KEY,
  Year text PRIMARY KEY,
  Description text
);
CREATE TABLE Indicators (
  CountryName text,
  CountryCode text PRIMARY KEY,
  IndicatorName text,
  IndicatorCode text PRIMARY KEY,
  Year integer PRIMARY KEY,
  Value integer
);
CREATE TABLE SeriesNotes (
  Seriescode text PRIMARY KEY,
  Year text PRIMARY KEY,
  Description text
);
-- foreign keys: CountryNotes.Countrycode -> Country.CountryCode; CountryNotes.Seriescode -> Series.SeriesCode; Footnotes.Countrycode -> Country.CountryCode; Footnotes.Seriescode -> Series.SeriesCode; Indicators.CountryCode -> Country.CountryCode; SeriesNotes.Seriescode -> Series.SeriesCode

Hint: note refers to Description; for Australia refers to ShortName = 'Australia'; indicator SP.ADO.TFRT refers to Seriescode = 'SP.ADO.TFRT'

Question: What is the note for Australia on the indicator SP.ADO.TFRT?

assistant: SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Seriescode = 'SP.ADO.TFRT' AND T1.ShortName = 'Australia'
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: Which college have both players with position midfielder and players with position defender?

assistant: SELECT College FROM match_season WHERE POSITION = "Midfielder" INTERSECT SELECT College FROM match_season WHERE POSITION = "Defender"
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: played by Tom Cruise refers to name = 'Tom Cruise'; movie Born on the Fourth of July refers to title = 'Born on the Fourth of July'

Question: What is the name of the character played by Tom Cruise in the movie Born on the Fourth of July?

assistant: SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise' AND T1.Title = 'Born on the Fourth of July'