problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: What is the direction of the train with a diamond-shaped load in its 2nd car?. Keep the solution inside sql tag ```sql [SQL-Query] ```
trains
SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 2 AND T1.shape = 'diamond'
Write SQL query to solve given problem: Among the trains running west, how many trains have three-wheeled, jagged roof cars?. Keep the solution inside sql tag ```sql [SQL-Query] ```
trains
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'
Write SQL query to solve given problem: Provide the directions for all the trains that have 2 or less cars.. Keep the solution inside sql tag ```sql [SQL-Query] ```
trains
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
Write SQL query to solve given problem: What is the percentage of all the trains with at least 4 cars? List the directions of the said trains.. Keep the solution inside sql tag ```sql [SQL-Query] ```
trains
SELECT CAST(COUNT(CASE WHEN T2.trailPosi >= 4 THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) 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 UNION ALL SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars t GROUP BY train_id ) AS T2 ON T1.id = T2.train_id AND T2.trailPosi >= 4
Write SQL query to solve given problem: List all the load shapes of all head cars of each train and identify which load shape has the highest number. Calculate the percentage of the trains with the said head car that are running eas. Keep the solution inside sql tag ```sql [SQL-Query] ```
trains
SELECT DISTINCT T3.load_shape FROM ( SELECT load_shape, train_id FROM cars WHERE position = 1 ORDER BY train_id DESC ) AS T3 UNION ALL SELECT T4.load_shape FROM ( SELECT load_shape, train_id FROM cars WHERE position = 1 ORDER BY train_id DESC LIMIT 1 ) AS T4 UNION ALL SELECT (CAST(COUNT(DISTINCT CASE WHEN T2.direction = 'east' THEN T2.id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T2.id)) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T1.load_shape = ( SELECT T4.load_shape FROM ( SELECT load_shape, train_id FROM cars AS T WHERE position = 1 ORDER BY train_id DESC LIMIT 1 ) AS T4 )
Write SQL query to solve given problem: Please list the names of the characters in the movie Look Who's Talking.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Look Who''s Talking'
Write SQL query to solve given problem: Which character has the longest screen time in the movie Batman?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Batman' ORDER BY T2.screentime DESC LIMIT 1
Write SQL query to solve given problem: Which actor played the role of Joker in the movie Batman?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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.Title = 'Batman' AND T2.`Character Name` = 'Joker'
Write SQL query to solve given problem: Please list the names of the actors who played a role in the movie Batman.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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.Title = 'Batman'
Write SQL query to solve given problem: Which movie is the character Dr. Archibald 'Moonlight' Graham from?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.`Character Name` = 'Dr. Archibald ''Moonlight'' Graham'
Write SQL query to solve given problem: Please list the names of the movies starring Tom Cruise.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Title 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 T3.Name = 'Tom Cruise'
Write SQL query to solve given problem: How many movies starring Morgan Freeman are suggested by parental guidance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
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 T3.Name = 'Morgan Freeman' AND T1.`MPAA Rating` = 'PG'
Write SQL query to solve given problem: Among the movies starring Tom Cruise, which one of them has the best quality?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Title 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 T3.Name = 'Tom Cruise' ORDER BY T1.Rating DESC LIMIT 1
Write SQL query to solve given problem: What is the name of the character played by Tom Cruise in the movie Born on the Fourth of July?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Character Name` 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 T3.Name = 'Tom Cruise' AND T1.Title = 'Born on the Fourth of July'
Write SQL query to solve given problem: Please list the names of all the characters played by Tom Cruise.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.`Character Name` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T2.Name = 'Tom Cruise'
Write SQL query to solve given problem: Among the actors who starred in the movie Batman, which one of them is the tallest?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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.Title = 'Batman' ORDER BY T3.`Height (Inches)` DESC LIMIT 1
Write SQL query to solve given problem: How many movies star a male African American actor?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
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'
Write SQL query to solve given problem: What is the average rating of all the movies starring Tom Cruise?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT AVG(T1.Rating) 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 T3.Name = 'Tom Cruise'
Write SQL query to solve given problem: How much longer in percentage is the screen time of the most important character in Batman than the least important one?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
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'
Write SQL query to solve given problem: Which movie had the biggest budget? Give the name of the movie.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT Title FROM movie ORDER BY Budget DESC LIMIT 1
Write SQL query to solve given problem: What is the MPAA rating for the movie with the character named "Peter Quill" in it?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.`MPAA Rating` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.`Character Name` = 'Peter Quill'
Write SQL query to solve given problem: Give the name of the No.1 character in the credit list from the highest rating thriller movie.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.creditOrder = '1' AND T1.Genre = 'Thriller' ORDER BY T1.Rating DESC LIMIT 1
Write SQL query to solve given problem: Who was the actor that played in the movie "Batman" with the longest screentime?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.Name FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID INNER JOIN movie AS T3 ON T3.MovieID = T1.MovieID WHERE T3.Title = 'Batman' ORDER BY T1.screentime DESC LIMIT 1
Write SQL query to solve given problem: How many movies has the highest networth actor acted in?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
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)
Write SQL query to solve given problem: Who played the character named "Chanice Kobolowski"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.Name FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Chanice Kobolowski'
Write SQL query to solve given problem: When is the birthday of the actor who played "Sully"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Date of Birth` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Sully'
Write SQL query to solve given problem: Show the birth city of the actor who played "Gabriel Martin".. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Birth City` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Gabriel Martin'
Write SQL query to solve given problem: Give the biography of the actor who played "Michael Moscovitz".. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.Biography FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Michael Moscovitz'
Write SQL query to solve given problem: How tall is the actor who played "Lurch"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Height (Inches)` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Lurch'
Write SQL query to solve given problem: Show the No.3 character name in the credit list of the movie "G.I. Joe: The Rise of Cobra".. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'G.I. Joe: The Rise of Cobra' AND T2.creditOrder = '3'
Write SQL query to solve given problem: Who played the No.2 character in the credit list of the movie "American Hustle"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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.Title = 'American Hustle' AND T2.creditOrder = '2'
Write SQL query to solve given problem: Who played the No.1 character in the credit list of the movie which was released on "2015/10/26"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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.`Release Date` = '2015-10-26' AND T2.creditOrder = '1'
Write SQL query to solve given problem: What is the percentage of the USA actors that showed up in the credit list of movie "Mrs. Doubtfire"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT CAST(SUM(CASE WHEN T3.`Birth Country` = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.`Birth Country`) 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.Title = 'Mrs. Doubtfire'
Write SQL query to solve given problem: What is the percentage of the actors that showed up in the credit list of movie "Dawn of the Planet of the Apes" that were born after "1970/1/1"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT CAST(SUM(CASE WHEN T3.`Date of Birth` > '1970-01-01' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.`Date of Birth`) 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.Title = 'Dawn of the Planet of the Apes'
Write SQL query to solve given problem: List down the movie ID of movie with a budget of 15000000 and a rating between 7 to 8.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT MovieID FROM movie WHERE Rating BETWEEN 7 AND 8 AND Budget = 15000000
Write SQL query to solve given problem: In rated PG movies, how many of them released in June 1990?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT COUNT(*) FROM movie WHERE `MPAA Rating` = 'PG' AND `Release Date` LIKE '1990-06%'
Write SQL query to solve given problem: What is the name of male and white actor with actor ID 439?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT Name FROM actor WHERE ActorID = 439 AND Gender = 'Male' AND Ethnicity = 'White'
Write SQL query to solve given problem: Among the actors born in New York City, list the genre of their movie with a rating greater than 5.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Genre 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 T3.`Birth City` = 'New York City' AND T1.Rating > 5
Write SQL query to solve given problem: In romantic movies, how many of them starred by John Travolta?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
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'
Write SQL query to solve given problem: List the height and net worth of actors starred in Three Men and a Little Lady.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.`Height (Inches)`, T3.NetWorth 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.Title = 'Three Men and a Little Lady'
Write SQL query to solve given problem: What is the genre of PG rated movie starred by the actor with highest net worth?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Genre 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.`MPAA Rating` = 'PG' ORDER BY CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) DESC LIMIT 1
Write SQL query to solve given problem: What is the net worth of the actor starred in Misery who has a height ranging from 60 to 70 inches tall?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.NetWorth 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.Title = 'Misery' AND T3.`Height (Inches)` BETWEEN 60 AND 70 AND T3.Gender = 'Male'
Write SQL query to solve given problem: Count the male actors born in USA that starred in Ghost.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
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.Title = 'Ghost' AND T3.Gender = 'Male' AND T3.`Birth Country` = 'USA'
Write SQL query to solve given problem: What is the MPAA rating and title of the movie starred by Leonardo DiCaprio with highest budget?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.`MPAA Rating`, T1.Title 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 T3.Name = 'Leonardo DiCaprio' ORDER BY T1.Budget DESC LIMIT 1
Write SQL query to solve given problem: Among the actors starred in Die Hard 2, list their net worth and birth date of actors with a height between 60 to 65.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.NetWorth, T3.`Date of Birth` 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.Title = 'Die Hard 2' AND T3.`Height (Inches)` BETWEEN 60 AND 65
Write SQL query to solve given problem: List the runtime of movies starred by an African-American actor born on December 28, 1954.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Runtime 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 T3.Ethnicity = 'African American' AND T3.`Date of Birth` = '1954-12-28'
Write SQL query to solve given problem: Find the actor's name that played as Don Altobello in a drama movie that has a gross of 136766062.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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.Gross = 136766062 AND T2.`Character Name` = 'Don Altobello' AND T1.Genre = 'Drama'
Write SQL query to solve given problem: What is the gross of a comedy movie with a rating lower than 7 and starred by an actor with a net worth greater than $375,000,000.00?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT SUM(T1.Gross) 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 CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) > 375000000 AND T1.Rating < 7 AND T1.Genre = 'Comedy'
Write SQL query to solve given problem: What is the runtime of the movie starred by Jackie Chan with a rating greater than 7?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T1.Runtime 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 T3.Name = 'Jackie Chan' AND T1.Rating > 7
Write SQL query to solve given problem: Among the movies with drama genre, what is the percentage of the actors with net worth greater than $400,000,000.00?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT SUM(CASE WHEN CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) > 400000000 THEN 1 ELSE 0 END) - SUM(CASE WHEN CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) < 400000000 THEN 1 ELSE 0 END) 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 = 'Drama'
Write SQL query to solve given problem: List the character's name of actress born in Sherman Oaks and starred in the movie Bruce Almighty with height greater than the 50% of average height of all actors listed.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie
SELECT T3.Name 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 T3.Gender = 'Female' AND T1.Title = 'Godzilla' AND T3.`Birth City` = 'Sherman Oaks' AND T3.`Height (Inches)` * 100 > ( SELECT AVG(`Height (Inches)`) FROM actor ) * 50
Write SQL query to solve given problem: How many tweets are in English?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Lang = 'en'
Write SQL query to solve given problem: Please list the texts of all the tweets that are reshared.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT text FROM twitter WHERE IsReshare = 'TRUE'
Write SQL query to solve given problem: How many tweets are seen by more than 1000 unique users?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Reach > 1000
Write SQL query to solve given problem: Among all the tweets that have a positive sentiment, how many of them are posted on Thursday?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Sentiment > 0 AND Weekday = 'Thursday'
Write SQL query to solve given problem: What is the text of the tweet that got the most `likes`?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT text FROM twitter WHERE Likes = ( SELECT MAX( Likes) FROM twitter )
Write SQL query to solve given problem: Please list all the cities in Argentina.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT City FROM location WHERE City IS NOT NULL AND Country = 'Argentina'
Write SQL query to solve given problem: How many tweets in total were posted by a user in Argentina?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country = 'Argentina' LIMIT 1
Write SQL query to solve given problem: Users in which city of Argentina post the most tweets?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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
Write SQL query to solve given problem: Among all the tweets that are reshared, how many of them are posted by a user in Buenos Aires?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: Please list the texts of all the tweets posted from Buenos Aires with a positive sentiment.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: From which country is the tweet with the most likes posted?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID ORDER BY T1.Likes DESC LIMIT 1
Write SQL query to solve given problem: Users in which country has posted more numbers of positive tweets, Argentina or Australia?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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
Write SQL query to solve given problem: Among all the tweets posted from Buenos Aires, how many of them were posted on Thursdays?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: Among all the users that have posted a tweet with over 1000 likes, how many of them are male?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Likes > 10 AND T2.Gender = 'Male'
Write SQL query to solve given problem: How many tweets have the male users posted in total?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male'
Write SQL query to solve given problem: What is the gender of the user who has posted the tweet that is seen by the most number of unique users?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Reach DESC LIMIT 1
Write SQL query to solve given problem: How many tweets are posted by male users in Argentina?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T1.UserID = T3.UserID WHERE T3.Gender = 'Male' AND T2.Country = 'Argentina'
Write SQL query to solve given problem: Please list the texts of all the tweets posted by male users from Buenos Aires.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T2 ON T2.UserID = T1.UserID INNER JOIN user AS T3 ON T1.UserID = T3.UserID WHERE T2.City = 'Buenos Aires' AND T3.Gender = 'Male'
Write SQL query to solve given problem: What is the average number of tweets posted by the users in a city in Argentina?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: Among all the tweets with a positive sentiment, what is the percentage of those posted by a male user?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT SUM(CASE WHEN T2.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS per FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Sentiment > 0
Write SQL query to solve given problem: Give the number of users who do not show their genders.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(UserID) AS user_number FROM user WHERE Gender = 'Unknown'
Write SQL query to solve given problem: State the number of states in the United Kingdom.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(State) AS State_number FROM location WHERE Country = 'United Kingdom'
Write SQL query to solve given problem: What is the code of Gwynedd State?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT DISTINCT StateCode FROM location WHERE State = 'Gwynedd'
Write SQL query to solve given problem: Give the location id of West Sussex State.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT DISTINCT LocationID FROM location WHERE State = 'West Sussex'
Write SQL query to solve given problem: How many reshared tweets are there in Texas?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: For the tweet which got a reach number of 547851, which country did it come from?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Reach = 547851
Write SQL query to solve given problem: State the number of positive tweets from Ha Noi.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: Show the text of the tweet with the highest klout from Connecticut.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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
Write SQL query to solve given problem: How many female Twitter users are there from Wisconsin?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(T1.Likes) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Wisconsin' AND T3.Gender = 'Female'
Write SQL query to solve given problem: What is the gender of the user who tweeted `tw-715909161071091712`?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.TweetID = 'tw-715909161071091712'
Write SQL query to solve given problem: 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`.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: What is the gender of the user whose tweet got 535 retweets?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount = 535
Write SQL query to solve given problem: Give the gender of the user who made the highest klout tweet on Wednesdays.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Weekday = 'Wednesday' ORDER BY T1.Klout DESC LIMIT 1
Write SQL query to solve given problem: For the tweet which got the most likes, state the gender of the user who tweeted it.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1
Write SQL query to solve given problem: State the number of tweets from Michigan on Thursdays.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: Which state was the tweet `tw-685681052912873473` from? Give the state code.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.StateCode FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.TweetID = 'tw-685681052912873473'
Write SQL query to solve given problem: What is the percentage of male Twitter users from Florida?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT SUM(CASE WHEN T3.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS percentage FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Florida'
Write SQL query to solve given problem: What is the percentage of the tweets from California are positive?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
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'
Write SQL query to solve given problem: What is the day of the week that tweet with ID tw-682712873332805633 was posted?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT Weekday FROM twitter WHERE TweetID = 'tw-682712873332805633'
Write SQL query to solve given problem: How many unique users have seen tweet with text `Happy New Year to all those AWS instances of ours!`?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT Reach FROM twitter WHERE text = 'Happy New Year to all those AWS instances of ours!'
Write SQL query to solve given problem: Count the total number of tweet IDs in `en`.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Lang = 'en'
Write SQL query to solve given problem: Is 3751 the location ID for tweet with ID tw-682714048199311366?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT LocationID FROM twitter WHERE TweetID = 'tw-682714048199311366'
Write SQL query to solve given problem: How many tweets have been posted on Wednesday?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(TweetID) FROM twitter WHERE Weekday = 'Wednesday'
Write SQL query to solve given problem: List down all of the texts posted on Twitter on Thursday.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT text FROM twitter WHERE Weekday = 'Thursday'
Write SQL query to solve given problem: What is the gender of the user who posted a tweet with ID tw-682714583044243456?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.TweetID = 'tw-682714583044243456'
Write SQL query to solve given problem: List down the text of tweets posted by unknown gender users.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T1.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Unknown'
Write SQL query to solve given problem: Calculate the total number of male tweet IDs.. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male'
Write SQL query to solve given problem: What gender of users posted the most tweets in `en`?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT T.Gender FROM ( SELECT T2.Gender, COUNT( text) AS num FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'en' GROUP BY T2.Gender ) T ORDER BY T.num DESC LIMIT 1
Write SQL query to solve given problem: What gender of users retweet more than 30 times?. Keep the solution inside sql tag ```sql [SQL-Query] ```
social_media
SELECT DISTINCT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount > 30