input
stringlengths 193
2.69k
| output
stringlengths 24
744
|
|---|---|
[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 [ REAL ]
review_count [ 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_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: Which business ID received the review of 4 star and above by 65% of user? Describe their active status and city. [/INST]
|
SELECT DISTINCT T2.business_id, T2.city FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 AND ( SELECT CAST(( SELECT COUNT(DISTINCT T1.user_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 ) AS REAL) * 100 / ( SELECT COUNT(user_id) FROM Users ) > 65 );
|
[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: Calculate the difference between running business in Glendale City and Mesa City. [/INST]
|
SELECT SUM(CASE WHEN city = 'Glendale' THEN 1 ELSE 0 END) - SUM(CASE WHEN city = 'Mesa' THEN 1 ELSE 0 END) AS diff FROM Business WHERE active = 'true';
|
[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_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: How many likes did short comment left by users who joined in 2010 get? [/INST]
|
SELECT SUM(T2.likes) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2010;
|
[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_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: For users with average ratings of 3, what kind of tip length they mostly left? [/INST]
|
SELECT T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_average_stars = 3 GROUP BY T2.tip_length ORDER BY COUNT(T2.tip_length) DESC LIMIT 1;
|
[INST] Here is a database schema:
Tips :
business_id [ INTEGER ]
user_id [ INTEGER ]
likes [ INTEGER ]
tip_length [ 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 following question: Sum up the likes get by short reviews on businesses located in City Goodyear. [/INST]
|
SELECT SUM(T2.likes) AS likes FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Goodyear';
|
[INST] Here is a database schema:
Tips :
business_id [ INTEGER ]
user_id [ INTEGER ]
likes [ INTEGER ]
tip_length [ 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 following question: For businesses with long length reviews, which state are they located? [/INST]
|
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Long';
|
[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 following question: How much time do businesses in El Mirage City, AZ State operate in average daily? [/INST]
|
SELECT SUM(T2.closing_time - T2.opening_time) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'El Mirage' AND T1.state = 'AZ';
|
[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 [ TEXT ]
Please write me a SQL statement that answers the following question: List down the closing day of businesses located at SC State. [/INST]
|
SELECT T3.day_id - T2.day_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.state = 'SC';
|
[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 me a SQL statement that answers the following question: List down the category of businesses whose stars ratings are 5. [/INST]
|
SELECT DISTINCT T3.category_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 WHERE T1.stars = 5;
|
[INST] Here is a database schema:
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_count [ TEXT ]
Please write me a SQL statement that answers the following question: What are the states of businesses with attribute of beer and wine located? [/INST]
|
SELECT DISTINCT T2.state FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'beer_and_wine';
|
[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: How many user's compliment in photo has medium in number? [/INST]
|
SELECT COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos' AND T2.number_of_compliments = 'Medium';
|
[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_count [ TEXT ]
Please write me a SQL statement that answers the following question: Among businesses with "Wi-Fi" attribute, which businesses id are located at SC State? [/INST]
|
SELECT T3.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 = 'Wi-Fi' AND T2.attribute_value = 'true' AND T3.state = 'SC';
|
[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: Sum up the number of business with "ambience_romantic" attribute. [/INST]
|
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_romantic' AND T2.attribute_value = 'true';
|
[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: What is the percentage of businesses with "Good for Kids" attribute over the other attributes? [/INST]
|
SELECT CAST(SUM(CASE WHEN attribute_name = 'Good for Kids' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value = '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: How many businesses are not closed in the city of Mesa? [/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]
|
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. [/INST]
|
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]
|
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]
|
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 [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: How many reviews of businesses that are still open received an uber rating on the funny vote? [/INST]
|
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_review_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: How many of the users who use a high number of compliments do not have any fans? [/INST]
|
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 compliments that a user has received from other users? [/INST]
|
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_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: How many stars does each of the 3 top users with the most likes in their reviews have? [/INST]
|
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 me a SQL statement that answers the following question: In which categories does the only business located in the city of Arcadia appear? [/INST]
|
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 Sunday. [/INST]
|
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_count [ TEXT ]
Please write me a SQL statement that answers the following question: How many businesses with music_karaoke attribute are closed? [/INST]
|
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 [ REAL ]
review_count [ TEXT ]
Please write me a SQL statement that answers the following question: How many open businesses in the City of Phoenix have users left a long review? [/INST]
|
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 [ 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 following question: How many users who have received a low cool vote have also received at least 1 low cool vote for some of their reviews? [/INST]
|
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_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: How many users with a long tip and 2 likes for their tip have a high number of fans? [/INST]
|
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_trendy attribute? [/INST]
|
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 [ TEXT ]
Please write me a SQL statement that answers the following question: How many businesses in the city of Scottsdale open on Sunday at 12PM? [/INST]
|
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 me a SQL statement that answers the following question: What is the average number of stars for businesses in the Obstetricians & Gynecologists category? [/INST]
|
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 [ TEXT ]
user_review_count [ TEXT ]
user_fans [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the percentage of users with a high number of fans who were elite in 2011. [/INST]
|
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]
|
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]
|
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 following question: In users yelping since 2009 to 2011, how many of them have low count of fans? [/INST]
|
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 user 11021 to business with business ID 3? [/INST]
|
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_count [ TEXT ]
Please write me a SQL statement that answers the following question: Among the businesses in Tempe, list the attribute of the business with a medium review count. [/INST]
|
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 me a SQL statement that answers the following question: In businesses with a category of food, how many of them have a star rating below 3? [/INST]
|
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 me a SQL statement that answers the following question: List the active business ID and its stars of the businesses fall under the category of Food. [/INST]
|
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 ]
category_id [ INTEGER ]
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 category and attributes of businesses with highest star rating? [/INST]
|
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.attribute_id = T5.attribute_id WHERE T1.stars = ( SELECT MAX(stars) FROM Business );
|
[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_votes_cool [ TEXT ]
review_length [ TEXT ]
Please write me a SQL statement that answers the following question: What is the category of the business with short review length and highest review stars within business ID from 7 to 14? [/INST]
|
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) FROM Reviews );
|
[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_count [ TEXT ]
Please write me a SQL statement that answers the following question: Count the active businesses that has an attribute of BYOB with high review count. [/INST]
|
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 following question: What is the closing and opening time of businesses located at Glendale with highest star rating? [/INST]
|
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 ]
category_id [ INTEGER ]
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: Among the active businesses located at Goodyear, AZ, list the category and atrributes of business with a high review count. [/INST]
|
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 = T5.attribute_id WHERE T1.review_count = 'High' AND T1.city = 'Goodyear' AND T1.state = 'AZ' 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 me a SQL statement that answers the following question: List the categories of active businesses in Glendale, AZ. [/INST]
|
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 [ TEXT ]
Please write me a SQL statement that answers the following question: Find the location of businesses that has business hours from 7 am to 7 pm every Wednesday. [/INST]
|
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_count [ TEXT ]
Please write me a SQL statement that answers the following question: What is the attribute value of an active business with a low review count and 3 stars which is located at Goodyear, AZ? [/INST]
|
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 [ TEXT ]
Please write me a SQL statement that answers the following question: What is the opening time of the active businesses in Glendale that have a medium review count. [/INST]
|
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 me a SQL statement that answers the following question: Among the businesses with a category of Food, what is the percentage of the business with greater than 3 stars? [/INST]
|
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 [ TEXT ]
Please write me a SQL statement that answers the following question: List the closing time and day of week of active businesses in Goodyear with stars greater than the 80% of average age of star rating. [/INST]
|
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 = 'Goodyear' );
|
[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]
|
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]
|
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'? [/INST]
|
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 class label which also cited those words. [/INST]
|
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 cited? [/INST]
|
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 to? [/INST]
|
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'. [/INST]
|
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]
|
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 words were cited by this paper ID? [/INST]
|
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. [/INST]
|
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]
|
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]
|
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_paper_id) DESC LIMIT 1;
|
[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]
|
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? [/INST]
|
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? [/INST]
|
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 number of words cited? [/INST]
|
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]
|
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 20s is the oldest? [/INST]
|
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 Castellaneta? [/INST]
|
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 simpson 20s born in the New York city, how many of them were born after the year 1970? [/INST]
|
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 ]
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 ]
Please write me a SQL statement that answers the following question: In which country was the winner of the Outstanding Voice-Over Performance award of 2009 born? [/INST]
|
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 ]
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 ]
Please write me a SQL statement that answers the following question: Please list the names of all the awards won by the crew member whose nickname is Doofus. [/INST]
|
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 ]
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 ]
Please write me a SQL statement that answers the following question: How many crew members who were born in the USA were nominated for the Outstanding Animated Program (For Programming Less Than One Hour) award in 2009? [/INST]
|
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 ]
Character_Award :
award_id [ INTEGER ] Character_Award.award_id = Award.award_id
character [ TEXT ]
Please write me a SQL statement that answers the following question: Which character won the Outstanding Voice-Over Performance award in 2009? [/INST]
|
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
keyword [ TEXT ]
Please write me a SQL statement that answers the following question: Please list all the keywords of the episode Lost Verizon. [/INST]
|
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
keyword [ TEXT ]
Please write me a SQL statement that answers the following question: How many keywords does the episode that was aired on 2008/10/19 have? [/INST]
|
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 [ 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 ]
Please write me a SQL statement that answers the following question: What's the rating of the episode in which Dan Castellaneta won the Outstanding Voice-Over Performance award in 2009? [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: How many 7-star votes in star score did the episode Lost Verizon have? [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: How many stars did most of the voters give in star score for the episode Lost Verizon? [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: Please list the titles of the episodes that have over 200 voters voting a 10 in star score. [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: How many episodes aired in the year 2009 have over 15% of voters giving 10 stars in star score? [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: What's the title of the episode that got the most 7-star votes in star score? [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: How many stars on average does the episode Lost Verizon have? [/INST]
|
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 [ 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 ]
Please write me a SQL statement that answers the following question: What is the percentage of Primetime Emmy nominated episodes with a rating over 7 to all the episodes that have a rating over 7? [/INST]
|
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
category [ TEXT ]
person [ TEXT ] Credit.person = Person.name
role [ TEXT ]
credited [ TEXT ]
Please write me a SQL statement that answers the following question: Name the title of the episode where Pamela Hayden voiced the character 'Ruthie.' [/INST]
|
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
category [ TEXT ]
person [ TEXT ] Credit.person = Person.name
role [ TEXT ]
credited [ TEXT ]
Please write me a SQL statement that answers the following question: List down all the roles of Matt Groening on the episode titled 'In the Name of the Grandfather' along with the episode number and series number. [/INST]
|
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
keyword [ TEXT ]
Please write me a SQL statement that answers the following question: Write down the title and summary of the episode with the keyword 'eviction.' [/INST]
|
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 [ INTEGER ]
votes [ INTEGER ]
percent [ REAL ]
Please write me a SQL statement that answers the following question: What is the average number of stars received by the episode titled 'Wedding for Disaster.' [/INST]
|
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
keyword [ TEXT ]
Please write me a SQL statement that answers the following question: Write the title and all the keywords of the episode that was aired on 3/22/2009. [/INST]
|
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 ] Credit.person = Person.name
role [ TEXT ]
credited [ TEXT ]
Please write me a SQL statement that answers the following question: What is the birth name of the person who voiced 'Helen Lovejoy?' [/INST]
|
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 [ 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 ]
Credit :
episode_id [ TEXT ] Credit.episode_id = Episode.episode_id
category [ TEXT ]
person [ TEXT ] Credit.person = Person.name
role [ TEXT ]
credited [ TEXT ]
Please write me a SQL statement that answers the following question: What is the percentage ratio between uncredited and credited roles on the episode that won the 2017 Jupiter Award for Best International TV Series? Please include the title of the episode and the names of the persons who were uncredited alongside their role in that episode. [/INST]
|
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.award_category = 'Jupiter Award' 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 ]
Please write me a SQL statement that answers the following question: How many episodes have more than 1000 votes? [/INST]
|
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 York, USA? [/INST]
|
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 ]
Please write me a SQL statement that answers the following question: List the name of all awards along with the award category, nominated by Marc Wilmore. [/INST]
|
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 nickname? List their full name along with the nickname. [/INST]
|
SELECT COUNT(name) FROM Person WHERE nickname IS NOT NULL;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.