input
stringlengths
358
16.1k
output
stringlengths
24
805
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many reshared tweets are there in Texas? [/INST]
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.State = 'Texas' AND T1.IsReshare = 'TRUE';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: For the tweet which got a reach number of 547851, which country did it come from? [/INST]
SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Reach = 547851;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: State the number of positive tweets from Ha Noi. [/INST]
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Sentiment > 0 AND T2.State = 'Ha Noi';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Show the text of the tweet with the highest klout from Connecticut. [/INST]
SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.State = 'Connecticut' ORDER BY T1.Klout DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many female Twitter users are there from Wisconsin? [/INST]
SELECT COUNT(T1.Likes) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Wisconsin' AND T3.Gender = 'Female';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the gender of the user who tweeted `tw-715909161071091712`? [/INST]
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.TweetID = 'tw-715909161071091712';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Give the name of the city of the user who tweeted `One of our favorite stories is @FINRA_News's move to the cloud with AWS Enterprise Support! https://amp.twimg.com/v/991837f1-4815-4edc-a88f-e68ded09a02a`. [/INST]
SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.text = 'One of our favorite stories is @FINRA_News''s move to the cloud with AWS Enterprise Support! https://amp.twimg.com/v/991837f1-4815-4edc-a88f-e68ded09a02a';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the gender of the user whose tweet got 535 retweets? [/INST]
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount = 535;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Give the gender of the user who made the highest klout tweet on Wednesdays. [/INST]
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Weekday = 'Wednesday' ORDER BY T1.Klout DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: For the tweet which got the most likes, state the gender of the user who tweeted it. [/INST]
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: State the number of tweets from Michigan on Thursdays. [/INST]
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Weekday = 'Thursday' AND T2.State = 'Michigan';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Which state was the tweet `tw-685681052912873473` from? Give the state code. [/INST]
SELECT T2.StateCode FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.TweetID = 'tw-685681052912873473';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the percentage of male Twitter users from Florida? [/INST]
SELECT SUM(CASE WHEN T3.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS percentage FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Florida';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the percentage of the tweets from California are positive? [/INST]
SELECT SUM(CASE WHEN T1.Sentiment > 0 THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS percentage FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE State = 'California';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the day of the week that tweet with ID tw-682712873332805633 was posted? [/INST]
SELECT Weekday FROM twitter WHERE TweetID = 'tw-682712873332805633';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many unique users have seen tweet with text `Happy New Year to all those AWS instances of ours!`? [/INST]
SELECT Reach FROM twitter WHERE text = 'Happy New Year to all those AWS instances of ours!';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Count the total number of tweet IDs in `en`. [/INST]
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Lang = 'en';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Is 3751 the location ID for tweet with ID tw-682714048199311366? [/INST]
SELECT LocationID FROM twitter WHERE TweetID = 'tw-682714048199311366';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many tweets have been posted on Wednesday? [/INST]
SELECT COUNT(TweetID) FROM twitter WHERE Weekday = 'Wednesday';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: List down all of the texts posted on Twitter on Thursday. [/INST]
SELECT text FROM twitter WHERE Weekday = 'Thursday';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the gender of the user who posted a tweet with ID tw-682714583044243456? [/INST]
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.TweetID = 'tw-682714583044243456';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: List down the text of tweets posted by unknown gender users. [/INST]
SELECT T1.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Unknown';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Calculate the total number of male tweet IDs. [/INST]
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What gender of users posted the most tweets in `en`? [/INST]
SELECT T.Gender FROM ( SELECT T2.Gender, COUNT( text) AS num FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'en' GROUP BY T2.Gender ) T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What gender of users retweet more than 30 times? [/INST]
SELECT DISTINCT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount > 30;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many female users reshared their tweets? [/INST]
SELECT COUNT(T1.UserID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Female' AND T1.IsReshare = 'TRUE';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Which country's tweets collected the most likes? [/INST]
SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Likes) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID GROUP BY T2.Country ) T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Tweet with ID tw-682723090279841798 was posted from which country? [/INST]
SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TweetID = 'tw-682723090279841798';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: List down all the tweet text posted from Australia. [/INST]
SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Australia';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Write down the tweet text posted from Rawang, Selangor, Malaysia. [/INST]
SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City = 'Rawang' AND T2.State = 'Selangor' AND T2.Country = 'Malaysia';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Tweets that were posted from Brazil are in what languague? [/INST]
SELECT DISTINCT T1.Lang FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Brazil';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: State the country where the most positive sentiment tweets were posted. [/INST]
SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Sentiment) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Sentiment > 0 GROUP BY T2.Country ) T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Calculate the total likes collected by tweets in `ru` posted by male users. [/INST]
SELECT SUM(T1.Likes) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'ru' AND T2.Gender = 'Male';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Calculate the average number of male users who posted tweets in a week. [/INST]
SELECT COUNT(DISTINCT T1.TweetID) / COUNT(DISTINCT T1.UserID) / 7 AS avg FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Day BETWEEN 1 AND 31;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many tweets have a klout of over 50? [/INST]
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Klout > 50;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Please list the texts of all the tweets that are not in English. [/INST]
SELECT text FROM twitter WHERE Lang != 'en';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Please give the user ID of the user who has posted the most tweets. [/INST]
SELECT UserID FROM twitter GROUP BY UserID ORDER BY COUNT(DISTINCT TweetID) DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Among all the tweets posted on Mondays, how many of them are reshared? [/INST]
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Weekday = 'Monday' AND IsReshare = 'TRUE';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Please list the texts of the top 3 tweets with the most number of unique users seeing the tweet. [/INST]
SELECT text FROM twitter ORDER BY Reach DESC LIMIT 3;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many reshared tweets have over 100 likes? [/INST]
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE IsReshare = 'TRUE' AND Likes > 100;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the total number of tweets sent by male users on Mondays? [/INST]
SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the gender of the user who has posted the tweet that got the most likes? [/INST]
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Please list the texts of all the tweets in French posted by male users. [/INST]
SELECT T1.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Lang = 'fr';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many tweets in French were posted from Australia? [/INST]
SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Lang = 'fr' AND T2.Country = 'Australia';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Among all the tweets with a positive sentiment, how many of them were posted by male users in Australia? [/INST]
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.Country = 'Australia' AND T3.Gender = 'Male' AND T1.Sentiment > 0;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: How many more tweets with a positive sentiment than the tweets with a neutral sentiment were posted by male users? [/INST]
SELECT SUM(CASE WHEN T1.Sentiment > 0 THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Sentiment = 0 THEN 1 ELSE 0 END) AS diff FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: From which city was the tweet with the most number of retweets posted? [/INST]
SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID ORDER BY T1.RetweetCount DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: From which city were more tweets posted, Bangkok or Chiang Mai? [/INST]
SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN T2.City = 'Chiang Mai' THEN 1 ELSE 0 END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai');
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Among the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st? [/INST]
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Please list the top 3 cities with the most number of tweets posted in Canada. [/INST]
SELECT T.City FROM ( SELECT T2.City, COUNT(T1.TweetID) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Canada' GROUP BY T2.City ) T ORDER BY T.num DESC LIMIT 3;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Please list all the cities from where tweets with neutral sentiments were posted. [/INST]
SELECT DISTINCT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE Sentiment = 0;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Among all the tweets sent by male users in Argentina, what is the text of the one with the most number of likes? [/INST]
SELECT T2.text FROM user AS T1 INNER JOIN twitter AS T2 ON T1.UserID = T2.UserID INNER JOIN location AS T3 ON T2.LocationID = T3.LocationID WHERE T3.Country = 'Argentina' AND T1.Gender = 'Male' ORDER BY T2.Likes DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: What is the average number of likes for a tweet posted by a male user on Mondays? [/INST]
SELECT SUM(T1.Likes) / COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday';
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key Country [ TEXT ] State [ TEXT ] StateCode [ TEXT ] City [ TEXT ] user : UserID [ TEXT ] primary_key Gender [ TEXT ] twitter : TweetID [ TEXT ] primary_key Weekday [ TEXT ] Hour [ INTEGER ] Day [ INTEGER ] Lang [ TEXT ] IsReshare [ TEXT ] Reach [ INTEGER ] RetweetCount [ INTEGER ] Likes [ INTEGER ] Klout [ INTEGER ] Sentiment [ REAL ] text [ TEXT ] LocationID [ INTEGER ] twitter.LocationID = location.LocationID UserID [ TEXT ] twitter.UserID = user.UserID Please write me a SQL statement that answers the following question: Tweets posted from which city has a higher number of average likes, Bangkok or Chiang Mai? [/INST]
SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN Likes ELSE NULL END) / COUNT(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN City = 'Chiang Mai' THEN Likes ELSE NULL END) / COUNT(CASE WHEN City = 'Chiang Mai' THEN TweetID ELSE NULL END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai');
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which course is more difficult, Intro to BlockChain or Computer Network? [/INST]
SELECT name FROM course WHERE name = 'Intro to BlockChain' OR name = 'Computer Network' ORDER BY diff DESC LIMIT 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Please list the names of the courses that are less important than Machine Learning Theory. [/INST]
SELECT name FROM course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many professors are more popular than Zhou Zhihua? [/INST]
SELECT COUNT(prof_id) FROM prof WHERE popularity > ( SELECT popularity FROM prof WHERE first_name = 'Zhihua' AND last_name = 'Zhou' );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the phone number of Kerry Pryor? [/INST]
SELECT phone_number FROM student WHERE l_name = 'Pryor' AND f_name = 'Kerry';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which professor advised Faina Mallinar to become a research assistant? Please give his or her full name. [/INST]
SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Faina' AND T3.l_name = 'Mallinar';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many research assistants does Sauveur Skyme have? [/INST]
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Sauveur' AND T2.last_name = 'Skyme';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Please list the full names of all the students who are research assistants with the highest research capability. [/INST]
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability = 5;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many research assistants of Ogdon Zywicki have an average salary? [/INST]
SELECT COUNT(T1.prof_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T1.salary = 'med' AND T2.last_name = 'Zywicki';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Please list the full names of all the students who took the course Machine Learning Theory. [/INST]
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the students who got a B in the course Machine Learning Theory, how many of them have a gpa of over 3? [/INST]
SELECT COUNT(student_id) FROM registration WHERE grade = 'B' AND student_id IN ( SELECT student_id FROM student WHERE gpa > 3 AND course_id IN ( SELECT course_id FROM course WHERE name = 'Machine Learning Theory' ) );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Please list the names of the courses taken by Laughton Antonio. [/INST]
SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.f_name = 'Laughton' AND T1.l_name = 'Antonio';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which student failed the course Intro to Database 2? Please give his or her full name. [/INST]
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade IS NULL AND T3.name = 'Intro to Database 2';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which student is more satisfied with the course Machine Learning Theory, Willie Rechert or Laughton Antonio? [/INST]
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE (T1.f_name = 'Laughton' OR T1.f_name = 'Willie') AND (T1.l_name = 'Antonio' OR T1.l_name = 'Rechert') AND T3.name = 'Machine Learning Theory' ORDER BY T2.sat DESC LIMIT 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the professors who have more than 3 research assistants, how many of them are male? [/INST]
SELECT COUNT(*) FROM ( SELECT T2.prof_id FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.gender = 'Male' GROUP BY T1.prof_id HAVING COUNT(T1.student_id) > 3 );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the students who took the course Machine Learning Theory, how many of them are undergraduates? [/INST]
SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory' AND T1.type = 'UG';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which professor advised Willie Rechert to work as a research assistant? Please give his or her full name. [/INST]
SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Willie' AND T3.l_name = 'Rechert';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the average gpa of Ogdon Zywicki's research assistants? [/INST]
SELECT SUM(T3.gpa) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the average satisfying degree of the course Machine Learning Theory? [/INST]
SELECT CAST(SUM(T1.sat) AS REAL) / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Machine Learning Theory';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Give the number of research postgraduate students. [/INST]
SELECT COUNT(student_id) FROM student WHERE type = 'RPG';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which student has the highest gpa? Give the full name. [/INST]
SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: For the 3-credit course with the easiest difficulty, how many students get an "A" in that course? [/INST]
SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.credit = '3' AND T2.diff = 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many students took the hardest course? [/INST]
SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.diff = 5;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Which professor is Oliy Spratling working with? Give the full name. [/INST]
SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Oliy' AND T3.l_name = 'Spratling';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: For the professor who is working with Harrietta Lydford, how is his popularity? [/INST]
SELECT T1.popularity FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Harrietta' AND T3.l_name = 'Lydford';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many research assistants does the female professor with the lowest teaching ability have? [/INST]
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability = '1' AND T2.gender = 'Female';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: For the professors who advise more than 2 students, which professor has a higher teaching ability? Give the full name. [/INST]
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, T2.teachingability FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id HAVING COUNT(student_id) > 2 ) T ORDER BY T.teachingability DESC LIMIT 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Give the grade score for Rik Unsworth in "Computer Network". [/INST]
SELECT CASE grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 ELSE 1 END AS result FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE f_name = 'Rik' AND l_name = 'Unsworth' AND course_id IN ( SELECT course_id FROM course WHERE name = 'Computer Network' ) );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many courses does Alvera McQuillin take? [/INST]
SELECT COUNT(T1.course_id) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.f_name = 'Alvera' AND T2.l_name = 'McQuillin';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: State the name of research postgraduate student among Professor Zhihua Zhou's research assistants. [/INST]
SELECT T3.f_name, T3.l_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.first_name = 'Zhihua' AND T3.type = 'RPG' AND T1.last_name = 'Zhou';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Provide the number of students enrolled in the "Statistical Learning" course. [/INST]
SELECT COUNT(T2.student_id) FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T1.name = 'Statistical learning';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Who were the students who failed the course "Applied Deep Learning"? Give the full name. [/INST]
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Applied Deep Learning ' AND T2.grade IS NULL;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Give the phone number of the only student who obtained "A" in the course "Intro to BlockChain". [/INST]
SELECT T1.phone_number FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Intro to BlockChain' AND T2.grade = 'A';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage of Professor Ogdon Zywicki's research assistants are taught postgraduate students? [/INST]
SELECT CAST(SUM(CASE WHEN T3.type = 'TPG' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage of students who get a "B" in the course "Computer Network"? [/INST]
SELECT CAST(SUM(CASE WHEN T1.grade = 'B' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Computer Network';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many courses have the highest difficulty? [/INST]
SELECT COUNT(course_id) FROM course WHERE diff = 5;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the full name of the professor who graduated from an Ivy League School? [/INST]
SELECT first_name, last_name FROM prof WHERE graduate_from IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the most important courses, what is the name of the most difficult course? [/INST]
SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many students have the highest intelligence among those taking a bachelor's degree? [/INST]
SELECT COUNT(student_id) FROM student WHERE type = 'UG' AND intelligence = ( SELECT MAX(intelligence) FROM student );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the most popular professors, how many are females? [/INST]
SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many research postgraduate students are there? [/INST]
SELECT COUNT(student_id) FROM student WHERE type = 'RPG';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many students got an A in Applied Deep Learning? [/INST]
SELECT COUNT(T2.student_id) FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'A' AND T1.name = 'Applied Deep Learning ';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What are the GPAs of the unpaid Research Assistants? [/INST]
SELECT T2.gpa FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the easiest courses, what is the name of the course where most students got an A? [/INST]
SELECT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.diff = 1 GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many courses does the student with the highest GPA this semester take? [/INST]
SELECT COUNT(course_id) FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: How many students does Ogdon Zywicki advise? [/INST]
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the name of the course with the highest satisfaction from students? [/INST]
SELECT DISTINCT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.sat = 5;