input stringlengths 122 2.7k | output stringlengths 24 805 |
|---|---|
[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 ID sell beer and wine? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_id = 1 AND attribute_value = 'beer_and_wine'; |
[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 attributes ID owned by business ID 2? [/INST] [/INST] | SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2; |
[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 users received high compliment ty... | SELECT COUNT(T1.user_id) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'High' AND T2.compliment_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(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 T1.city LIKE 'Phoenix' AND T3.attribute_name LIKE 'waiter_service' AND T2.attribute_id = 2; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Business_Attributes :
attribute_id [ INTEGER ]
business_id [ INTEGER ]
attribute_value [ TEXT ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER... | SELECT T5.attribute_name FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id INNER JOIN Business_Attributes AS T4 ON T3.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T2.day_id LIKE '1'... |
[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 T3.business_id 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 INNER JOIN Reviews AS T4 ON T3.business_id = T4.business_id WHERE T1.category_name LIKE 'Fashion' AND T1.category_id = 7 GROUP BY T3.business_i... |
[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 T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.state LIKE 'AZ' AND T1.review_stars >= 3; |
[INST] Here is a database schema:
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 wr... | SELECT CAST(SUM(CASE WHEN T1.user_average_stars = 1 THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.user_id) , SUM(CASE WHEN T1.user_average_stars = 5 THEN 1 ELSE 0 END) * 1.0 / COUNT(T2.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T2.year_id = 2013; |
[INST] Here is a database schema:
Elite :
user_id [ INTEGER ]
year_id [ INTEGER ]
Please write me a SQL statement that answers the following question: Calculate the increment percentage of elite user for each year since year 2005. [/INST] [/INST] | SELECT CAST(COUNT(CASE WHEN year_id < 2014 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(CASE WHEN year_id = 2005 THEN 1.0 ELSE NULL END) AS increment FROM Elite; |
[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(T1.business_id) , strftime('%Y', 'now') - T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3; |
[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(review_stars) / (strftime('%Y', 'now') - T1.user_yelping_since_year) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3; |
[INST] Here is a database schema:
Elite :
user_id [ INTEGER ]
year_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 fo... | SELECT CAST(COUNT(T1.user_id) AS REAL) / COUNT(DISTINCT T1.business_id) FROM Reviews AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id; |
[INST] Here is a database schema:
Elite :
user_id [ INTEGER ]
year_id [ INTEGER ]
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 [... | SELECT T2.user_average_stars, COUNT(T3.likes) FROM Elite AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id INNER JOIN Tips AS T3 ON T3.user_id = T2.user_id GROUP BY T1.user_id HAVING COUNT(T1.user_id) > 5; |
[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 T2.category_id FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Reviews AS T3 ON T3.business_id = T1.business_id WHERE T2.category_name = 'Hotels & Travel' GROUP BY T2.category_id ORDER BY COUNT(T2.category_id) DESC LIMIT 1; |
[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 CAST(SUM(T2.review_stars) AS REAL) / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id; |
[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 active? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE active LIKE '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 low review count in Phoenix. [/INST] [/INST] | SELECT business_id FROM Business WHERE city LIKE 'Phoenix' AND review_count LIKE 'Low'; |
[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 business in AZ with a high review count? [/INST] [/I... | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'High' AND active LIKE '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 4, located at Tempe. [/INST] [/IN... | SELECT business_id FROM Business WHERE city LIKE 'Tempe' AND stars BETWEEN 3 AND 4; |
[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 BETWEEN 2010 AND 2012 AND user_fans LIKE '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 = 60776 AND business_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 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.review_count LIKE 'High' AND T1.city LIKE 'Scottsdale' GROUP BY T3.attribute_name; |
[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(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T3.category_name LIKE 'Automotive' 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 T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T3.category_name LIKE 'Pets'; |
[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 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 ORDER BY T1.stars DESC LIMIT 1; |
[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 T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.review_length LIKE 'Short' AND T2.business_id BETWEEN 5 AND 10 ORDER BY ... |
[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(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 LIKE 'Wi-Fi' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Medium'; |
[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.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 LIKE 'Gilbert' ORDER BY T1.stars DESC LIMIT 1; |
[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 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.review_count = 'Low' AND T1.city = 'Mesa' AND T1.active = 'true' AND T1.state = 'AZ'; |
[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 T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'FALSE' AND T1.state LIKE '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 [ T... | SELECT 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.closing_time LIKE '9PM' AND T2.opening_time LIKE '9AM' AND T3.day_of_week LIKE 'Saturday' GROUP BY T1.city; |
[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 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 LIKE 'AZ' AND T1.review_count LIKE 'Medium' AND T1.active LIKE 'FALSE' AND T1.city LIKE 'Phoenix' AND T1.stars = 3.5; |
[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 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 LIKE 'Surprise' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Low' GROUP BY T2.opening_time; |
[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) AS "percentage" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T3.category_name LIKE 'L... |
[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 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.city LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' AND T1.stars > 0.6 * ( SELECT AVG(T1.stars) FROM Business AS T1 INNER JOIN Business_Hours... |
[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 = 2004 AND user_fans LIKE 'None'; |
[INST] Here is a database schema:
Users_Compliments :
compliment_id [ INTEGER ]
user_id [ INTEGER ]
number_of_compliments [ TEXT ]
Please write me a SQL statement that answers the following question: List at least 5 users that has received less than 5 low compliments from
other users. [/INST] [/INST] | SELECT user_id FROM Users_Compliments WHERE number_of_compliments LIKE 'Low' GROUP BY user_id ORDER BY COUNT(number_of_compliments) > 5 LIMIT 5; |
[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_average_stars = 4 LIMIT 10; |
[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 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 LIKE '10AM' AND T2.closing_time LIKE '12PM' AND T3.day_of_week LIKE 'Sunday'; |
[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: How many businesses are opened for 24 hours? [... | SELECT 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 LIKE 'TRUE' AND T1.attribute_name LIKE 'Open 24 Hours'; |
[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 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 T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Good for Dancing' AND T1.attribute_name LIKE 'Good for Groups' LIMIT 5; |
[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 T1.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 LIKE 'Ahwatukee' AND T1.active LIKE 'TRUE' AND T3.day_of_week LIKE 'Sunday'; |
[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 T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T1.state NOT LIKE 'AZ'; |
[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 T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars = 2 AND T1.review_count LIKE '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: How many businesses have a romantic ambiance? ... | SELECT 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' AND T1.attribute_name = 'ambience_romantic'; |
[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 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.closing_time LIKE '6PM' AND T2.opening_time LIKE '1PM' AND T3.day_of_week LIKE 'Saturday'; |
[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(T1.user_fans) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id ORDER BY COUNT(T2.likes) DESC LIMIT 1; |
[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 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.closing_time = '1AM' AND T2.opening_time = '12AM' AND T3.day_of_week = 'Saturday'; |
[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(T2.business_id) 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 T1.category_name = 'Shopping Centers' AND T3.review_count = '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: How many businesses accept insurance? [/INST] ... | SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_name = 'Accepts Insurance' AND T1.attribute_value = 'true'; |
[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 1.0 * (( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'SC' ) + ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'CA' )) / ( SELECT SUM(T1.stars) FROM Business AS T1 INNE... |
[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 SUM(CASE WHEN T3.day_of_week = 'Monday' THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.day_of_week = 'Tuesday' THEN 1 ELSE 0 END) AS DIFF 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 = '10AM' AND T2.closing_time... |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Please write me a SQL statement that answers the following question: State the ID number for the attribute named "Accepts Insurance"? [/INST] [/INST] | SELECT attribute_id FROM Attributes WHERE attribute_name = 'Accepts Insurance'; |
[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 actively running Yelp businesses are there located in "Phoenix" city? [/INST] ... | SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Phoenix'; |
[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: Give the number of "4" stars Yelp businesses in "Mesa" city. [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE stars = 4 AND city = 'Mesa'; |
[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: Provide the number of Yelp businesses in "Gilbert" which got a" high" review count. [/I... | SELECT COUNT(business_id) FROM Business WHERE review_count = 'High' AND city = 'Gilbert'; |
[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 DISTINCT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'true' AND T1.city = 'Gilbert' AND T1.review_count = 'Uber'; |
[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(T2.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Tempe' AND T1.stars = '3.5' AND T1.review_count = 'Uber' AND T2.review_length = 'Long'; |
[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 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 = 'Mesa' AND T1.review_count = 'Uber' AND T3.attribute_name = 'Noise Level'; |
[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: Is the Yelp business No. 14033 good for supper... | SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_name = 'good_for_dinner' AND T1.business_id = 14033; |
[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: How long is the Yelp business No. 15098 opened on Mon... | SELECT SUBSTR(T1.closing_time, 1, 2) + 12 - SUBSTR(T1.opening_time, 1, 2) AS YYSJ FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week = 'Monday' AND T1.business_id = 15098; |
[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 T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Phoenix' AND T2.review_stars = 5 AND T2.review_votes_funny = 'Uber'; |
[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... | SELECT T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Medium' AND T2.likes = 3; |
[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 ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_vot... | SELECT COUNT(T2.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id INNER JOIN Compliments AS T3 ON T2.compliment_id = T3.compliment_id WHERE T1.user_yelping_since_year = 2010 AND T1.user_average_stars = 4.5 AND T1.user_fans = 'Uber' AND T3.compliment_type = 'funny'; |
[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 "cool" type compliments does user... | SELECT COUNT(T2.number_of_compliments) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'cool' AND T2.user_id = 41717; |
[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: Does Yelp business No."11825" have a "parking ... | SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.business_id = 11825 AND T2.attribute_name = 'parking_lot'; |
[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: Is the payment in mastercard possible for the ... | SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.business_id = 12476 AND T2.attribute_name = 'payment_types_mastercard'; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Please write me a SQL statement that answers the following question: What is the percentage for the Yelp businesses in "Pets" category of all b... | SELECT CAST(SUM(CASE WHEN T2.category_name = 'Pets' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category_name) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Please write me a SQL statement that answers the following question: How many times is the number of "Women's Clothing" Yelp businesses to "Men... | SELECT CAST(SUM(CASE WHEN T2.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) AS TIMES FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id; |
[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: Write down the ID, active status and city of the business which are in CA state. [/INST... | SELECT business_id, active, city FROM Business WHERE state = 'CA' 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: Calculate the percentage of running business among all business. [/INST] [/INST] | SELECT CAST(SUM(CASE WHEN active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(business_id) FROM Business; |
[INST] Here is a database schema:
Attributes :
attribute_id [ INTEGER ] primary_key
attribute_name [ TEXT ]
Please write me a SQL statement that answers the following question: Among all attribute names, list down the ID and attribute name which start with "music". [/INST] [/INST] | SELECT attribute_id, attribute_name FROM Attributes WHERE attribute_name LIKE 'music%'; |
[INST] Here is a database schema:
Elite :
user_id [ INTEGER ]
year_id [ INTEGER ]
Please write me a SQL statement that answers the following question: Between 2006 and 2007, which year ID had the greater number in elite user? [/INST] [/INST] | SELECT year_id FROM Elite WHERE year_id IN (2006, 2007) GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1; |
[INST] Here is a database schema:
Users_Compliments :
compliment_id [ INTEGER ]
user_id [ INTEGER ]
number_of_compliments [ TEXT ]
Please write me a SQL statement that answers the following question: Based on all user compliments, find the percentage of low number of compliments on all compliments ID. [/INST] [/INST] | SELECT CAST(SUM(CASE WHEN number_of_compliments = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(user_id) FROM Users_compliments; |
[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: List down the business ID and ... | SELECT business_id, user_id FROM Reviews WHERE review_votes_cool = 'Uber'; |
[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 T1.user_id, T2.business_id, T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_fans = 'High'; |
[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 T1.business_id, T1.active, T3.user_id, T3.user_yelping_since_year FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.review_votes_cool = 'Uber' AND T2.review_votes_funny = 'Uber' AND T2.review_length = 'Long'; |
[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 T1.attribute_id, T2.business_id, T3.city 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_playlist' AND T3.active = 'false'; |
[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: Calculate the percentage of business with attr... | SELECT CAST(SUM(CASE WHEN T1.attribute_name = 'Accepts Credit Cards' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.attribute_name) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id; |
[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 T2.user_id, T2.review_length FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'San Tan Valley' AND T1.active = 'false' AND T2.review_stars = 5; |
[INST] Here is a database schema:
Compliments :
compliment_id [ INTEGER ] primary_key
compliment_type [ TEXT ]
Years :
year_id [ INTEGER ] primary_key
actual_year [ INTEGER ]
Elite :
user_id [ INTEGER ]
year_id [ INTEGER ]
Users_Compliments :
compliment_id [ INTEGER ]
user_id [ INTEGER ]
number_of_compliments [ TEXT ]
... | SELECT T2.user_average_stars, T1.year_id, T4.compliment_type, T3.number_of_compliments FROM Elite AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id INNER JOIN Users_Compliments AS T3 ON T2.user_id = T3.user_id INNER JOIN Compliments AS T4 ON T3.compliment_id = T4.compliment_id INNER JOIN Years AS T5 ON T1.year_id... |
[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 T2.business_id, T3.state, T3.city 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 T1.category_name = 'Coffee & Tea' LIMIT 5; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Please write me a SQL statement that answers the following question: Describe category name which had above 10% in comparing with all business ... | SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id GROUP BY T2.category_id HAVING COUNT(T2.business_id) > ( SELECT COUNT(T3.business_id) FROM Business_Categories AS T3 ) * 0.1; |
[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 T3.user_id, T3.user_fans FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.city = 'Sun Lakes' AND T1.stars = 5; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Please write me a SQL statement that answers the following question: Compare the number of business between the category of "Men's Clothing" an... | SELECT SUM(CASE WHEN T1.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS diff FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id; |
[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 ]
Users :
user_id [ INTEGER ] primary_key
user_yelping_since_year [ INTEGER ]
user_average_stars [ TEXT ]
user_vot... | SELECT T1.compliment_type, T3.user_fans FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.number_of_compliments = 'Uber' AND T2.user_id < 100; |
[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: List all the businesses that closed at 8PM. [/INST] [/INST] | SELECT DISTINCT business_id FROM Business_Hours WHERE closing_time = '8PM'; |
[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 2 stars rated business located in Phoenix, Arizona? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND state = 'AZ' AND stars = 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: How many businesses in Tempe are rated as 'Wonderful experience? [/INST] [/INST] | SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND stars > 3; |
[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 user_id FROM Users WHERE user_yelping_since_year = 2012 AND user_average_stars < 3; |
[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: Find the percentage of 5 stars rated business. [/INST] [/INST] | SELECT CAST(SUM(CASE WHEN stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(stars) FROM Business; |
[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: Calculate difference between b... | SELECT ( SELECT COUNT(business_id) FROM Reviews GROUP BY business_id ORDER BY COUNT(business_id) DESC LIMIT 1 ) - ( SELECT COUNT(business_id) FROM Reviews GROUP BY business_id ORDER BY COUNT(business_id) ASC LIMIT 1 ) AS DIFF; |
[INST] Here is a database schema:
Categories :
category_id [ INTEGER ] primary_key
category_name [ TEXT ]
Business_Categories :
business_id [ INTEGER ]
category_id [ INTEGER ]
Business_Hours :
business_id [ INTEGER ]
day_id [ INTEGER ]
opening_time [ TEXT ]
closing_time [ TEXT ]
Business :
business_id [ INTEGER ] prima... | SELECT DISTINCT T2.business_id 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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T1.category_name = 'Tires' GROUP BY T2.business_id HAVING COU... |
[INST] Here is a database schema:
Years :
year_id [ INTEGER ] primary_key
actual_year [ INTEGER ]
Elite :
user_id [ INTEGER ]
year_id [ INTEGER ]
Please write me a SQL statement that answers the following question: Which users become an elite in 2012? [/INST] [/INST] | SELECT DISTINCT T1.user_id FROM Elite AS T1 INNER JOIN Years AS T2 ON T1.year_id = T2.year_id WHERE T2.actual_year = 2012; |
[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.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 = 'Shopping' AND T1.stars = 4; |
[INST] Here is a database schema:
Days :
day_id [ INTEGER ] primary_key
day_of_week [ TEXT ]
Checkins :
business_id [ INTEGER ]
day_id [ INTEGER ]
label_time_0 [ TEXT ]
label_time_1 [ TEXT ]
label_time_2 [ TEXT ]
label_time_3 [ TEXT ]
label_time_4 [ TEXT ]
label_time_5 [ TEXT ]
label_time_6 [ TEXT ]
label_time_7 [ TEXT... | SELECT COUNT(T2.business_id) FROM Days AS T1 INNER JOIN Checkins AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday' AND T2.label_time_10 = '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 ]
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 T1.city = 'Glendale' AND T2.user_id = 20241; |
[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.city 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 = 'Pet Services'; |
[INST] Here is a database schema:
Compliments :
compliment_id [ INTEGER ] primary_key
compliment_type [ TEXT ]
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_Compliments :
com... | SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id INNER JOIN Compliments AS T3 ON T2.compliment_id = T3.compliment_id INNER JOIN Reviews AS T4 ON T1.user_id = T4.user_id WHERE T3.compliment_type = 'photos' AND T4.review_votes_cool = 'High'; |
[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 q... | SELECT COUNT(*) FROM Business WHERE business_id IN ( SELECT T1.business_id FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'false' GROUP BY T1.business_id HAVING COUNT(DISTINCT T2.attribute_id) > 10 ); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.