input
stringlengths
193
2.69k
output
stringlengths
24
744
[INST] Here is a database schema: 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: 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 ] 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 ] 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 ] 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 ] 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 ] 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 ] 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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 ] 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: 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 ] 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 ] 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 ] 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 ] 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 ] 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: 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 ] 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 ] 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 ] 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: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ 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: 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: 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 ] 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: 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 ] 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: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] 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: 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 ] 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 ] 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 ] 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 ] 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 ] 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 ] 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: 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 ] 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 ] 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: 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 ] 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: 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 ] 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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: 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: 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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: 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 ] 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: 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 ] 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: 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 ] 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: 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 ] 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 ] 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: 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: 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 ] 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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 ] 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 ] 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: 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 ] 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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 ] 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: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ 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 ] 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: 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: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ 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: 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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: 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: 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 ] 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 ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] 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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] 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 names of the courses that the students with the lowest intelligence are least satisfied with? [/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 T2.sat = 1 AND T1.intelligence = 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] Please write me a SQL statement that answers the following question: Which of the two courses, "Advanced Operating System" or "Intro to BlockChain', did most of the students receive an A in? [/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.name IN ('Advanced Operating System', 'Intro to BlockChain') GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1;
[INST] Here is a database schema: 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 ] Please write me a SQL statement that answers the following question: What is the popularity of the professor who advises the highest number of students with the highest research ability? [/INST]
SELECT T2.popularity FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id, T1.capability ORDER BY COUNT(T1.student_id) DESC, T1.capability DESC LIMIT 1;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] Please write me a SQL statement that answers the following question: What is the average number of students who registered for the courses with a difficulty of 4? [/INST]
SELECT CAST(COUNT(T1.student_id) AS REAL) / COUNT(DISTINCT T2.course_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.diff = 4;
[INST] Here is a database schema: 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, who have a GPA between 3 to 4, failed a course? [/INST]
SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade IS NULL AND T1.gpa BETWEEN 3 AND 4;
[INST] Here is a database schema: 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 taking a bachelor's degree received an A in all of the courses that they took? [/INST]
SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade = 'A' AND T1.type = 'UG';
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] 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 the students with the highest research capability and high salary? List the full names of the students. [/INST]
SELECT AVG(T2.gpa), T2.f_name, T2.l_name FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T1.capability = 5 GROUP BY T2.student_id;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] Please write me a SQL statement that answers the following question: List the professors' IDs and students' IDs with the lowest research ability. [/INST]
SELECT prof_id, student_id FROM RA WHERE capability = ( SELECT MIN(capability) FROM RA );
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] Please write me a SQL statement that answers the following question: Name the professor who got graduation from the University of Boston. [/INST]
SELECT first_name, last_name FROM prof WHERE graduate_from = 'University of Boston';
[INST] Here is a database schema: registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] Please write me a SQL statement that answers the following question: List the courses' IDs and students' IDs who failed to pass the course. [/INST]
SELECT course_id, student_id FROM registration WHERE grade IS NULL OR grade = '';
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] Please write me a SQL statement that answers the following question: What is the male and female ratio among the professors? [/INST]
SELECT CAST(SUM(CASE WHEN gender = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) FROM prof;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] Please write me a SQL statement that answers the following question: Describe the names and credits of the least difficult courses. [/INST]
SELECT name, credit FROM course WHERE diff = ( SELECT MIN(diff) FROM course );
[INST] Here is a database schema: 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 ] 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: Describe the students' full names and GPAs under the supervision of the most popular professor. [/INST]
SELECT T3.f_name, T3.l_name, T3.gpa 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 ORDER BY T1.popularity DESC LIMIT 1;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] 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 full names and emails of unpaid research assistants. [/INST]
SELECT T2.f_name, T2.l_name, T2.email 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: 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 ] 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: List the research assistants' full names, capabilities and GPAs who were under the supervision of Merwyn Conkay. [/INST]
SELECT T3.f_name, T3.l_name, T2.capability, T3.gpa 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 = 'Merwyn' AND T1.last_name = 'Conkay';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] 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: Describe the students' full names and grades in Intro to BlockChain course. [/INST]
SELECT T1.f_name, T1.l_name, T2.grade 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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] 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 students registered for the most difficult course, list the students' full names who got grade A. [/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 = 'A' ORDER BY T3.diff DESC LIMIT 1;
[INST] Here is a database schema: 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 ] 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: Describe the full names and graduated universities of the professors who advised Olia Rabier. [/INST]
SELECT T1.first_name, T1.last_name, T1.graduate_from 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 = 'Olia' AND T3.l_name = 'Rabier';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] 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: Name the students of the Advanced Database Systems course with the highest satisfaction. [/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 = 'Advanced Database Systems' 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 ] 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: Calculate the GPA of the semester for Laughton Antonio. [/INST]
SELECT CAST(SUM(T3.credit * CASE T1.grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 WHEN 'D' THEN 1 ELSE 1 END) AS REAL) / COUNT(T3.credit) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.f_name = 'Laughton' AND T2.l_name = 'Antonio';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] 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 registered courses' names by undergraduate students with GPA of 3.7 and above. [/INST]
SELECT DISTINCT T1.f_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.type = 'UG' AND T1.gpa > 3.7;
[INST] Here is a database schema: 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 ] 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: Describe the names and capability of the students who were advised by professors from the University of Washington. [/INST]
SELECT T3.f_name, T3.l_name, T2.capability 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.graduate_from = 'University of Washington';
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] 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: Describe the full names, emails and intelligence of the students with the highest capability and salary. [/INST]
SELECT f_name, l_name, email, intelligence FROM student WHERE student_id IN ( SELECT student_id FROM RA WHERE salary = 'high' AND capability = ( SELECT MAX(capability) FROM RA ) );
[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: Mention the names and credits of course registered by the students who were under the supervision of female professor with the highest teaching ability. [/INST]
SELECT T5.name, T5.credit 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 INNER JOIN registration AS T4 ON T3.student_id = T4.student_id INNER JOIN course AS T5 ON T4.course_id = T5.course_id WHERE T2.gender = 'Female' ORDER BY T2.teachingability DESC LIMIT 1;