db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the 3 worst rated episodes?
SELECT title FROM Episode ORDER BY rating LIMIT 3
worst rated refers to min(rating)
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the full place of birth of Rene Chenevert Balcer?
SELECT birth_place, birth_region FROM Person WHERE birth_name = 'Rene Chenevert Balcer'
full place of birth refers to birth_place, birth_region; Rene Chenevert Balcer refers to birth_name = 'Rene Chenevert Balcer'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the name of the actors born in the USA?
SELECT name FROM Person WHERE birth_country = 'USA'
born in the USA refers to birth_country = 'USA'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the episodes that were least enjoyed?
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 1
least enjoyed refers to stars = 1
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the names of the two people who won an award for their role as directors?
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.Result = 'Winner' AND T2.role = 'director'
won an award refers to result = 'Winner'; role as director refers to role = 'director'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many votes did the episode titled Juvenile get?
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Juvenile'
the episode titled Juvenile refers to title = 'Juvenile'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
In which episodes was Anthony Azzara not credited?
SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'false' AND T3.name = 'Anthony Azzara'
which episode refers to title; not credited refers to credited = ''
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
In what year did the episodes titled DWB get an award?
SELECT DISTINCT T1.year FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.title = 'DWB' AND T1.result = 'Winner'
titled DWB refers to title = 'DWB'; get an award refers to result = 'Winner'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
In which region were the assistant location managers born?
SELECT T2.birth_region FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'president of NBC West Coast'
region refers to birth_region; assistant location manager refers to role = 'assistant location manager'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many stars did the episodes in which Donna Villella worked?
SELECT COUNT(T3.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T3.name = 'Donna Villella'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What role was Julia Roberts nominated for?
SELECT T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.Result = 'Nominee' AND T1.name = 'Julia Roberts'
nominated refers to result = 'Nominee'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What role does the tallest person play?
SELECT T2.role FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id INNER JOIN Award AS T3 ON T2.episode_id = T3.episode_id ORDER BY T1.height_meters DESC LIMIT 1
the tallest refers to max(height_meters)
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the episode with the most nominations?
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.result = 'Nominee' GROUP BY T2.episode_id ORDER BY COUNT(T1.result) DESC LIMIT 1
the most nominations refers to max(count(episode_id where result = 'Nominee'))
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What was the rating of the episodes that Jace Alexander worked on?
SELECT T1.rating FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T3.name = 'Jace Alexander'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the names of all the people who worked on episode 19 of season 9?
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 19 AND T1.season = 9
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the average star rating of the episodes Jim Bracchitta has worked on?
SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.episode_id) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id INNER JOIN Vote AS T3 ON T2.episode_id = T3.episode_id WHERE T3.stars = 1 AND T1.name = 'Jim Bracchitta'
average star rating = divide(sum(stars), count(episode_id)) where name = 'Jim Bracchitta'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What percentage of people have worked on the True North episode as additional crew?
SELECT CAST(SUM(CASE WHEN T2.role = 'Additional Crew' THEN 1 ELSE 0 END) AS REAL ) * 100 / COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'True North'
the True North episode refers to title = 'True North'; additional crew refers to role = 'Additional Crew'; percentage = divide(count(episode_id where role = 'Additional Crew'), count(episode_id)) * 100% where title = 'True North'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Write down the title, summary, and air date of the episode that garnered 72 10-star votes.
SELECT T2.title, T2.summary, T2.air_date FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 10 AND T1.votes = 72
72 10-star votes refers to stars = 10 and votes = 72
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many 6-star votes did episode 12 get? Please include the air date and rating.
SELECT T2.air_date, T2.rating FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 6 AND T2.episode = 12
6-star vote refers to stars = 6
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the winner of the Best Television Episode award for the Edgar category in 2000? Include his or her name and role.
SELECT T1.name, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.year = 2000 AND T2.award_category = 'Edgar' AND T2.award = 'Best Television Episode'
the Best Television Episode award refers to award = 'Best Television Episode'; the Edgar category refers to award_category = 'Edgar'; in 2000 refers to year = 2000
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Write down the organization, year, award, and award category in which Rene Balcer is the winner.
SELECT T2.organization, T2.year, T2.award, T2.award_category FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Rene Balcer' AND T2.result = 'Winner'
Rene Balcer refers to name = 'Rene Balcer'; the winner refers to result = 'Winner'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Give me the years and episode IDs in which Constantine Makris was the winner of the Television Silver Gavel Award at the American Bar Association Silver Gavel Awards for Media and the Arts for two consecutive years.
SELECT t3.years, t3.episode_id FROM ( SELECT DISTINCT T2.year AS years, T2.episode_id, row_number() OVER (PARTITION BY T2.episode_id ORDER BY T2.year) AS rm FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award = 'Television' AND T2.award_category = 'Silver Gavel Award' AND T1.name = 'C...
the winner refers to result = 'Winner'; the Television refers to award = 'Television'; Silver Gavel Award refers to award_category = 'Silver Gavel Award'; the American Bar Association Silver Gavel Awards for Media and the Arts refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts...
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who was the Law and Order series writer who also won the Television Silver Gavel Award at the American Bar Association Silver Gavel Awards for Media and the Arts for two consecutive years?
SELECT t3.name FROM ( SELECT DISTINCT T2.year AS years, T1.name, row_number() OVER (PARTITION BY T1.name ORDER BY T2.year) AS rm FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award = 'Television' AND T2.award_category = 'Silver Gavel Award' AND T2.series = 'Law and Order' AND T2.resul...
who refers to name; writer refers to role = 'writer'; won refers to result = 'Winner'; the Television refers to award = 'Television'; Silver Gavel Award refers to award_category = 'Silver Gavel Award'; the American Bar Association Silver Gavel Awards for Media and the Arts refers to organization = 'American Bar Associa...
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many times was episode 20 of the Law and Order series nominated for the Primetime Emmy Awards in 1999?
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.year = 1999 AND T2.result = 'Nominee' AND T1.episode = 20 AND T2.organization = 'Primetime Emmy Awards' AND T1.series = 'Law and Order'
nominated refers to result = 'nominee'; the Law and Order series refers to series = 'Law and Order'; the Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; in 1999 refers to year = 1999
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
On what episode did Julia Roberts win the "Outstanding Guest Actress in a Drama Series" award during the 1999 Primetime Emmy Awards? Tell me her role.
SELECT T3.episode_id, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id WHERE T2.year = 1999 AND T2.award = 'Outstanding Guest Actress in a Drama Series' AND T2.organization = 'Primetime Emmy Awards' AND T1.name = 'Julia Roberts' AN...
win refers to result = 'Winner'; the "Outstanding Guest Actress in a Drama Series" award refers to award = 'Outstanding Guest Actress in a Drama Series'; the 1999 refers to year = 1999; Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
List the titles and air dates of episodes that were produced by Billy Fox.
SELECT T1.title, T1.air_date FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.category = 'Produced by' AND T2.role = 'producer' AND T3.name = 'Billy Fox'
produced refers to role = 'producer'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Among the American casts, how many were uncredited on episode ID tt0629228?
SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629228' AND T1.category = 'Cast' AND T1.credited = 'false' AND T2.birth_country = 'USA'
American refers to birth_country = 'USA'; cast refers to category = 'Cast'; uncredited refers to credited = ''
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What was the role of Jason Kuschner in episode 9?
SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.episode = 9 AND T2.name = 'Jason Kuschner'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who played the role of the "president of NBC West Coast" in the first episode?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.episode = 1 AND T1.role = 'president of NBC West Coast'
who refers to name; the role of the "president of NBC West Coast" refers to role = 'president of NBC West Coast'; the first episode refers to episode = 1
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
List down the titles of the top 3 episodes, from highest to lowest, in terms of their weighted stars.
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars BETWEEN 1 AND 10 GROUP BY T2.title ORDER BY CAST(SUM(T1.stars * T1.percent) AS REAL) / 100 DESC LIMIT 3
weighted stars = divide(sum(stars, percent), 100)
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the ratio of American casts on episode 2 of the series? Please include their roles.
SELECT CAST(SUM(CASE WHEN T2.category = 'Cast' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category), T1.role FROM Award AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id INNER JOIN Person AS T4 ON T2.person_id = T4.person_id WHERE T3.episode = 2 A...
American refers to birth_country = 'USA'; cast refers to category = 'Cast'; ratio = divide(count(person_id where birth_country = 'USA'), total(category)) where category = 'Cast'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people from Canada are nominated for an award?
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.birth_country = 'Canada'
from Canada refers to birth_country = Canada; nominated refers to award is NOT NULL
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many episodes are credited to Jerry Orbach?
SELECT COUNT(T2.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Jerry Orbach'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
List out all the credit names for episode 9.
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 9
credit name refers to name
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
List out all award titles nominated for episode 20.
SELECT T2.award FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 20 AND T2.result IN ('Winner', 'Nominee')
award title refers to title; nominated refers to result = 'Winner' or result = 'Nominee'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which role have won at least two awards for the entire season and list out the name?
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id GROUP BY T2.role HAVING COUNT(T2.award_id) > 1
at least two awards refers to count(role) >1
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
List out director names that received an award along with the episode number.
SELECT T3.name, T1.episode_id FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T2.person_id = T3.person_id WHERE T2.role = 'director' AND T2.result = 'Winner'
director refers to role = 'director'; received an award refers to result = 'Winner'; episode number refers to episode
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episodes are nominated for an awards but not win?
SELECT T1.episode FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.result = 'Nominee'
nominated for an award but not win refers to result = 'Nominee'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the average rating for each episode in season 9?
SELECT SUM(rating) / COUNT(episode_id) FROM Episode WHERE season = 9
average rating = divide(sum(rating), count(episode_id))
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the difference of 10 stars votes between the first episode and the last episode?
SELECT SUM(CASE WHEN T2.episode = 24 THEN T1.votes ELSE 0 END) - SUM(CASE WHEN T2.episode = 1 THEN T1.votes ELSE 0 END) FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 10
the first episode refers to episode = 1; the last episode refers to episode = 24; 10 stars vote refers to stars = 10; the difference = subtract(votes where episode = 1, votes where episode = 24) where stars = 10
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the episode rating with the most award won?
SELECT T1.rating FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.result = 'Winner' GROUP BY T1.episode_id ORDER BY COUNT(T2.award_id) DESC LIMIT 1
the most award won refers to max(episode_id where result = 'Winner')
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many credits have been displayed from episode 1 until 10?
SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.credited = 'true' AND T2.episode BETWEEN 1 AND 10
credit displayed refers to credited = 'true'; from episode 1 until 10 refers to episode > = 1 AND episode < = 10
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the episode that has mafia keyword?
SELECT T1.episode FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.Keyword = 'mafia'
mafia keyword refers to Keyword = 'mafia'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the average star with highest percentage for episodes that have received award?
SELECT T2.person_id FROM Vote AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id ORDER BY T1.percent DESC LIMIT 1
received award refers to result = 'Winner'; the highest percentage refers to max(percent); average star = divide(sum(stars), count(episode_id))
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the average ranking episodes that are nominated for an award?
SELECT SUM(T1.rating) / COUNT(T1.episode) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id
average ranking = divide(sum(rating), sum(episode_id))
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many winners have been awarded a Television award by the "American Bar Association Silver Gavel Awards for Media and the Arts"?
SELECT COUNT(award_id) FROM Award WHERE result = 'Winner' AND award = 'Television' AND organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
winner refers to result = 'Winner'; Television award refers to award = 'Television'; the "American Bar Association Silver Gavel Awards for Media and the Arts" refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which continent was Michael Preston born on?
SELECT birth_country FROM Person WHERE name = 'Michael Preston'
continent refers to birth_country
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who was the nominee playing the role of Katrina Ludlow in the Law & Order series?
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Nominee' AND T1.role = 'Katrina Ludlow' AND T1.series = 'Law and Order'
nominee refers to result = 'Nominee'; the role of Katrina Ludlow refers to role = 'Katrina Ludlow'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who played the role of a teleplay in the episode that won "Best Television Episode"?
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Winner' AND T1.award = 'Best Television Episode'
the role of a teleplay refers to role = 'teleplay'; won refers to result = 'Winner'; "Best Television Episode" refers to award = 'Best Television Episode'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the date of birth of the actor who played the role of a "writer"?
SELECT T2.birthdate FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.role = 'writer'
date of birth refers to birthdate
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episode was nominated for the award for "Outstanding Costume Design for a Series"?
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Outstanding Costume Design for a Series'
episode refers to title; "Outstanding Costume Design for a Series" refers to award = 'Outstanding Costume Design for a Series'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episode has the highest total number of viewer votes?
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id GROUP BY T1.title ORDER BY SUM(T1.votes) DESC LIMIT 1
episode refers to title; the highest total number of viewer votes refers to max(sum(votes))
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who was the actor who was portraying "Alex Brown" and has been credited?
SELECT T1.name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id WHERE T2.role = 'Alex Brown' AND T2.credited = 'true'
who refers to name; portraying "Alex Brown" refers to role = 'Alex Brown'; has been credited refers to credited = 'true'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Where is the place of birth of the actor with the number nm0007064 who has not been credited for playing the role of a "Narrator"?
SELECT DISTINCT T1.birth_place FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id WHERE T1.person_id = 'nm0007064' AND T2.role = 'Narrator' AND T2.credited = 'false'
place of birth refers to birth_place; actor with the number nm0007064 refers to person_id = 'nm007064'; has not been credited refers to credited = ''; the role of a "Narrator" refers to role = 'narrator'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the keywords of the episode "Shield"?
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Shield'
the episode "Shield" refers to title = 'Shield'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who are the actors with a height of over 1.80m in an episode that won an award?
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Winner' AND T2.height_meters > 1.80
who refers to name; a height of over 1.80m refers to height_meters > 1.80; won an award refers to result = 'Winner'
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episode has the two keywords "nun" and "priest"?
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword IN ('nun', 'priest')
episode refers to title; the two keywords "nun" and "priest" refers to keyword = 'nun' or keyword = 'priest';
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episode number has the second highest positive viewer comments and has been awarded "Best Television Episode"?
SELECT T2.episode_id FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Best Television Episode' AND T1.result = 'Winner' ORDER BY T2.rating DESC LIMIT 2
episode number refers to episode_id; awarded "Best Television Episode" refers to award = 'Best Television Episode' and result = 'Winner'; the second highest positive viewer comments refers to rating = 8.5
law_episode
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 ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Please list any three episodes that were most enjoyed by the viewers.
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 LIMIT 3
episode refers to title; most enjoyed by the viewers refers to stars = 10
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
According to the observation on 2008/3/11, what was the height of Elly Koss?
SELECT T2.value, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.date = '2008-03-11' AND T2.description = 'Body Height'
2008/3/11 refers to date = '2008-03-11'; height refers to DESCRIPTION = 'Body Height' from observations;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
By how much did Elly Koss's weight increase from the observation in 2008 to the observation in 2009?
SELECT SUM(CASE WHEN strftime('%Y', T2.date) = '2009' THEN T2.VALUE END) - SUM(CASE WHEN strftime('%Y', T2.date) = '2008' THEN T2.VALUE END) AS increase , T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Body Height'
SUBTRACT((DATE like '2009%'), (DATE like '2008%')) where DESCRIPTION = 'Body Weight';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
During all the observations of Elly Koss, what was the highest Systolic Blood Pressure observed?
SELECT T2.value, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Systolic Blood Pressure' ORDER BY T2.VALUE DESC LIMIT 1
the highest Systolic Blood Pressure refers to MAX(DESCRIPTION = 'Systolic Blood Pressure') from observations;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
For how many times had Elly Koss have her Systolic Blood Pressure observed?
SELECT COUNT(T2.description) FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Systolic Blood Pressure'
Systolic Blood Pressure refers to DESCRIPTION = 'Systolic Blood Pressure';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
The highest Systolic Blood Pressure was observed in which patient? Please give his or her full name.
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.VALUE = ( SELECT MAX(VALUE) FROM observations WHERE description = 'Systolic Blood Pressure' ) LIMIT 1
the highest Systolic Blood Pressure refers to MAX(DESCRIPTION = 'Systolic Blood Pressure') from observations; full name refers to first, last;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
For how long was Elly Koss required to take Acetaminophen?
SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description LIKE 'Acetaminophen%'
SUM(MULTIPLY(365, SUBTRACT(strftime('%Y', STOP), strftime('%Y', START))), MULTIPLY(30, SUBTRACT(strftime('%m', STOP), strftime('%m', START))), SUBTRACT(strftime('%d', STOP), strftime('%d', START))) where DESCRIPTION like 'Acetaminophen%';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Please list all the medication that are prescribed to Elly Koss.
SELECT DISTINCT T2.description FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss'
medication that are prescribed refers to DESCRIPTION from medications;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Why did Elly Koss need to take Acetaminophen?
SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description LIKE 'Acetaminophen%'
why need to take Acetaminophen refers to REASONDESCRIPTION  where DESCRIPTION like 'Acetaminophen%' from medications;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What medication did Elly Koss take when she had Streptococcal sore throat?
SELECT T2.description FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.reasondescription = 'Streptococcal sore throat (disorder)'
medication refers to DESCRIPTION from medications; Streptococcal sore throat refers to REASONDESCRIPTION like 'Streptococcal sore throat%';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Please give the full names of all the patients who had been prescribed with Acetaminophen.
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.description LIKE 'Acetaminophen%'
full name refers to first, last; prescribed with Acetaminophen refer to DESCRIPTION like 'Acetaminophen%' from medications;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What was the condition of Elly Koss on 2009/1/8?
SELECT T2.description FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.START = '2009-01-08'
condition on 2009/1/8 refers to DESCRIPTION from conditions where START = '2009-01-08';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
For how long did Elly Koss's cystitis last?
SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Cystitis'
SUM(MULTIPLY(365, SUBTRACT(strftime('%Y', STOP), strftime('%Y', START))), MULTIPLY(30, SUBTRACT(strftime('%m', STOP), strftime('%m', START))), SUBTRACT(strftime('%d', STOP), strftime('%d', START))) where DESCRIPTION = 'Cystitis';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
According to all the observations of Elly Koss, what was her average weight?
SELECT AVG(T2.VALUE), T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Body Weight'
DIVIDE(SUM(VALUE), COUNT(VALUE)) WHERE DESCRIPTION = 'Body Weight';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Among all the patients who once had cystitis, what was the percentage of them being married?
SELECT CAST(SUM(CASE WHEN T1.marital = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.description = 'Cystitis'
DIVIDE(COUNT(marital = 'M'), COUNT(patient)) as percentage where DESCRIPTION = 'Cystitis';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Give the body height status of Mr. Vincent Wyman on 2010/8/2.
SELECT T2.description, T2.VALUE, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Vincent' AND T1.last = 'Wyman' AND T2.date = '2010-08-02' AND T2.description = 'Body Height'
body height status refers to DESCRIPTION = 'Body Height' from observations; on 2010/8/2 refers to DATE = '2010-08-02';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many care plans has Mrs. Norman Berge taken?
SELECT COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Norman' AND T1.last = 'Berge'
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Why did Mrs. Annabelle Pouros take leucovorin 100 mg injection on 1970/12/19? State the reason.
SELECT T2.reasondescription FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Annabelle' AND T1.last = 'Pouros' AND T2.start = '1970-12-19' AND T2.description = 'Leucovorin 100 MG Injection'
reason why take leucovorin 100 mg injection refers to REASONDESCRIPTION where DESCRIPTION = 'Leucovorin 100 MG Injection'; on 1970/12/19 refers to START = '1970-12-19';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What is the prevalence percentage of condition no. 64859006?
SELECT DISTINCT T1."PREVALENCE PERCENTAGE" FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) WHERE T2.code = '64859006'
condition no. 64859006 refers to conditions where CODE = '64859006';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
State the prevalence rate of condition no. 368581000119106.
SELECT DISTINCT T1."PREVALENCE RATE" FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) WHERE T2.code = '368581000119106'
condition no. 368581000119106 refers to conditions where CODE = '368581000119106';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Give the procedure description of Ms. Jacquelyn Shanahan on 2009/8/9.
SELECT DISTINCT T2.description FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' AND T2.DATE = '2009-08-09'
on 2009/8/9 refers to DATE = '2009-08-09';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Give the number of claims did Ms. Abbie Cole have in the year of 2011.
SELECT COUNT(T2.BILLABLEPERIOD) FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Abbie' AND T1.last = 'Cole' AND T2.BILLABLEPERIOD BETWEEN '2010-12-31' AND '2012-01-01'
in the year of 2011 refers to BILLABLEPERIOD between '2010-12-31' and '2012-01-01';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many allergies does Mrs. Saundra Monahan have?
SELECT COUNT(DISTINCT T2.code) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Saundra' AND T1.last = 'Monahan'
allergies refer to PATIENT from allergies;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Provide the name of the patient who had a claim on 1947/9/11.
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T2.billableperiod = '1947-09-11'
name of the patient implies full name and refers to first, last; on 1947/9/11 refers to BILLABLEPERIOD = '1947-09-11';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Describe the encounter of Mr. Hubert Baumbach on 2008/10/25.
SELECT T2.description FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Hubert' AND T1.last = 'Baumbach' AND T2.date = '2008-10-25'
encounter refers to DESCRIPTION from encounters; on 2008/10/25 refers to DATE = '2008-10-25';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What kind of condition did Keven Kuhn have from 2016/9/24 to 2016/10/10? Describe the condition.
SELECT T2.description FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Keven' AND T1.last = 'Kuhn' AND T2.start = '2016-09-24' AND T2.stop = '2016-10-10'
kind of condition refers to DESCRIPTION from conditions; from 2016/9/24 to 2016/10/10 refers to START = '2016-09-24' and STOP = '2016-10-10';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
When did Mrs. Ira Deckow have the standard pregnancy test?
SELECT T2.date FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Ira' AND T1.last = 'Deckow' AND T2.description = 'Standard pregnancy test'
standard pregnancy test refers to DESCRIPTION = 'Standard pregnancy test' from procedures;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Calculate the average period of Mr. Wesley Lemke's care plans.
SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Wesley' AND T1.last = 'Lemke'
DIVIDE(SUBTRACT(stop time - start time), COUNT(ID)));
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
State the average period of Ms. Angelena Kertzmann's several normal pregnancies.
SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Angelena' AND T1.last = 'Kertzmann' AND T2.description = 'Normal pregnancy'
DIVIDE(SUBTRACT(stop time - start time), COUNT(DESCRIPTION = 'Normal pregnancy')));
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What is the id of the patient who has the longest allergy period?
SELECT PATIENT FROM allergies WHERE STOP IS NOT NULL GROUP BY PATIENT ORDER BY CASE WHEN SUBSTR(STOP, -2, 1) != '9' THEN SUBSTR(STOP, LENGTH(STOP) - 1) + 2000 END - CASE WHEN SUBSTR(START, -2, 1) = '9' THEN SUBSTR(START, LENGTH(START) - 1) + 1900 ELSE SUBSTR(START, LENGTH(START) - 1) + 2000 END LIMIT 1
id of the patient refers to PATIENT from allergies where STOP is not null; the longest allergy period refers to MAX(SUBTRACT((SUBSTR(STOP, - 2, 1)! = '9' then substr(STOP, length(STOP) - 1) + 2000 end), (SUBSTR(START, - 2, 1) = '9' then substr(START, length(START) - 1) + 1900 else substr(START, length(START) - 1) + 200...
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many patients have diabetes that started in 1988?
SELECT COUNT(PATIENT) FROM conditions WHERE DESCRIPTION = 'Diabetes' AND strftime('%Y', START) = '1988'
diabetes that started in 1988 refers to DESCRIPTION = 'Diabetes' from conditions and START like '1988%';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many patients are allergic to eggs?
SELECT COUNT(PATIENT) FROM allergies WHERE DESCRIPTION = 'Allergy to eggs'
allergic to eggs refer to DESCRIPTION = 'Allergy to eggs' from allergies;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What is the id of the patient whose hypertension started most recently?
SELECT PATIENT FROM conditions WHERE START = ( SELECT MAX(START) FROM conditions WHERE DESCRIPTION = 'Hypertension' )
id of the patient refers to PATIENT from conditions;  hypertension refers to DESCRIPTION = 'Hypertension'; most recently refers to MAX(START);
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What is the most common allergy among patients?
SELECT DESCRIPTION FROM allergies GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1
the most common allergy refers to MAX(COUNT(DESCRIPTION)) from allergies;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What is/are the ids of the tallest patient/s?
SELECT PATIENT FROM observations WHERE DESCRIPTION = 'Body Height' AND UNITS = 'cm' ORDER BY VALUE DESC LIMIT 1
id of the tallest patient/s refers to PATIENT from observations where MAX(DESCRIPTION = 'Body Height');
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What is the most common condition among the female Americans?
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.gender = 'F' AND T1.ethnicity = 'american' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1
the most common condition refers to MAX(COUNT(DESCRIPTION)); among the female Americans refer to PATIENT where gender = 'F' and ethnicity = 'american';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
Among the patients that started taking Ibuprofen 200mg Oral Tablet in 2016, how many Dominican patients stopped taking the medicine after exactly one month?
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' AND T1.ethnicity = 'dominican' AND strftime('%Y', T2.START) = '2016' AND strftime('%m', T2.STOP) - strftime('%m', T2.START) = 1
Ibuprofen 200mg Oral Tablet refers to DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' from medications; started in 2016 refers to START like '2016%'; Dominican patients refer to ethnicity = 'dominican'; stopped taking the medicine after exactly one month refers to SUBTRACT(strftime('%m', STOP), strftime('%m', START)) = 1;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many of the patients born in 1920s had pneumonia?
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE DESCRIPTION = 'Pneumonia' AND strftime('%Y', T1.birthdate) LIKE '192%'
patients born in 1920s refer to patient where birthdate like '192%'; pneumonia refers to DESCRIPTION = 'Pneumonia' from conditions;
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
What are the full names of the patients who started taking Yaz 28 Day Pack in 2011?
SELECT DISTINCT T1.first, T1.last, T1.suffix FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Yaz 28 Day Pack' AND strftime('%Y', T2.START) = '2011'
full name refers to first, last; Yaz 28 Day Pack refers to DESCRIPTION = 'Yaz 28 Day Pack' from medications; started taking in 2011 refers to START like '2011%';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many Black patients were immunized with DTaP in 2013?
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'black' AND T2.DESCRIPTION = 'DTaP' AND strftime('%Y', T2.DATE) = '2013'
Black patients refer to patient where race = 'black'; immunized with DTaP refers to DESCRIPTION = 'DTaP' from immunizations; in 2013 refers to DATE like '2013%';
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many immunizations did the patient with the most prevalent condition that started recently get?
SELECT COUNT(T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) INNER JOIN immunizations AS T3 ON T2.PATIENT = T3.PATIENT GROUP BY T2.PATIENT ORDER BY T2.START DESC, T1."PREVALENCE RATE" DESC LIMIT 1
patient with the most prevalent condition refers to patient where MAX(PREVALENCE RATE); started recently refers to MAX(START);
synthea
CREATE TABLE all_prevalences ( ITEM TEXT primary key, "POPULATION TYPE" TEXT, OCCURRENCES INTEGER, "POPULATION COUNT" INTEGER, "PREVALENCE RATE" REAL, "PREVALENCE PERCENTAGE" REAL ); CREATE TABLE patients ( patient TEXT ...
【DB_ID】 synthea 【Schema】 # Table: main.all_prevalences [ (ITEM:TEXT, Primary Key), (POPULATION TYPE:TEXT, Examples: [LIVING]), (OCCURRENCES:INTEGER, Examples: [868, 487, 117]), (POPULATION COUNT:INTEGER, Examples: [1000]), (PREVALENCE RATE:REAL, Examples: [0.868, 0.487, 0.117]), (PREVALENCE PERCENTAGE:REAL, Examples: [...
How many patients have the most prevalent conditions?
SELECT COUNT(DISTINCT T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) ORDER BY T1."PREVALENCE RATE" DESC LIMIT 1
the most prevalent conditions refer to MAX(PREVALENCE RATE);