db_id stringclasses 68 values | question stringlengths 24 325 | evidence stringlengths 0 580 | SQL stringlengths 23 728 |
|---|---|---|---|
trains | Among the trains running west, how many trains have no more than one car with an open roof? | running west refers to direction = 'west'; open roof refers to roof = 'none' | SELECT SUM(CASE WHEN T1.direction = 'west' THEN 1 ELSE 0 END)as count FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) FROM cars WHERE roof = 'none' GROUP BY train_id HAVING COUNT(id) = 1 ) AS T2 ON T1.id = T2.train_id |
trains | How many trains with fully loaded head cars are running east? | fully loaded refers to load_num = 3; head cars refers to position = 1 | SELECT COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T1.load_num = 3 |
trains | How many cars running east have double-sided tail cars? | east is an direction; double-sided refers to sides = 'double'; tail refers to carsposition = trailPosi | SELECT COUNT(T1.id) FROM trains AS T1 INNER JOIN cars AS T2 ON T1.id = T2.train_id INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T3 ON T1.id = T3.train_id WHERE T1.direction = 'east' AND T2.position = T3.trailPosi AND T2.sides = 'double' |
trains | List all the directions of the trains that have empty cars. | empty cars refers to load_num = 0 | SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.load_num = 0 |
trains | Among the trains running west, how many trains have three-wheeled, jagged roof cars? | west is an direction; three-wheeled refers to wheels = 3; jagged roof refers to roof = 'jagged' | SELECT SUM(CASE WHEN T2.direction = 'west' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.wheels = 3 AND T1.roof = 'jagged' |
trains | Provide the directions for all the trains that have 2 or less cars. | 2 or less cars refers to trailPosi < = 2 | SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T2.trailPosi <= 2 |
movie | How many movies star a male African American actor? | male refers to gender = 'Male'; African American refers to ethnicity = 'African American' | SELECT COUNT(*) FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T2.Gender = 'Male' AND T2.Ethnicity = 'African American' |
movie | How much longer in percentage is the screen time of the most important character in Batman than the least important one? | most important character refers to max(screentime); least important character refers to min(screentime); movie Batman refers to title = 'Batman'; percentage = divide(subtract(max(screentime) , min(screentime)) , min(screentime)) * 100% | SELECT (MAX(CAST(SUBSTR(T2.screentime, 3, 2) AS REAL)) - MIN(CAST(SUBSTR(T2.screentime, 3, 2) AS REAL))) * 100 / MIN(CAST(SUBSTR(T2.screentime, 3, 2) AS REAL)) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Batman' |
movie | Which movie had the biggest budget? Give the name of the movie. | biggest budget refers to max(Budget); name of the movie refers to Title | SELECT Title FROM movie ORDER BY Budget DESC LIMIT 1 |
movie | How many movies has the highest networth actor acted in? | highest networth refers to max(networth) | SELECT COUNT(*) FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE CAST(REPLACE(REPLACE(T2.NetWorth, ',', ''), '$', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(REPLACE(NetWorth, ',', ''), '$', '') AS REAL)) FROM actor) |
movie | List down the movie ID of movie with a budget of 15000000 and a rating between 7 to 8. | a budget of 15000000 refers to Budget = 15000000; rating between 7 to 8 refers to Rating BETWEEN 7 and 8 | SELECT MovieID FROM movie WHERE Rating BETWEEN 7 AND 8 AND Budget = 15000000 |
movie | In romantic movies, how many of them starred by John Travolta? | romantic movies refers to Genre = 'Romance'; starred by John Travolta refers to Name = 'John Travolta' | SELECT COUNT(*) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Genre = 'Romance' AND T3.Name = 'John Travolta' |
social_media | How many tweets are in English? | english is the language and refers to Lang = 'en' | SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Lang = 'en' |
social_media | Please list the texts of all the tweets that are reshared. | reshared refers to Isreshare = 'TRUE' | SELECT text FROM twitter WHERE IsReshare = 'TRUE' |
social_media | How many tweets are seen by more than 1000 unique users? | seen by more than 1000 unique users refers to Reach > 1000 | SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Reach > 1000 |
social_media | Among all the tweets that have a positive sentiment, how many of them are posted on Thursday? | positive sentiment refers to Sentiment > 0; posted on Thursday refers to Weekday = 'Thursday' | SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Sentiment > 0 AND Weekday = 'Thursday' |
social_media | What is the text of the tweet that got the most `likes`? | got the most like refers to Max(Likes) | SELECT text FROM twitter WHERE Likes = ( SELECT MAX( Likes) FROM twitter ) |
social_media | Please list all the cities in Argentina. | "Argentina" is the Country | SELECT City FROM location WHERE City IS NOT NULL AND Country = 'Argentina' |
social_media | How many tweets in total were posted by a user in Argentina? | "Argentina" is the Country | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country = 'Argentina' LIMIT 1 |
social_media | Users in which city of Argentina post the most tweets? | "Argentina" is the Country; post the most tweets refers to Max(Count(TweetID)) | SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country = 'Argentina' GROUP BY T2.City ORDER BY COUNT(T1.TweetID) DESC LIMIT 1 |
social_media | Among all the tweets that are reshared, how many of them are posted by a user in Buenos Aires? | reshared refers to Isreshare = 'TRUE'; 'Buenos Aires' is the City | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.City = 'Buenos Aires' AND T1.IsReshare = 'TRUE' |
social_media | Please list the texts of all the tweets posted from Buenos Aires with a positive sentiment. | "Buenos Aires" is the City; positive sentiment refers to Sentiment > 0 | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Sentiment > 0 AND T2.City = 'Buenos Aires' |
social_media | From which country is the tweet with the most likes posted? | tweet with the most likes refers to Max(Likes) | SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID ORDER BY T1.Likes DESC LIMIT 1 |
social_media | Users in which country has posted more numbers of positive tweets, Argentina or Australia? | "Argentina" and "Australia" are both Country; positive tweets refers to Sentiment > 0; Country posted more number of tweets refers to Country where Max(Count(TweetID)) | SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country IN ('Argentina', 'Australia') AND T1.Sentiment > 0 GROUP BY T2.Country ORDER BY COUNT(T1.TweetID) DESC LIMIT 1 |
social_media | Among all the tweets posted from Buenos Aires, how many of them were posted on Thursdays? | "Buenos Aires" is the City; posted on Thursday refers to Weekday = 'Thursday' | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.City = 'Buenos Aires' AND T1.Weekday = 'Thursday' |
social_media | What is the average number of tweets posted by the users in a city in Argentina? | "Argentina" is the Country; average number of tweets in a city = Divide (Count(TweetID where Country = 'Argentina'), Count (City)) | SELECT SUM(CASE WHEN T2.City = 'Buenos Aires' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS avg FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country = 'Argentina' |
social_media | State the number of states in the United Kingdom. | "United Kingdom" is the Country | SELECT COUNT(State) AS State_number FROM location WHERE Country = 'United Kingdom' |
social_media | What is the code of Gwynedd State? | code refers to StateCode | SELECT DISTINCT StateCode FROM location WHERE State = 'Gwynedd' |
social_media | Give the location id of West Sussex State. | SELECT DISTINCT LocationID FROM location WHERE State = 'West Sussex' | |
social_media | How many reshared tweets are there in Texas? | reshared tweet refers to IsReshare = 'TRUE'; 'Texas' is the State | 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' |
social_media | For the tweet which got a reach number of 547851, which country did it come from? | reach number of 547851 refers to Reach = 547851 | SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Reach = 547851 |
social_media | State the number of positive tweets from Ha Noi. | positive tweet refers to Sentiment > 0; 'Ha Noi' is the State | 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' |
social_media | Show the text of the tweet with the highest klout from Connecticut. | highest klout refers to Max(Klout); 'Connecticut' is the State | 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 |
social_media | 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`. | "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" is the text | 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' |
social_media | State the number of tweets from Michigan on Thursdays. | "Michigan" is the State; 'Thursday' is the Weekday; number of tweets refers to Count(TweetID) | 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' |
social_media | Which state was the tweet `tw-685681052912873473` from? Give the state code. | tw-685681052912873473' is the TweetID | SELECT T2.StateCode FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.TweetID = 'tw-685681052912873473' |
social_media | What is the percentage of the tweets from California are positive? | "California" is the State; positive tweet refers to Sentiment > 0; percentage = Divide (Count(TweetID where Sentiment > 0), Count (TweetID)) * 100 | 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' |
social_media | What is the day of the week that tweet with ID tw-682712873332805633 was posted? | "tw-682712873332805633" is the TweetID; day of the week refers to Weekday | SELECT Weekday FROM twitter WHERE TweetID = 'tw-682712873332805633' |
social_media | How many unique users have seen tweet with text `Happy New Year to all those AWS instances of ours!`? | "Happy New Year to all those AWS instances of ours!" is the text; seen unique users refers to Reach | SELECT Reach FROM twitter WHERE text = 'Happy New Year to all those AWS instances of ours!' |
social_media | Count the total number of tweet IDs in `en`. | "en" is the language and refers to Lang = 'en' | SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Lang = 'en' |
social_media | Is 3751 the location ID for tweet with ID tw-682714048199311366? | "tw-682714048199311366" is the TweetID | SELECT LocationID FROM twitter WHERE TweetID = 'tw-682714048199311366' |
social_media | How many tweets have been posted on Wednesday? | "Wednesday" is the Weekday | SELECT COUNT(TweetID) FROM twitter WHERE Weekday = 'Wednesday' |
social_media | List down all of the texts posted on Twitter on Thursday. | "Thursday" is the Weekday | SELECT text FROM twitter WHERE Weekday = 'Thursday' |
social_media | Which country's tweets collected the most likes? | country collected the most likes refers to Country where Max(Sum(Likes)) | 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 |
social_media | Tweet with ID tw-682723090279841798 was posted from which country? | "tw-682723090279841798" is the TweetID | SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TweetID = 'tw-682723090279841798' |
social_media | List down all the tweet text posted from Australia. | "Australia" is the Country | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Australia' |
social_media | Write down the tweet text posted from Rawang, Selangor, Malaysia. | "Rawang" is the City; "Selangor" is the State; "Malaysia" is the Country | 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' |
social_media | Tweets that were posted from Brazil are in what languague? | "Brazil" is the Country; language refers to Lang | SELECT DISTINCT T1.Lang FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Brazil' |
social_media | State the country where the most positive sentiment tweets were posted. | country with the most positive sentiment tweet refers to Country where Max(Count(Sentiment > 0)) | 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 |
social_media | How many tweets have a klout of over 50? | klout of over 50 refers to Klout > 50 | SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Klout > 50 |
social_media | Please list the texts of all the tweets that are not in English. | not in English refers to Lang <> en' | SELECT text FROM twitter WHERE Lang != 'en' |
social_media | Please give the user ID of the user who has posted the most tweets. | users with the most tweet refers to UserID where Max(Count (TweetID)) | SELECT UserID FROM twitter GROUP BY UserID ORDER BY COUNT(DISTINCT TweetID) DESC LIMIT 1 |
social_media | Among all the tweets posted on Mondays, how many of them are reshared? | "Monday" is the Weekday; reshare refers to IsReshare = 'TRUE' | SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Weekday = 'Monday' AND IsReshare = 'TRUE' |
social_media | Please list the texts of the top 3 tweets with the most number of unique users seeing the tweet. | the most number of unique users seeing refers to Max(Reach) | SELECT text FROM twitter ORDER BY Reach DESC LIMIT 3 |
social_media | How many reshared tweets have over 100 likes? | over 100 likes refers to Likes > 100; reshare tweet refers to IsReshare = 'TRUE' | SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE IsReshare = 'TRUE' AND Likes > 100 |
social_media | How many tweets in French were posted from Australia? | "French" is the language and refers to Lang = 'fr'; 'Australia' is the Country | 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' |
social_media | From which city was the tweet with the most number of retweets posted? | tweet with most number of retweet post refers to Max(RetweetCount) | SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID ORDER BY T1.RetweetCount DESC LIMIT 1 |
social_media | From which city were more tweets posted, Bangkok or Chiang Mai? | "Bangkok" and "Chiang Mai" are both City | 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') |
social_media | Among the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st? | "Sante Fe" is the State; "Argentina" is the Country; posted on 31st refers to Day = 31 | 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' |
social_media | Please list the top 3 cities with the most number of tweets posted in Canada. | "Canada" is the Country; city with most number of tweets refers to City where Max(Count(TweetID)) | 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 |
social_media | Please list all the cities from where tweets with neutral sentiments were posted. | neutral sentiment refers to Sentiment = 0 | SELECT DISTINCT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE Sentiment = 0 |
social_media | Tweets posted from which city has a higher number of average likes, Bangkok or Chiang Mai? | "Bangkok" and "Chiang Mai" are both City; average number of like = Divide (Sum(Likes), Count(TweetID)) | 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') |
cs_semester | Which course is more difficult, Intro to BlockChain or Computer Network? | diff refers to difficulty; diff is higher means the course is more difficult; | SELECT name FROM course WHERE name = 'Intro to BlockChain' OR name = 'Computer Network' ORDER BY diff DESC LIMIT 1 |
cs_semester | Please list the names of the courses that are less important than Machine Learning Theory. | lower credit means less important; | SELECT name FROM course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' ) |
cs_semester | How many professors are more popular than Zhou Zhihua? | higher popularity means the professor is more popular; | SELECT COUNT(prof_id) FROM prof WHERE popularity > ( SELECT popularity FROM prof WHERE first_name = 'Zhihua' AND last_name = 'Zhou' ) |
cs_semester | What is the phone number of Kerry Pryor? | SELECT phone_number FROM student WHERE l_name = 'Pryor' AND f_name = 'Kerry' | |
cs_semester | Which professor advised Faina Mallinar to become a research assistant? Please give his or her full name. | research assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name; | 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' |
cs_semester | How many research assistants does Sauveur Skyme have? | research assistant refers to the student who serves for research where the abbreviation is RA; | 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' |
cs_semester | Please list the full names of all the students who are research assistants with the highest research capability. | research assistant refers to the student who serves for research where the abbreviation is RA; the highest research capability refers to capability = 5; full name refers to f_name and l_name; | 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 |
cs_semester | How many research assistants of Ogdon Zywicki have an average salary? | research assistant refers to the student who serves for research where the abbreviation is RA; average salary refers to salary = 'med'; | 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' |
cs_semester | Please list the full names of all the students who took the course Machine Learning Theory. | full name refers to f_name and l_name; | 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' |
cs_semester | Among the students who got a B in the course Machine Learning Theory, how many of them have a gpa of over 3? | B refers to grade; GPA is an abbreviated name of Grade Point Average where over 3 refers to gpa > 3; | 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' ) ) |
cs_semester | Please list the names of the courses taken by Laughton Antonio. | 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' | |
cs_semester | Which student failed the course Intro to Database 2? Please give his or her full name. | If grade is NULL, it means that this student fails to pass the course; full name refers to f_name and l_name; | 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' |
cs_semester | Which student is more satisfied with the course Machine Learning Theory, Willie Rechert or Laughton Antonio? | sat refers to student's satisfaction degree with the course; more satisfied refers to MAX(sat); | 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 |
cs_semester | Among the students who took the course Machine Learning Theory, how many of them are undergraduates? | UG is an abbreviated name of undergraduate student in which type = 'UG'; | 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' |
cs_semester | Which professor advised Willie Rechert to work as a research assistant? Please give his or her full name. | research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name; | 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' |
cs_semester | What is the average gpa of Ogdon Zywicki's research assistants? | research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average = AVG(gpa); | 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' |
cs_semester | What is the average satisfying degree of the course Machine Learning Theory? | sat refers to student's satisfaction degree with the course; | 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' |
cs_semester | Give the number of research postgraduate students. | RPG is an abbreviated name of research postgraduate student in which type = 'RPG'; | SELECT COUNT(student_id) FROM student WHERE type = 'RPG' |
cs_semester | Which student has the highest gpa? Give the full name. | GPA is an abbreviated name of Grade Point Average where highest GPA = MAX(gpa); full name refers to f_name and l_name; | SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) |
cs_semester | For the 3-credit course with the easiest difficulty, how many students get an "A" in that course? | diff refers to difficulty; diff is higher means the course is more difficult in which easiest difficulty refers to diff = 1; 3-credit course refers to credit = '3'; get an "A" refers to grade = 'A' for the course; | 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 |
cs_semester | How many students took the hardest course? | diff refers to difficulty; diff is higher means the course is more difficult in which hardest difficulty is expressed as diff = 5; | 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 |
cs_semester | Which professor is Oliy Spratling working with? Give the full name. | research assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name; | 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' |
cs_semester | For the professor who is working with Harrietta Lydford, how is his popularity? | research assistant refers to the student who serves for research where the abbreviation is RA; higher popularity means more popular; prof_id refers to professor’s ID; | 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' |
cs_semester | How many research assistants does the female professor with the lowest teaching ability have? | research assistant refers to the student who serves for research where the abbreviation is RA; professor with the lowest teaching ability refers to prof_id where teachability = '1'; | 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' |
cs_semester | Give the grade score for Rik Unsworth in "Computer Network". | Academic grades awarded for participation in a course are A, B, C, D and F where Grade 'A' means excellent, Grade 'B' means good, Grade 'C' means fair, Grade 'D' means poorly pass, if grade is null or empty, it means that this student fails to pass this course in which grade = NULL; | 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' ) ) |
cs_semester | How many courses does Alvera McQuillin take? | 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' | |
cs_semester | State the name of research postgraduate student among Professor Zhihua Zhou's research assistants. | research postgraduate student refers to type = 'RPG'; research assistant refers to the student who serves for research where the abbreviation is RA; | 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' |
cs_semester | Provide the number of students enrolled in the "Statistical Learning" course. | 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' | |
cs_semester | Who were the students who failed the course "Applied Deep Learning"? Give the full name. | If grade is null or empty, it means that this student fails to pass the course in which grade = NULL; | 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 |
cs_semester | Give the phone number of the only student who obtained "A" in the course "Intro to BlockChain". | A refers to an excellent grade in which grade = 'A' for the course; | 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' |
cs_semester | What is the percentage of Professor Ogdon Zywicki's research assistants are taught postgraduate students? | research assistant refers to the student who serves for research where the abbreviation is RA; taught postgraduate student refers to type = 'TPG'; DIVIDE(COUNT(student_id where type = 'TPG' and first_name = 'Ogdon', last_name = 'Zywicki'), COUNT(first_name = 'Ogdon', last_name = 'Zywicki')) as percentage; | 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' |
cs_semester | What is the percentage of students who get a "B" in the course "Computer Network"? | DIVIDE(COUNT(student_id(grade = 'B' and name = 'Computer Network')), COUNT(student_id where name = ' Computer Network')) as percentage; | 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' |
cs_semester | How many courses have the highest difficulty? | diff refers to difficulty; diff is higher means the course is more difficult in which highest difficulty is expessed as diff = 5; | SELECT COUNT(course_id) FROM course WHERE diff = 5 |
cs_semester | What is the full name of the professor who graduated from an Ivy League School? | Ivy League school is assembled by 8 universities: Brown University, Columbia University, Cornell University, Dartmouth College, Harvard University, Princeton University, University of Pennsylvania and Yale University; | 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' ) |
cs_semester | Among the most important courses, what is the name of the most difficult course? | Higher credit means more important in which most important refers to MAX(credit); diff refers to difficulty; the most difficult course refers to MAX(diff); | SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course ) |
cs_semester | How many students have the highest intelligence among those taking a bachelor's degree? | bachelor's degree is an undergraduate degree in which type = 'UG'; the highest intelligence refers to MAX(intelligence); | SELECT COUNT(student_id) FROM student WHERE type = 'UG' AND intelligence = ( SELECT MAX(intelligence) FROM student ) |
cs_semester | Among the most popular professors, how many are females? | the most popular professors refers to prof_id where MAX(popularity); female refers to gender; | SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof ) |
cs_semester | How many research postgraduate students are there? | research postgraduate student refers to type = 'RPG'; | SELECT COUNT(student_id) FROM student WHERE type = 'RPG' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.