input stringlengths 122 2.7k | output stringlengths 24 805 |
|---|---|
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: How many businesses are not closed in the city of Mesa? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE city = 'Mesa' AND active = 'true'; |
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: In how many businesses have customers had a bad or terrible experience? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE stars IN (1, 2); |
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: List by ID the businesses with the reviews with the lowest veracity of Paradise Valley.... | SELECT business_id FROM Business WHERE stars > 3 AND city = 'Paradise Valley' AND review_count = 'Low'; |
[INST] Here is a database schema:
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Please write me a SQL statement that answers the following question: How many businesses have more than 1 attribute? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_value > 1; |
[INST] Here is a database schema:
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Please write me a SQL statement that answers the following question: How many businesses are opened the same number of hours every day of the week? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'; |
[INST] Here is a database schema:
Reviews :
business_id [ INTEGER ]
user_id [ INTEGER ]
review_stars [ INTEGER ]
review_votes_funny [ TEXT ]
review_votes_useful [ TEXT ]
review_votes_cool [ TEXT ]
review_length [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ ... | SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_votes_funny = 'Uber' AND T1.active = 'true'; |
[INST] Here is a database schema:
Users_Compliments :
compliment_id [ INTEGER ]
user_id [ INTEGER ]
number_of_compliments [ TEXT ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_votes_funny [ TEXT ]
user_votes_useful [ TEXT ]
user_votes_cool [ TEXT ]
user_re... | SELECT COUNT(T2.user_id) FROM Users_Compliments AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.number_of_compliments = 'High' AND T2.user_fans = 'None'; |
[INST] Here is a database schema:
Compliments :
compliment_id [ INTEGER ] primary_key
compliment_type [ TEXT ]
Users_Compliments :
compliment_id [ INTEGER ]
user_id [ INTEGER ]
number_of_compliments [ TEXT ]
Please write me a SQL statement that answers the following question: What is the most common type of compliment... | SELECT T2.compliment_type FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id GROUP BY T2.compliment_type ORDER BY COUNT(T2.compliment_type) DESC LIMIT 1; |
[INST] Here is a database schema:
Tips :
business_id [ INTEGER ]
user_id [ INTEGER ]
likes [ INTEGER ]
tip_length [ TEXT ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_votes_funny [ TEXT ]
user_votes_useful [ TEXT ]
user_votes_cool [ TEXT ]
user_review_cou... | SELECT T2.user_average_stars FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id GROUP BY T2.user_id ORDER BY SUM(T1.likes) DESC LIMIT 3; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write m... | SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city = 'Arcadia'; |
[INST] Here is a database schema:
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Please write me a SQL statement that answers the following question: List by their id all businesses that are open on Sund... | SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.day_id = 1; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_co... | SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'music_karaoke' AND T3.active = 'false' AND T2.attribute_value IN ('none', 'no', 'false'); |
[INST] Here is a database schema:
Reviews :
business_id [ INTEGER ]
user_id [ INTEGER ]
review_stars [ INTEGER ]
review_votes_funny [ TEXT ]
review_votes_useful [ TEXT ]
review_votes_cool [ TEXT ]
review_length [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ ... | SELECT COUNT(DISTINCT T2.business_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_length = 'Long' AND T2.active = 'true' AND T2.city = 'Phoenix'; |
[INST] Here is a database schema:
Reviews :
business_id [ INTEGER ]
user_id [ INTEGER ]
review_stars [ INTEGER ]
review_votes_funny [ TEXT ]
review_votes_useful [ TEXT ]
review_votes_cool [ TEXT ]
review_length [ TEXT ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEX... | SELECT COUNT(DISTINCT T1.user_id) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_votes_cool = 'Low' AND T2.review_votes_cool = 'Low'; |
[INST] Here is a database schema:
Tips :
business_id [ INTEGER ]
user_id [ INTEGER ]
likes [ INTEGER ]
tip_length [ TEXT ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_votes_funny [ TEXT ]
user_votes_useful [ TEXT ]
user_votes_cool [ TEXT ]
user_review_cou... | SELECT COUNT(DISTINCT T1.user_id) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T2.tip_length = 'Long' AND T2.likes = 2 AND T1.user_fans = 'High'; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Please write me a SQL statement that answers the following question: In how many businesses with the ambience_trend... | SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_trendy' AND T2.attribute_value IN ('none', 'no', 'false'); |
[INST] Here is a database schema:
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ T... | SELECT COUNT(DISTINCT T2.business_id) FROM Business AS T1 INNER JOIN Business_hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Scottsdale' AND T3.day_of_week = 'Sunday' AND T2.opening_time = '12PM'; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write m... | SELECT CAST(SUM(T1.stars) AS REAL) / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Obstetricians & Gynecologists'; |
[INST] Here is a database schema:
Years :
year_id [ INTEGER ] primary_key
actual_year [ INTEGER ]
Elite :
user_id [ INTEGER ]
year_id [ INTEGER ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_votes_funny [ TEXT ]
user_votes_useful [ TEXT ]
user_votes_cool [... | SELECT CAST(SUM(CASE WHEN T3.user_fans = 'High' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.user_fans) FROM Years AS T1 INNER JOIN Elite AS T2 ON T1.year_id = T2.year_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.actual_year = 2011; |
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: How many of the businesses are in Surprise? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE city = 'Surprise'; |
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: List down the business ID with a high review count in Tempe. [/INST] [/INST] | SELECT business_id FROM Business WHERE review_count = 'High' AND city = 'Tempe'; |
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: What is the total number of active businesses in AZ with a medium review count? [/INST]... | SELECT COUNT(business_id) FROM Business WHERE review_count = 'Medium' AND state = 'AZ' AND active = 'true'; |
[INST] Here is a database schema:
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: List down the business ID with a star range from 3 to 5, located at Chandler. [/INST] [... | SELECT business_id FROM Business WHERE stars >= 3 AND stars < 6 AND city = 'Chandler'; |
[INST] Here is a database schema:
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_votes_funny [ TEXT ]
user_votes_useful [ TEXT ]
user_votes_cool [ TEXT ]
user_review_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the followin... | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year >= 2009 AND user_yelping_since_year < 2012 AND user_fans = 'Low'; |
[INST] Here is a database schema:
Reviews :
business_id [ INTEGER ]
user_id [ INTEGER ]
review_stars [ INTEGER ]
review_votes_funny [ TEXT ]
review_votes_useful [ TEXT ]
review_votes_cool [ TEXT ]
review_length [ TEXT ]
Please write me a SQL statement that answers the following question: What is the review length of u... | SELECT review_length FROM Reviews WHERE user_id = 11021 AND business_id = 3; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_co... | SELECT DISTINCT T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.city = 'Tempe' AND T1.review_count = 'Medium'; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write m... | SELECT COUNT(DISTINCT T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food' AND T1.stars < 3; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write m... | SELECT DISTINCT T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food' AND T1.active = 'true'; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business_Categories :
business_id [ INTEGER ... | SELECT DISTINCT T3.category_name, T5.attribute_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id INNER JOIN Business_Attributes AS T4 ON T2.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribu... |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Reviews :
business_id [ INTEGER ]
user_id [ INTEGER ]
review_stars [ INTEGER ]
review_votes_funny [ TEXT ]
review_votes_useful [ TEXT ]
review_v... | SELECT DISTINCT T3.category_name FROM Reviews AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T2.business_id >= 7 AND T2.business_id < 15 AND T1.review_length = 'Short' AND T1.review_stars = ( SELECT MAX(review_stars) FRO... |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_co... | SELECT COUNT(DISTINCT T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name = 'BYOB' AND T1.review_count = 'High' AND T1.active = 'true'; |
[INST] Here is a database schema:
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the fol... | SELECT T2.opening_time, T2.closing_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' ORDER BY T1.stars DESC LIMIT 1; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business_Categories :
business_id [ INTEGER ... | SELECT T3.category_name, T5.attribute_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id INNER JOIN Business_Attributes AS T4 ON T1.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T... |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write m... | SELECT DISTINCT T3.category_name FROM Business_Categories AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T1.category_id = T3.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T2.city = 'Glendale'; |
[INST] Here is a database schema:
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ T... | SELECT DISTINCT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time = '7AM' AND T2.closing_time = '7PM' AND T3.day_of_week = 'Wednesday'; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_co... | SELECT DISTINCT T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.state = 'AZ' AND T1.city = 'Goodyear' AND T1.active = 'true' AND T1.stars = 3 AND T1.review_count = 'Low'; |
[INST] Here is a database schema:
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ T... | SELECT DISTINCT T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Glendale' AND T1.review_count = 'Medium' AND T1.active = 'true'; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ TEXT ]
Please write m... | SELECT CAST(SUM(CASE WHEN T1.stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food'; |
[INST] Here is a database schema:
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Business :
business_id [ INTEGER ] primary_key
active [ TEXT ]
city [ TEXT ]
state [ TEXT ]
stars [ REAL ]
review_count [ T... | SELECT DISTINCT T2.closing_time, T3.day_of_week FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.active = 'true' AND T1.city = 'Goodyear' AND T1.stars > ( SELECT AVG(stars) * 0.8 FROM Business WHERE active = 'true' AND city = ... |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
Please write me a SQL statement that answers the following question: Among all the citation, what is the percentage of paper ID under the Agents classification? [/INST] [/INST] | SELECT CAST(COUNT(CASE WHEN class_label = 'Agents' THEN paper_id ELSE NULL END) AS REAL) * 100 / COUNT(paper_id) FROM paper; |
[INST] Here is a database schema:
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: What is the most cited word? How many papers was that word cited in? [/INST] [/INST] | SELECT word_cited_id, COUNT(paper_id) FROM content GROUP BY word_cited_id ORDER BY COUNT(word_cited_id) DESC LIMIT 1; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: What is the total number of word cited under that class labelled 'AI'? [... | SELECT COUNT(DISTINCT T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI'; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: For all words cited in paper ID 315017, state the other paper ID and cla... | SELECT T1.class_label, T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.paper_id = 315017; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: Among all the DB class type citation, which word is the most frequently ... | SELECT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'DB' GROUP BY T2.word_cited_id ORDER BY COUNT(T2.word_cited_id) DESC LIMIT 1; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the percentage of words used in Agents class label. [/INST] [/... | SELECT CAST(COUNT(DISTINCT CASE WHEN T1.class_label = 'Agents' THEN T2.word_cited_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: Which paper ID cited the most word? In which class label does it belongs... | SELECT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id GROUP BY T1.paper_id, T1.class_label ORDER BY COUNT(T2.word_cited_id) DESC LIMIT 1; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: List all the paper ID and its class type that cited the word 'word1002'.... | SELECT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T2.word_cited_id = 'word1002'; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: List all words cited in the AI class label. [/INST] [/INST] | SELECT DISTINCT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI'; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: What is the class label of paper ID 'chakrabarti01integrating'. How many... | SELECT DISTINCT T1.class_label, COUNT(T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.paper_id = 'chakrabarti01integrating' GROUP BY T1.class_label; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: List all paper ID and its class type with more than 20 cited words. [/IN... | SELECT DISTINCT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id GROUP BY T2.paper_id, T1.class_label HAVING COUNT(T2.word_cited_id) > 20; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: List the words that are cited in both AI and IR class label. [/INST] [/I... | SELECT DISTINCT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI' OR T1.class_label = 'IR'; |
[INST] Here is a database schema:
cites :
cited_paper_id [ TEXT ]
citing_paper_id [ TEXT ]
Please write me a SQL statement that answers the following question: Name the paper which is cited most times and the paper which is cited least times? Also, find the number of times each one is cited. [/INST] [/INST] | SELECT cited_paper_id, COUNT(cited_paper_id), ( SELECT cited_paper_id FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) ASC LIMIT 1 ), ( SELECT COUNT(cited_paper_id) FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) ASC LIMIT 1 ) FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_pa... |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
Please write me a SQL statement that answers the following question: On average, how many papers are under the ML class? [/INST] [/INST] | SELECT CAST(COUNT(CASE WHEN class_label = 'ML' THEN paper_id ELSE NULL END) AS REAL) / COUNT(paper_id) FROM paper; |
[INST] Here is a database schema:
cites :
cited_paper_id [ TEXT ]
citing_paper_id [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: Find the words cited in papers that are cited by sima01computational? [/IN... | SELECT DISTINCT T2.word_cited_id FROM cites AS T1 INNER JOIN content AS T2 ON T1.cited_paper_id = T2.paper_id WHERE T1.citing_paper_id = 'sima01computational'; |
[INST] Here is a database schema:
cites :
cited_paper_id [ TEXT ]
citing_paper_id [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: How many papers were cited by schmidt99advanced cited word3555? [/INST] [/... | SELECT COUNT(T2.paper_id) FROM cites AS T1 INNER JOIN content AS T2 ON T1.cited_paper_id = T2.paper_id WHERE T1.citing_paper_id = 'schmidt99advanced' AND T2.word_cited_id = 'word3555'; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: Under what classification do the papers that cited word1163 belong? [/IN... | SELECT DISTINCT T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T2.word_cited_id = 'word1163'; |
[INST] Here is a database schema:
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
content :
paper_id [ TEXT ] content.paper_id = paper.paper_id
word_cited_id [ TEXT ]
Please write me a SQL statement that answers the following question: Among the papers under DB classification, which paper has the highest nu... | SELECT T1.paper_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'DB' GROUP BY T1.paper_id ORDER BY COUNT(T2.word_cited_id) DESC LIMIT 1; |
[INST] Here is a database schema:
cites :
cited_paper_id [ TEXT ]
citing_paper_id [ TEXT ]
paper :
paper_id [ TEXT ] primary_key
class_label [ TEXT ]
Please write me a SQL statement that answers the following question: In the papers classified as ML, how many cited butz01algorithmic? [/INST] [/INST] | SELECT COUNT(T1.paper_id) FROM paper AS T1 INNER JOIN cites AS T2 ON T1.paper_id = T2.citing_paper_id WHERE T1.class_label = 'ML' AND T2.cited_paper_id = 'butz01algorithmic'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Please write me a SQL statement that answers the following question: Which crew member of the simpson 20... | SELECT name FROM Person WHERE birthdate IS NOT NULL ORDER BY birthdate ASC LIMIT 1; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Please write me a SQL statement that answers the following question: What's the nickname for Dan Castell... | SELECT nickname FROM Person WHERE name = 'Dan Castellaneta'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Please write me a SQL statement that answers the following question: Among the crew members of the simps... | SELECT COUNT(name) FROM Person WHERE birth_region = 'New York' AND SUBSTR(birthdate, 1, 4) > '1970'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
a... | SELECT T1.birth_country FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.year = 2009 AND T2.result = 'Winner'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
a... | SELECT T2.award FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T1.nickname = 'Doofus' AND T2.result = 'Winner'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
a... | SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T1.birth_country = 'USA' AND T2.result = 'Nominee' AND T2.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.year = 2009; |
[INST] Here is a database schema:
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
award [ TEXT ]
person [ TEXT ] Award.person = Person.name
role [ TEXT ]
episode_id [ TEXT ] Award.episode_id = Episode.episode_id
season [ TEXT ]
song [ TEXT ]
result [ TEXT ]
Charac... | SELECT DISTINCT T1.character FROM Character_Award AS T1 INNER JOIN Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.year = 2009 AND T2.result = 'Winner'; |
[INST] Here is a database schema:
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 ]
Keyword :
episode_id [ TEXT ] Keyword.episode_id = Episode.episode_id... | SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Lost Verizon'; |
[INST] Here is a database schema:
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 ]
Keyword :
episode_id [ TEXT ] Keyword.episode_id = Episode.episode_id... | SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2008-10-19'; |
[INST] Here is a database schema:
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 ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [... | SELECT T2.rating FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Outstanding Voice-Over Performance' AND SUBSTR(T1.year, 1, 4) = '2009' AND T1.person = 'Dan Castellaneta'; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon' AND T2.stars = 7; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon' ORDER BY T2.votes DESC LIMIT 1; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.votes > 200 AND T2.stars = 10; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.stars = 10 AND T2.percent > 15; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 7 ORDER BY T2.votes DESC LIMIT 1; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT CAST(SUM(T2.votes * T2.stars) AS REAL) / SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon'; |
[INST] Here is a database schema:
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 ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [... | SELECT CAST(SUM(CASE WHEN T1.award_category = 'Primetime Emmy' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.rating > 7 AND T1.result = 'Nominee'; |
[INST] Here is a database schema:
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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
c... | SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Pamela Hayden' AND T2.role = 'Ruthie'; |
[INST] Here is a database schema:
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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
c... | SELECT T2.role, T1.episode, T1.number_in_series FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Matt Groening' AND T1.title = 'In the Name of the Grandfather'; |
[INST] Here is a database schema:
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 ]
Keyword :
episode_id [ TEXT ] Keyword.episode_id = Episode.episode_id... | SELECT T1.title, T1.summary FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'eviction'; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT AVG(T2.stars) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Wedding for Disaster'; |
[INST] Here is a database schema:
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 ]
Keyword :
episode_id [ TEXT ] Keyword.episode_id = Episode.episode_id... | SELECT T1.title, T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2009-03-22'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
category [ TEXT ]
person [ TEXT ] Cre... | SELECT DISTINCT T1.birth_name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.role = 'Helen Lovejoy'; |
[INST] Here is a database schema:
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 ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [... | SELECT CAST(SUM(CASE WHEN T2.credited = 'false' THEN 1 END) AS REAL) * 100 / SUM(CASE WHEN T2.credited = 'true' THEN 1 END), T3.title, T2.person FROM Award AS T1 INNER JOIN Credit AS T2 ON T2.episode_id = T1.episode_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2017' AND T1... |
[INST] Here is a database schema:
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 ]
Please write me a SQL statement that answers the following question:... | SELECT COUNT(episode_id) FROM Episode WHERE votes > 1000; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Please write me a SQL statement that answers the following question: How many persons were born in New Y... | SELECT COUNT(name) FROM Person WHERE birth_place = 'New York City' AND birth_country = 'USA'; |
[INST] Here is a database schema:
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
award [ TEXT ]
person [ TEXT ] Award.person = Person.name
role [ TEXT ]
episode_id [ TEXT ] Award.episode_id = Episode.episode_id
season [ TEXT ]
song [ TEXT ]
result [ TEXT ]
Pleas... | SELECT award_id, award_category FROM Award WHERE person = 'Marc Wilmore'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Please write me a SQL statement that answers the following question: How many crew have their own nickna... | SELECT COUNT(name) FROM Person WHERE nickname IS NOT NULL; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Please write me a SQL statement that answers the following question: Find the average height for each pe... | SELECT AVG(height_meters) FROM Person; |
[INST] Here is a database schema:
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: Calculate the difference between the highest votes for episode and the lowest votes for episode. [/... | SELECT MAX(votes) - MIN(votes) FROM Vote; |
[INST] Here is a database schema:
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
award [ TEXT ]
person [ TEXT ] Award.person = Person.name
role [ TEXT ]
episode_id [ TEXT ] Award.episode_id = Episode.episode_id
season [ TEXT ]
song [ TEXT ]
result [ TEXT ]
Charac... | SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009 AND T1.award = 'Outstanding Voice-Over Performance'; |
[INST] Here is a database schema:
Person :
name [ TEXT ] primary_key
birthdate [ TEXT ]
birth_name [ TEXT ]
birth_place [ TEXT ]
birth_region [ TEXT ]
birth_country [ TEXT ]
height_meters [ REAL ]
nickname [ TEXT ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [ INTEGER ]
award_category [ TEXT ]
a... | SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.year = 2009 AND T2.award = 'Comedy Series' AND T1.birth_region = 'California'; |
[INST] Here is a database schema:
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 ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [... | SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2017' AND T1.award = 'Best International TV Series' AND T1.result = 'Winner'; |
[INST] Here is a database schema:
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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
c... | SELECT T2.person FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'How the Test Was Won' AND T2.credited = 'false'; |
[INST] Here is a database schema:
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 ]
Keyword :
episode_id [ TEXT ] Keyword.episode_id = Episode.episode_id... | SELECT DISTINCT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword IN ('riot', 'cake'); |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 10 ORDER BY T1.votes DESC LIMIT 1; |
[INST] Here is a database schema:
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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
c... | SELECT DISTINCT T2.person FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.air_date, 6, 2) BETWEEN '10' AND '11'; |
[INST] Here is a database schema:
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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
c... | SELECT T2.person FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Treehouse of Horror XIX' AND T2.role = 'director'; |
[INST] Here is a database schema:
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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
c... | SELECT COUNT(DISTINCT T2.role) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 5; |
[INST] Here is a database schema:
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 ]
Keyword :
episode_id [ TEXT ] Keyword.episode_id = Episode.episode_id... | SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please'; |
[INST] Here is a database schema:
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 ]
Award :
award_id [ INTEGER ] primary_key
organization [ TEXT ]
year [... | SELECT CAST(SUM(CASE WHEN T1.award = 'Outstanding Voice-Over Performance' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.episode_id) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 950 AND T1.year = 2009; |
[INST] Here is a database schema:
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 ]
Vote :
episode_id [ TEXT ] Vote.episode_id = Episode.episode_id
stars... | SELECT CAST(SUM(CASE WHEN T1.title = 'No Loan Again, Naturally' THEN T1.votes ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Coming to Homerica' THEN T1.votes ELSE 0 END) AS ratio FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 5; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.