context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which apps have multiple genres and what is the total sentiment subjectivity of these apps?
SELECT SUM(T2.Sentiment_Subjectivity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres > 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which apps have not been updated since year 2015 and what kind of sentiment users hold on it?
SELECT DISTINCT App, Sentiment FROM user_reviews WHERE App IN ( SELECT App FROM playstore WHERE CAST(SUBSTR('Last Updated', -4, 4) AS INTEGER) < 2015 )
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the total installs of apps with content rating of adults only 18+ and what are the translated reviews of it?
SELECT SUM(T1.Installs), T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1."Content Rating" = 'Adults only 18+'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which of the app is the best selling app and what is the sentiments polarity of it?
SELECT T1.App, T2.Sentiment_Polarity FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App ORDER BY T1.Price * CAST(REPLACE(REPLACE(Installs, ',', ''), '+', '') AS INTEGER) DESC LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the average rating of comic category apps? How many users hold positive attitude towards this app?
SELECT AVG(T1.Rating) , COUNT(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE NULL END) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Category = 'COMICS'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the rating for "Draw A Stickman"?
SELECT Rating FROM playstore WHERE APP = 'Draw A Stickman'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
How many of the reviews for the app "Brit + Co" have a comment?
SELECT COUNT(App) FROM user_reviews WHERE App = 'Brit + Co' AND Translated_Review IS NOT NULL
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List the top 5 shopping apps with the most reviews.
SELECT DISTINCT App FROM playstore WHERE Genres = 'Shopping' GROUP BY App ORDER BY COUNT(App) DESC LIMIT 5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
How many neutral reviews does the app "Dino War: Rise of Beasts" have?
SELECT COUNT(App) FROM user_reviews WHERE App = 'Dino War: Rise of Beasts' AND Sentiment = 'Neutral'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What are the apps with only 5,000+ installs?
SELECT DISTINCT App FROM playstore WHERE Installs = '5,000+'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List all the negative comments on the "Dog Run - Pet Dog Simulator" app.
SELECT Translated_Review FROM user_reviews WHERE App = 'Dog Run - Pet Dog Simulator' AND Sentiment = 'Negative'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which free app has the most Negative comments?
SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY COUNT(T2.Sentiment) DESC LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
How many negative comments are there in all the apps with 100,000,000+ installs?
SELECT COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '100,000,000+' AND T2.Sentiment = 'Negative'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What are the content ratings for the apps that have "gr8" in their comments?
SELECT DISTINCT T1.`Content Rating` FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Translated_Review LIKE '%gr8%'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the total Sentiment polarity score of the most expensive app?
SELECT SUM(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Price = ( SELECT MAX(Price) FROM playstore )
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the rating for "Garden Coloring Book"? List all of its reviews.
SELECT T1.Rating, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Garden Coloring Book'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which Photography app has the highest total Sentiment subjectivity score?
SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Photography' GROUP BY T1.App ORDER BY SUM(T2.Sentiment_Subjectivity) DESC LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List all the comments on the lowest rated Mature 17+ app.
SELECT T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1."Content Rating" = 'Mature 17+' ORDER BY T1.Rating LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the number of installments of the app with the highest total Sentiment polarity score?
SELECT T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App GROUP BY T1.App ORDER BY SUM(T2.Sentiment_Polarity) DESC LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the number of neutral comments from all the weather apps?
SELECT COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Weather' AND T2.Sentiment = 'Neutral'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which 1,000,000,000+ intalls apps has the most no comment reviews?
SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '1,000,000+' AND T2.Translated_Review = 'nan' GROUP BY T1.App ORDER BY COUNT(T2.Translated_Review) DESC LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the rating and the total Sentiment subjectivity score of "Onefootball - Soccer Scores"?
SELECT T1.Rating, SUM(T2.Sentiment_Subjectivity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Onefootball - Soccer Scores'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What percentage of no comment reviews are from "Teen" content rating apps?
SELECT CAST(COUNT(CASE WHEN T1.`Content Rating` = 'Teen' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Translated_Review = 'nan'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which apps have 5 rating? List out then application name.
SELECT DISTINCT App FROM playstore WHERE Rating = 5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which apps have been reviewed more than 75 000 000 times and the content is suitable for teenagers?
SELECT DISTINCT App FROM playstore WHERE Reviews > 75000000 AND `Content Rating` = 'Teen'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List out genre that have downloads more than 1000000000.
SELECT Genres FROM playstore WHERE Installs = '1,000,000,000+' GROUP BY Genres
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the average price for a dating application?
SELECT AVG(Price) FROM playstore WHERE Genres = 'Dating'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the average download for entertainment apps with size no more than 1.0 M?
SELECT AVG(CAST(REPLACE(REPLACE(Installs, ',', ''), '+', '') AS INTEGER)) FROM playstore WHERE Category = 'ENTERTAINMENT' AND Size < '1.0M'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the average review number for application with 5 rating?
SELECT AVG(Reviews) FROM playstore WHERE Rating = 5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List out the top 3 genre for application with a sentiment review greater than 0.5.
SELECT Genres FROM playstore WHERE App IN ( SELECT App FROM user_reviews WHERE Sentiment = 'Positive' AND Sentiment_Polarity > 0.5 ORDER BY Sentiment_Polarity DESC LIMIT 3 )
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the percentage of application with 4.7 rating having more positives sentiment than negative sentiment?
SELECT CAST(COUNT(CASE WHEN ( SELECT COUNT(CASE WHEN Sentiment = 'Positive' THEN 1 ELSE NULL END) - COUNT(CASE WHEN Sentiment = 'Negative' THEN 1 ELSE NULL END) FROM user_reviews GROUP BY App ) > 0 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Rating = 4.7
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List down app that does not have negative sentiment and give their average rating?
SELECT T1.App, AVG(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment != 'Negative' GROUP BY T1.App
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List down application that have not been updated since 2015. What is the percentage of this application having more negative sentiment than positive sentiment?
SELECT CAST((( SELECT COUNT(*) Po FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE SUBSTR(T1."Last Updated", -4, 4) > '2015' AND T2.Sentiment = 'Positive' ) - ( SELECT COUNT(*) Ne FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE SUBSTR(T1."Last Updated", -4, 4) > '2015' AND T2.Sentiment = 'Negative' )) AS REAL) * 100 / ( SELECT COUNT(*) NUM FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE SUBSTR(T1."Last Updated", -4, 4) > '2015' )
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the percentage for free application with a rating 4.5 and above have not been updated since 2018?
SELECT CAST(SUM(CASE WHEN SUBSTR('Last Updated', -4) > '2018' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(App) PER FROM playstore WHERE Type = 'Free' AND Rating >= 4.5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What genre does Honkai Impact 3rd belong to?
SELECT DISTINCT Genres FROM playstore WHERE App = 'Honkai Impact 3rd'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List down the rating for the App Learn C++.
SELECT DISTINCT Rating FROM playstore WHERE App = 'Learn C++'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the average price of games belonging in the arcade genre which has a content rating of Everyone 10+?
SELECT AVG(Price) FROM playstore WHERE 'Content Rating' = 'Everyone 10+' AND Genres = 'Arcade'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
How much is the size of Browser 4G and how many users have a pretty positive favorability on it?
SELECT T1.Size, COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Browser 4G' AND T2.Sentiment_Polarity >= 0.5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Name the Apps with a sentiment objectivity of 0.3 and include their number of installs.
SELECT DISTINCT T1.App, T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity = 0.3
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
How much is the average sentiment polarity score of Golf GPS Rangefinder: Golf Pad and what is it's rating in the Google Play Store?
SELECT AVG(T2.Sentiment_Polarity), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Golf GPS Rangefinder: Golf Pad'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List the top 5 lowest rated puzzle games and count the number of negative sentiments the games received.
SELECT T1.App, COUNT(T1.App) COUNTNUMBER FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY T1.Rating LIMIT 5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the percentage ratio between positive sentiments and negative sentiments that are in Fate/Grand Order? Also indicate the current version.
SELECT CAST(SUM(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Sentiment = 'Negative' THEN 1 ELSE 0 END), T1.`Current Ver` FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Fate/Grand Order (English)' AND T1.`Current Ver` = '1.18.0'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Indicate the number of installs and include the percentage of positive sentiments of FREEDOME VPN Unlimited anonymous Wifi Security.
SELECT T1.Installs , CAST(SUM(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE 0 END) * 100 / SUM(CASE WHEN T2.Sentiment IS NOT NULL THEN 1.0 ELSE 0 END) AS REAL) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'FREEDOME VPN Unlimited anonymous Wifi Security'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
For the Honkai Impact 3rd App, what is the highest sentiment polarity score and what genre does it belong to?
SELECT MAX(T2.Sentiment_Polarity), T1.Genres FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Honkai Impact 3rd' AND T2.Sentiment_Polarity > 0.5 GROUP BY T1.Genres
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the rating of Dragon Ball Legends and how many users dislike this App?
SELECT T1.Rating, COUNT(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Dragon Ball Legends' AND CAST(Sentiment_Polarity AS INTEGER) < -0.5
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Which education App has the worst rating and state the translated review if available.
SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Category = 'EDUCATION' GROUP BY T1.App, T2.Translated_Review ORDER BY T1.Rating ASC LIMIT 1
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
List all free sports Apps and their translated review.
SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T1.Category = 'SPORTS'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
Among the role playing game genre, how many are targeted to teens and what is their average sentiment polarity score?
SELECT COUNT(T1.App), AVG(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1."Content Rating" = 'Teen' AND T1.Genres = 'Role Playing'
bird
CREATE TABLE app_store (App text, Category text, Rating real, Reviews integer, Size text, Installs text, Type text, Price text, Content Rating text, Genres text, App text, Translated_Review text, Sentiment text, Sentiment_Polarity text, Sentiment_Subjectivity text)
What is the average rating of Apps falling under the racing genre and what is the percentage ratio of positive sentiment reviews?
SELECT AVG(T1.Rating), CAST(COUNT(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Racing'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Which region has the most number of sales team?
SELECT Region FROM `Sales Team` GROUP BY Region ORDER BY COUNT(DISTINCT `Sales Team`) DESC LIMIT 1
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List all the customers with name containing the word 'Group'.
SELECT T FROM ( SELECT IIF(`Customer Names` LIKE '%Group%', `Customer Names`, NULL) AS T FROM Customers ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
What is the average median income for all City type of stores?
SELECT AVG(`Median Income`) FROM `Store Locations` WHERE Type = 'City'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Name the sales team and the region of order number 'SO - 000137'.
SELECT T2.`Sales Team`, T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderNumber = 'SO - 000137'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List all the order numbers along with its product name for each order under the sales team of 'Douglas Tucker'.
SELECT DISTINCT T1.ProductID, T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T3.`Sales Team` = 'Douglas Tucker'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Among orders in 2020, name the customers who had the greatest discount applied for 'Cocktail Glasses'
SELECT DISTINCT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND SUBSTR(T2.OrderDate, -2) = '20' AND T2.`Discount Applied` = ( SELECT T2.`Discount Applied` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Discount Applied` DESC LIMIT 1 )
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List all the order numbers for In-Store sales and find the city where the store is located.
SELECT DISTINCT T1.OrderNumber, T2.`City Name` FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.`Sales Channel` = 'In-Store'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Name the most expensive ordered? Who, when was it ordered?
SELECT T2.OrderNumber, T1.`Customer Names`, T2.OrderDate FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID ORDER BY T2.`Unit Cost` DESC LIMIT 1
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List all the numbers ordered by 'Rochester Ltd' in 2018.
SELECT DISTINCT T FROM ( SELECT CASE WHEN T1.OrderDate LIKE '%/%/18' AND T2.`Customer Names` = 'Rochester Ltd' THEN T1.OrderNumber ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN Customers T2 ON T2.CustomerID = T1._CustomerID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Provide all the orders from WARE-NMK1003. Name the product and sales team for each of these order.
SELECT DISTINCT T1.`Product Name`, T3.`Sales Team` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.WarehouseCode = 'WARE-NMK1003'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List the name of all customers who had made orders online.
SELECT T FROM ( SELECT CASE WHEN T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` ELSE NULL END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Calculate the average net profit for bakeware product.
SELECT AVG(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Bakeware'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Name the sales team name who had orders with the greatest net profit in 2020.
SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/20' GROUP BY T2.`Sales Team` ORDER BY SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) DESC LIMIT 1
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Sate the order number and calculate the net profit for each order under Joshua Bennett.
SELECT T1.OrderNumber , REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'Joshua Bennett'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Among the sales order shipped in July 2018, calculate the percentage of orders for home fragrances.
SELECT SUM(CASE WHEN T2.`Product Name` = 'Home Fragrances' THEN 1 ELSE 0 END) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.ShipDate LIKE '7/%/18'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List down the customer IDs and names that start with alphabet "W".
SELECT DISTINCT CustomerID, `Customer Names` FROM Customers WHERE `Customer Names` LIKE 'W%' ORDER BY `Customer Names` DESC
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List down the product IDs and names that include the word "Outdoor".
SELECT ProductID, T FROM ( SELECT ProductID , CASE WHEN `Product Name` LIKE '%Outdoor%' THEN `Product Name` ELSE NULL END AS T FROM Products ) WHERE T IS NOT NULL ORDER BY T DESC
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Among the sales with 40% discount via in-store channel, how many products were shipped from warehouse code of WARE-NMK1003?
SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN `Sales Channel` = 'In-Store' AND WarehouseCode = 'WARE-NMK1003' AND `Discount Applied` = '0.4' THEN OrderNumber ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Mention the most populated city and median income of the store in Florida state.
SELECT `City Name`, `Median Income` FROM `Store Locations` WHERE State = 'Florida' ORDER BY Population DESC LIMIT 1
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Describe the ID, city and region of the stores which are in Allen country.
SELECT DISTINCT T2.StoreID, T2.`City Name`, T1.Region FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.County = 'Allen County'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List the ID, city, state and region for the store type which is fewer between borough and CDP.
SELECT DISTINCT T2.StoreID, T2.`City Name`, T1.State, T2.Type FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.Type = 'Borough' OR T2.Type = 'CDP'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Write down the region and name of the sale team ID of 18 and compare their orders between in-store and online.
SELECT T2.Region, T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.SalesTeamID = 18 AND T1.`Sales Channel` = 'In-Store' OR T1.`Sales Channel` = 'Online'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Calculate the percentage of order via in-store channel of customer "Medline".
SELECT CAST(SUM(CASE WHEN T1.`Sales Channel` = 'In-Store' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1._CustomerID) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Medline '
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Describe the customer names and lasting delivery periods for the product of "Bedroom Furniture" by wholesale channel in 2019.
SELECT T1.`Customer Names`, T2.DeliveryDate FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T2.`Sales Channel` = 'Wholesale' AND T3.`Product Name` = 'Bedroom Furniture' AND T2.OrderDate LIKE '%/%/19'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Describe the customer names and product names which had over 3800 USD in net profit.
SELECT DISTINCT `Customer Names`, `Product Name` FROM ( SELECT T1.`Customer Names`, T3.`Product Name` , REPLACE(T2.`Unit Price`, ',', '') - REPLACE(T2.`Unit Cost`, ',', '') AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T > 3800
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List the store located cities with regions in no water area of California state.
SELECT DISTINCT T2.`City Name` FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'California' AND T2.`Water Area` = '0'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Calculate the order percentage by "Carlos Miller" sales team.
SELECT CAST(SUM(CASE WHEN T2.`Sales Team` = 'Carlos Miller' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Compare the number of orders between "Platters" and "Serveware" products.
SELECT SUM(CASE WHEN T2.`Product Name` = 'Platters' THEN 1 ELSE 0 END) AS num1 , SUM(CASE WHEN T2.`Product Name` = 'Serveware' THEN 1 ELSE 0 END) AS num2 FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Calculate the total net profit of the store located in highest median income city.
SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY T2.`Median Income` DESC LIMIT 1
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Among the sales team in South region, write down the numbers of orders made by the sales team ID of one digit.
SELECT COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'South' AND T2.SalesTeamID BETWEEN 1 AND 9 GROUP BY T2.SalesTeamID HAVING COUNT(T1.OrderNumber)
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
How many orders have order date in 5/31/2018?
SELECT SUM(IIF(OrderDate = '5/31/18', 1, 0)) FROM `Sales Orders`
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List out the name of orders which have delivery date of 6/13/2018.
SELECT DISTINCT T FROM ( SELECT IIF(DeliveryDate = '6/13/18', OrderNumber, NULL) AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
How many orders placed were with more than 5 product quantities?
SELECT SUM(IIF(`Order Quantity` > 5, 1, 0)) FROM `Sales Orders`
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
State the full name of state code "GA".
SELECT T FROM ( SELECT IIF(StateCode = 'GA', State, NULL) AS T FROM Regions ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
How many states located in the Midwest region?
SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN StateCode ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List out the product name of order which has unit cost of 781.22.
SELECT T FROM ( SELECT DISTINCT IIF(T1.`Unit Cost` = 781.22, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
State the delivery date of cookware.
SELECT T FROM ( SELECT DISTINCT IIF(T2.`Product Name` = 'Cookware', T1.DeliveryDate, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
How many furniture cushions orders which have date of order in 2018?
SELECT SUM(CASE WHEN T1.OrderDate LIKE '%/%/18' AND T2.`Product Name` = 'Furniture Cushions' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List out the name of products which have been applied 10% discount.
SELECT T FROM ( SELECT DISTINCT IIF(T1.`Discount Applied` = 0.1, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Calculate the average net profit of phones which have sales channel of distributor.
SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Phones' AND T1.`Sales Channel` = 'Distributor'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Calculate the average net profit of bar tools which has ordered quantity exceed 5.
SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Bar Tools' AND T1.`Order Quantity` > 5
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List out the city name of states located in South region.
SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.Region = 'South' THEN T2.`City Name` END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
What is the region of stores which have type of "Town" in the list?
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.Type = 'Town' THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
How many orders that Medsep Group had made?
SELECT SUM(CASE WHEN T1.`Customer Names` = 'Medsep Group' THEN 1 ELSE 0 END) FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
List out the discount levels applied for all orders from Ole Group.
SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.`Customer Names` = 'Ole Group' THEN T2.`Discount Applied` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
State the customer name of orders which has shipped date in 7/8/2018.
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.ShipDate = '7/8/18' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Among the orders placed by Ei, how many orders have quantity greater than 4?
SELECT SUM(CASE WHEN T1.`Order Quantity` > 4 AND T2.`Customer Names` = 'Ei ' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Among the orders placed by Pacific Ltd, how many orders have been applied 5% discount ?
SELECT SUM(CASE WHEN T1.`Discount Applied` = 0.05 AND T2.`Customer Names` = 'Pacific Ltd' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
What is the customer names of orders which have unit cost greater than 4000USD?
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Unit Cost` > 4000 THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Please list the id and detailed position of all stores in Birmingham city.
SELECT StoreID, Latitude, Longitude FROM `Store Locations` WHERE `City Name` = 'Birmingham'
bird
CREATE TABLE regional_sales (CustomerID integer, Customer Names text, ProductID integer, Product Name text, StateCode text, State text, Region text, SalesTeamID integer, Sales Team text, Region text, StoreID integer, City Name text, County text, StateCode text, State text, Type text, Latitude real, Longitude real, AreaCode integer, Population integer, Household Income integer, Median Income integer, Land Area integer, Water Area integer, Time Zone text, OrderNumber text, Sales Channel text, WarehouseCode text, ProcuredDate text, OrderDate text, ShipDate text, DeliveryDate text, CurrencyCode text, _SalesTeamID integer, _CustomerID integer, _StoreID integer, _ProductID integer, Order Quantity integer, Discount Applied real, Unit Price text, Unit Cost text)
Which city has the largest population?
SELECT `City Name` FROM `Store Locations` ORDER BY Population DESC LIMIT 1
bird