db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
movie_3
List at least 5 customers who paid greater than $10. Provide the full name of the customers.
full name refers to first_name, last_name; greater than $10 refers to amount > 10
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.amount > 10
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
How many journals have a word "computing" in its full name?
word computing refers to FullName LIKE '%computing%'
SELECT COUNT(Id) FROM Journal WHERE FullName LIKE '%computing%'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
Which of the customers, whose Tokyo-based sales representative reports to the Vice President of Sales whose employee number is 1056, has paid the highest payment? List the customer's name, the contact person and calculate the total amount of that customer's total payments.
Tokyo is a city; 'reportsTO' is the leader of the 'employeeNumber'; highest payment refers to MAX(amount); total amount of payments = SUM(amount);
SELECT T2.customerName, T2.contactFirstName, T2.contactLastName, SUM(T3.amount) FROM employees AS T1 INNER JOIN customers AS T2 ON T2.salesRepEmployeeNumber = T1.employeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN offices AS T4 ON T1.officeCode = T4.officeCode WHERE T4.city = 'T...
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
List at least 5 device models that are commonly used by female users.
device models that are commonly used refers to MAX(COUNT(device_model)); female refers to gender = 'F';
SELECT T.device_model FROM ( SELECT T2.device_model, COUNT(T2.device_model) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' GROUP BY T2.device_model ) AS T ORDER BY T.num DESC LIMIT 5
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
List all the cities that belong to United Arab Emirates.
United Arab Emirates refers to country = 'United Arab Emirates'
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'United Arab Emirates'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
talkingdata
How many male users of the "Galaxy S5" device model?
male refers to gender = 'M';
SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.device_model = 'Galaxy S5' AND T2.gender = 'M'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
List at least 10 films that the customers can rent for more than 5 days.
film refers to title; rent for more than 5 days refers to rental_duration > 5
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.customer_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.rental_duration > 5 GROUP BY T1.title ) AS T WHERE T.num > 10
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the short name and full name of conference uses the homepage "http://www.informatik.uni-trier.de/~ley/db/conf/ices/index.html"?
null
SELECT ShortName, FullName FROM Conference WHERE HomePage = 'http://www.informatik.uni-trier.de/~ley/db/conf/ices/index.html'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
From 2003 to 2004, how many customers have paid more than three times?
paymentdate BETWEEN '2003-01-01' AND '2004-12-31'; customers who have paid more than three times refers to (COUNT(customernumber)>3);
SELECT COUNT(customernumber) FROM ( SELECT customernumber FROM payments WHERE STRFTIME('%Y', paymentDate) >= '2003' AND STRFTIME('%Y', paymentDate) <= '2004' GROUP BY customernumber HAVING COUNT(customernumber) > 3 ) T
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Give the number of 30-year-old users who were active in the events on 2016/5/2.
30-year-old refers to age = '30'; active refers to is_active = 1; on 2016/5/2 refers to timestamp = '2016/5/2 XX:XX:XX';
SELECT COUNT(T3.device_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.device_id = T3.device_id WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-02' AND T1.is_active = 1 AND T3.age = '30'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
List all the films that are rated as PG-13.
film refers to title; rated as PG-13 refers to rating = 'PG-13'
SELECT title FROM film WHERE rating = 'PG-13'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
car_retails
How many different orders with a total price greater than 4000 are cancelled?
total price = MULTIPLY(quantityOrdered, priceEach) > 4000; cancelled orders refer to status = 'Cancelled';
SELECT COUNT(DISTINCT T1.orderNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.quantityOrdered * T1.priceEach > 4000 AND T2.status = 'Cancelled'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
How many customers are still active?
active refers to active = 1
SELECT COUNT(customer_id) FROM customer WHERE active = 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
video_games
List the platform ID of the game titled Airborne Troops: Countdown to D-Day.
Airborne Troops: Countdown to D-Day refers to game_name = 'Airborne Troops: Countdown to D-Day';
SELECT T1.platform_id FROM game_platform AS T1 INNER JOIN game_publisher AS T2 ON T1.game_publisher_id = T2.id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T3.game_name = 'Airborne Troops: Countdown to D-Day'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
talkingdata
Give the number of female users of "E派" brand devices.
female refers to gender = 'F'; E派 brand refers to phone_brand = 'E派';
SELECT COUNT(T2.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.phone_brand = 'E派'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
How many titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005.
in June 2005 refers to month(rental_date) = 6 and year(rental_date) = 2005; percentage = divide(count(inventory_id where month(rental_date) = 6 and year(rental_date) = 2005), count(inventory_id)) * 100%
SELECT COUNT(T2.rental_id) , CAST(SUM(IIF(STRFTIME('%m',T2.rental_date) = '7', 1, 0)) AS REAL) * 100 / COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller' AND STRFTIME('%Y',T2.rental_date) = '2005'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
car_retails
Which sales representatives in New York city whose leader is Anthony Bow with the employee number is 1143? Indicate their employee numbers.
reportsTO' is the leader of the 'employeeNumber';
SELECT T1.employeeNumber FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.reportsTo = 1143 AND T2.city = 'NYC'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Which category does the app id No.894384172610331000 belong to?
null
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T2.app_id = '894384172610331000'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
How many film categories are there?
null
SELECT COUNT(DISTINCT category_id) FROM category
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the title and journal homepage of the latest published paper?
latest published paper refers to Max(Year)
SELECT T1.Title, T2.HomePage FROM Paper AS T1 INNER JOIN Journal AS T2 ON T1.JournalId = T2.Id ORDER BY T1.Year DESC LIMIT 1
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
talkingdata
What is the brand of the youngest user's device?
brand of the device refers to phone_brand; youngest user refers to MIN(age);
SELECT device_model FROM phone_brand_device_model2 WHERE device_id IN ( SELECT device_id FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age ) )
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Provide the list of the longest movies. Arrange these titles in alphabetical order.
the longest refers to max(length)
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
Please list the titles of the papers published in the journal "Concepts in Magnetic Resonance Part A" in 2008.
journal "Concepts in Magnetic Resonance Part A" refers to FullName = 'Concepts in Magnetic Resonance Part A'; in 2018 refers to Year = 2018
SELECT T2.Title FROM Journal AS T1 INNER JOIN Paper AS T2 ON T1.Id = T2.JournalId WHERE T1.FullName = 'Concepts in Magnetic Resonance Part A' AND T2.Year = 2008
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
What is the average actual profit by 1937 Lincoln Berline?
average actual profit = AVG(SUBTRACT(priceEach, buyPrice)); 1937 Lincoln Berline is a product name;
SELECT SUM(T1.priceEach - T2.buyPrice) / COUNT(*) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productName = '1937 Lincoln Berline'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
How many times is the number of active apps in the event that happened at 7:50:28 on 2016/5/2 than in the event that happened at 7:41:03 on 2016/5/2?
how many times = DIVIDE(SUM(IF(timestamp = '2016/5/2 7:50:28', 1,0)), SUM(IF(timestamp = '2016/5/2 7:41:03',1,0))); active refers to is_active = '1'; at 7:50:28 on 2016/5/2 refers to timestamp = '2016/5/2 7:50:28'; at 7:41:03 on 2016/5/2 refers to timestamp = '2016/5/2 7:41:03';
SELECT SUM(IIF(timestamp = '2016-05-02 7:50:28', 1, 0)) / SUM(IIF(timestamp = '2016-05-02 7:41:03', 1, 0)) AS num FROM events AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.is_active = '1'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Identify the full name of the customer, who has the following email address: SHEILA.WELLS@sakilacustomer.org.
full name refers to first_name, last_name
SELECT first_name, last_name FROM customer WHERE email = 'SHEILA.WELLS@sakilacustomer.org'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the total number and conference's homepage of papers held in a conference with an ID of 187 during 1990 to 2000?
Id of 187 refers to ConferenceId = 187; during 1990 to 2000 refers to Year BETWEEN 1990 and 2000; total number of conference refers to Count(ConferenceId = 187)
SELECT COUNT(T2.ConferenceId), T1.HomePage FROM Conference AS T1 INNER JOIN Paper AS T2 ON T1.Id = T2.ConferenceId WHERE T2.Year BETWEEN 1990 AND 2000 AND T2.ConferenceId = 187
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
Between 8/1/2003 and 8/30/2004, how many checks were issued by Mini Gifts Distributors Ltd.? Please list their check numbers.
paymentDate BETWEEN '2003-08-01' AND '2004-08-30'; Mini Gifts Distributors Ltd. Is a customer name;
SELECT T1.checkNumber FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.paymentDate >= '2003-08-01' AND T1.paymentDate <= '2004-08-30' AND T2.customerName = 'Mini Gifts Distributors Ltd.'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
How many users from the group "F29-32" who were active in the events on 2016/5/7?
active users refers to is_active = '1'; on 2016/5/7 refers to timestamp = '2016/5/7 XX:XX:XX';
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.event_id = T3.device_id WHERE SUBSTR(T2.`timestamp`, 1, 10) = '2016-05-07' AND T1.is_active = '1' AND T3.`group` = 'F29-32'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
For how long can you rent the movie 'Dirty Ace'?
length refers to rental_duration; 'Dirty Ace' refers to title = 'DIRTY ACE'
SELECT rental_duration FROM film WHERE title = 'DIRTY ACE'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
List the title of papers with a conference ID from 160 to 170, include their conference short name.
conference ID from 160 to 170 refers to ConferenceId BETWEEN 160 AND 170
SELECT DISTINCT T1.Title, T2.ShortName FROM Paper AS T1 INNER JOIN Conference AS T2 ON T1.ConferenceId = T2.Id WHERE T1.ConferenceId BETWEEN 160 AND 170
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
What is the total value of shipped vintage car orders from 2003-2004?
total value = SUM(MULTIPLY(quantityOrdered, priceEach)); shipped orders refers to status = 'Shipped'; vintage car is a product line; year(orderDate) between 2003 and 2004;
SELECT SUM(T2.priceEach * T2.quantityOrdered) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber WHERE T3.status = 'Shipped' AND T3.orderDate BETWEEN '2003-01-01' AND '2004-12-31'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
Indicate the percentage of inactive customers at store no.1.
inactive refers to active = 0; store no.1 refers to store_id = 1; percentage = divide(count(customer_id where active = 0), count(customer_id)) * 100% where store_id = 1
SELECT CAST(SUM(CASE WHEN active = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(customer_id) FROM customer WHERE store_id = 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
List the authors and journal short name of the papers with "chemiluminescence" in its title and has a journal ID from 245 to 250.
with "chemiluminescence" in its title refers to Title LIKE 'chemiluminescence%'; journal ID from 245 to 250 refers to JournalId BETWEEN 245 AND 250
SELECT T2.Name, T3.ShortName FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId INNER JOIN Journal AS T3 ON T1.JournalId = T3.Id WHERE T1.JournalId BETWEEN 245 AND 250 AND T1.Title LIKE '%chemiluminescence%'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
Among the motorcycles with product scale of 1:10, which of them is the most ordered by American customers?
motorcycle is a product line; American is a nationality of country = 'USA';
SELECT T1.productName FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T1.productLine = 'Motorcycles' AND T1.productScale = '1:10' AND T4.country = 'US...
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
For the event which happened at 14:09:49 on 2016/5/6, in the location coordinate(116, 40), how many apps were active?
at 14:09:49 on 2016/5/6 refers to timestamp = '2016/5/6 14:09:49'; location coordinate(116, 40) refers to longitude = '116' AND latitude = '40'; active refers to is_active = '1';
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T2.timestamp = '2016-05-06 14:09:49' AND T1.is_active = '1' AND T2.longitude = '116' AND T2.latitude = '40'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
What is the average rental rate for PG-13 rated movies?
PG-13 rated movie refers to rating = 'PG-13'; average rental rate = avg(rental_rate)
SELECT AVG(rental_rate) FROM film WHERE rating = 'PG-13'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
car_retails
What is the highest amount of order made by the sales representative in Boston? Please give the name of the product and amount.
Boston is a city; amount of order = MULTIPLY(quantityOrdered, priceEach);
SELECT T2.productName, T1.quantityOrdered * T1.priceEach FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T1.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T4.city = 'Boston' AND T4.salesRepEmployeeNum...
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
What is the average replacement cost for the movies with a rental rate of 4.99?
a rental rate of 4.99 refers to rental_rate = 4.99; average replacement cost = avg(replacement_cost)
SELECT AVG(replacement_cost) FROM film WHERE rental_rate = 4.99
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
car_retails
For the planes which has the hightest total price, how much it exceeds the average?
plane is a product line; total price = MULTIPLY(quantityOrdered, priceEach); how much the total price exceeds the average = SUBTRACT(MAX(MULTIPLY(quantityOrdered, priceEach))), AVG(priceEach));
SELECT MAX(quantityOrdered * priceEach) - AVG(priceEach) FROM orderdetails WHERE productCode IN ( SELECT productCode FROM products WHERE productLine = 'Planes' )
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
How many more devices are there of the brand vivo than of the brand LG?
how many more = SUBTRACT(SUM(IF(phone_brand = 'vivo',1,0)), SUM(IF(phone_brand = 'LG',1,0))); brand vivo refers to phone_brand = 'vivo'; brand LG refers to phone_brand = 'LG';
SELECT SUM(IIF(phone_brand = 'vivo', 1, 0)) - SUM(IIF(phone_brand = 'LG', 1, 0)) AS num FROM phone_brand_device_model2
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Calculate the total amount paid by Stephanie Mitchell for film rentals in June 2005.
the total amount = sum(amount); in June 2005 refers to payment_date like '2005-06%'
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'STEPHANIE' AND T2.last_name = 'MITCHELL' AND SUBSTR(T1.payment_date, 1, 7) = '2005-06'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
In year 1999, list the titles and conference's short name of paper authored by someone named "Philip".
in year 1999 refers to Year = 1999;  someone named "Philip" refers to Name LIKE 'Philip%'
SELECT T1.Title, T3.ShortName FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId INNER JOIN Conference AS T3 ON T1.ConferenceId = T3.Id WHERE T1.Year = 1999 AND T2.Name LIKE 'Philip%'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
From which branch does the sales representative employee who made the most sales in 2005? Please indicates its full address and phone number.
orderDate between '2005-01-01' and '2005-12-31'; full address = addressLine1+addressLine2;
SELECT T3.addressLine1, T3.addressLine2, T3.phone FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber INNER JOIN customers AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN employees AS T4 ON T3.salesRepEmployeeNumber = T4.employeeNumber INNER JOIN offices AS T5 ON T4.officeCode =...
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
Name the movie with the highest rental revenue among the shortest films.
movie name refers to title; the highest rental revenue refers to max(multiply(rental_duration, rental_rate)); the shortest film refers to min(length)
SELECT title FROM film WHERE length = ( SELECT MIN(length) FROM film ) ORDER BY rental_duration * rental_rate DESC LIMIT 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
movie_3
Identify the number of movies that starred Nick Stallone.
null
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id AND T2.first_name = 'NICK' AND T2.last_name = 'STALLONE'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the title of the paper published in 2003 by an author with affiliation with Department of Network Science, Graduate School of Information Systems, The University of Electro-Communications?
published in 2003 refers to Year = 2003; 'Department of Network Science, Graduate School of Information Systems, The University of Electro-Communications' is the Affiliation organization
SELECT DISTINCT T2.Title FROM PaperAuthor AS T1 INNER JOIN Paper AS T2 ON T1.PaperId = T2.Id WHERE T1.Affiliation = 'Department of Network Science, Graduate School of Information Systems, The University of Electro-Communications' AND T2.Year = 2003
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
Who is the sales agent of the customer who has made the highest payment? Include the full names of employee and his/her supervisor.
payment refers to amount; full name = firstName+lastName; supervisor refers to reportsTO; 'reportsTO' is the leader of the 'employeeNumber';
SELECT T1.firstName, T1.lastName, T1.reportsTo FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber ORDER BY T3.amount DESC LIMIT 1
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
What is the age group of most OPPO users?
age group refers to group; most OPPO users refers to MAX(COUNT(phone_brand = 'OPPO')); OPPO users refers to phone_brand = 'OPPO';
SELECT T.`group` FROM ( SELECT T1.`group`, COUNT(T1.`group`) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' GROUP BY T1.`group` ) AS T ORDER BY T.num DESC LIMIT 1
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
How long did Austin Cintron take to return the movie 'Destiny Saturday'?
'Destiny Saturday' refers to title = 'DESTINY SATURDAY'; length = subtract(return_date, rental_date)
SELECT T2.rental_date - T2.return_date FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'AUSTIN' AND T4.title = 'DESTINY SATURDAY'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the title and author ID of paper with conference ID less than 100 in year 2006?
conference ID less than 100 refers to ConferenceId < 100; in year 2006 refers to Year = 2006
SELECT DISTINCT T1.Title, T2.AuthorId FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T1.Year = 2006 AND T1.ConferenceId < 100
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
Calculate the average amount of payments made by customers during the first half of 2004.
average amount of payments = DIVIDE(SUM(amount), COUNT(customerNumber); first half of 2014 refers to paymentDate > = '2004-01-01' AND paymentDate < '2004-07-01;
SELECT AVG(amount) FROM payments WHERE paymentDate BETWEEN '2004-01-01' AND '2004-06-30'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Among the female users of the devices, how many of them are over 30?
female refers to gender = 'F'; over 30 refers to age > 30;
SELECT COUNT(device_id) FROM gender_age WHERE age > 30 AND gender = 'F'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Where can you rent the movie 'Wyoming Storm'? Identify the address of the rental store and the rental rate.
'Wyoming Storm' refers to title = 'WYOMING STORM'
SELECT T2.store_id, T1.address, T4.rental_rate FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id INNER JOIN inventory AS T3 ON T2.store_id = T3.store_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'WYOMING STORM'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
talkingdata
How many devices are of the brand vivo?
brand vivo refers to phone_brand = 'vivo';
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Determine the number of action movies available for rent.
action movie refers to category.name = 'Action'
SELECT COUNT(T2.film_id) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id WHERE T1.name = 'Action'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the paper "Stitching videos streamed by mobile phones in real-time" about?
"Stitching videos streamed by mobile phones in real-time" is the Title of paper; what the paper is about refers to Keywords
SELECT Keyword FROM Paper WHERE Title = 'Stitching videos streamed by mobile phones in real-time'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
What is the total actual profit gained from orders made by American customers from 2003-01-06 to 2005-05-09?
total actual profit = SUM(SUBTRACT(priceEach, buyPrice)); American is a nationality of country = 'USA'; orderDate BETWEEN '2003-01-06' AND '2005-05-09';
SELECT SUM(T2.priceEach - T1.buyPrice) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T3.orderDate > '2003-01-05' AND T3.orderDate < '2005-05-10'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
What is the ID of the device used by the youngest user?
ID of the device refers to device_id; youngest user refers to MIN(age);
SELECT device_id FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age )
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Name the most recent movie rented by Dorothy Taylor.
movie name refers to title; the most recent refers to max(rental_date)
SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'DOROTHY' AND T1.last_name = 'TAYLOR' ORDER BY T2.rental_date DESC LIMIT 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What are the journal homepages and author ID of the papers published in 2000 to 2005 with a word "social" in its title?
in 2000 to 2005 refers to Year BETWEEN 2000 AND 2005; a word "social" in its title refers to Title = '%SOCIAL%'
SELECT T3.HomePage, T2.AuthorId FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId INNER JOIN Journal AS T3 ON T1.JournalId = T3.Id WHERE T1.Year BETWEEN 2000 AND 2005 AND T1.Title LIKE '%SOCIAL%'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
talkingdata
What is the age of the youngest female device user?
youngest refers to MIN(age); female refers to gender = 'F';
SELECT MIN(age) FROM gender_age WHERE gender = 'F'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Identify the number of movies rented by Maria Miller.
null
SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
car_retails
How many customers with a canceled shipment have a credit limit greater than 115,000?
cancelled shipment refers to status = 'cancelled'; creditLimit > 115000;
SELECT COUNT(T1.customerNumber) FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.status = 'Cancelled' AND T1.creditLimit > 115000
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
Name the cast members of the movie 'African Egg'.
cast member name refers to first_name, last_name; 'African Egg' refers to title = 'AFRICAN EGG'
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'AFRICAN EGG'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
Among the papers with conference ID of 0, list down the authors of papers with a journal ID less than 100.
Conference ID of 0 refers to ConferenceId = 0; journal ID of less than 100 refers to JournalId < 100
SELECT DISTINCT T2.Name FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T1.ConferenceId = 0 AND T1.JournalId < 100
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
talkingdata
How many users belong to "Financial Information" category?
null
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Financial Information'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Give me the title and category name of films whose price per day is more than $30. Please include their special features.
category name refers to category.name; price per day is more than $30 refers to multiply(rental_duration, rental_rate) > 30
SELECT T1.title, T3.name, T1.special_features FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration * T1.rental_rate > 30
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What are the paper IDs of papers presented in conferences has a homepage starts with "http://www.informatik.uni-trier.de/~ley/db/conf/"?
homepage starts with "http://www.informatik.uni-trier.de/~ley/db/conf/" refers to HomePage LIKE 'http://www.informatik.uni-trier.de/~ley/db/conf/%'
SELECT T1.Id FROM Paper AS T1 INNER JOIN Conference AS T2 ON T1.ConferenceId = T2.Id WHERE T2.HomePage LIKE 'http://www.informatik.uni-trier.de/~ley/db/conf/%'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
What is the phone number of all companies where the last name of the contact person starts with the letter M and are not from Germany?
last name of contact person starts with M refers to lastName LIKE 'M%'; Germany is a country; not from Germany refers to country<>'Germany';
SELECT phone FROM customers WHERE contactLastName LIKE 'M%' AND country != 'Germany'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
How many documentary films are rated PG-13?
documentary film refers to category.name = 'documentary'; rated PG-13 refers to rating = 'PG-13'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Documentary' AND T1.rating = 'PG-13'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
In papers with journal IDs from 200 to 300 and with its short name starts with A, what is the percentage of papers with conference ID of 0?
journal ID of 200 to 300 refers to JournalId BETWEEN 200 AND 300; short name starts with A refers to ShortName LIKE 'A%'; Percentage = Divide (Count(ConferenceId = 0), Count(ConferenceId)) * 100
SELECT CAST(SUM(CASE WHEN T1.ConferenceId = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.ConferenceId) FROM Paper AS T1 INNER JOIN Journal AS T2 ON T1.JournalId = T2.Id WHERE T1.JournalId BETWEEN 200 AND 300 AND T2.ShortName LIKE 'A%'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
To whom does the employee have to inform that is the sales representative of the French customer?
inform refers to reportsTo; 'reportsTO' is the leader of the 'employeeNumber'; France is a country; country = 'France';
SELECT T1.reportsTo FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber WHERE T2.country = 'France'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Please list the app IDs of all the users in the Securities category.
null
SELECT T2.app_id FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'Securities'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Tell me the title of the film in which Sandra Kilmer is one of the actors.
null
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'SANDRA' AND T2.last_name = 'KILMER'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
video_games
Among games sold in Europe, list the platform ID of games with sales lesser than 30% of the average number of sales.
Europe refers to region_name = 'Europe'; sales lesser than 30% of the average number of sales refers to SUM(num_sales) < MULTIPLY(AVG(num_sales), 0.3);
SELECT DISTINCT T3.platform_id FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id INNER JOIN game_platform AS T3 ON T2.game_platform_id = T3.id WHERE T1.region_name = 'Europe' AND T2.num_sales * 100 * 100000 < ( SELECT AVG(T2.num_sales * 100000) * 30 FROM region AS T1 INNER JOIN region_sales AS T2 ...
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
car_retails
Of all the orders placed and shipped throughout the year 2005, what percentage of those orders corresponds to customer number 186?
shipped orders refers to status = 'shipped'; year(shippedDate) = 2005; percentage = DIVIDE(SUM(customerNumber = 186)), COUNT(orderNumber)) as percentage;
SELECT CAST(SUM(CASE WHEN customerNumber = 186 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(orderNumber) FROM orders WHERE status = 'Shipped' AND shippedDate BETWEEN '2005-01-01' AND '2005-12-31'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Is the oldest device user male or female?
MAX(Age) AND gender = 'M' means that the oldest device user is male; MAX(Age) AND gender = 'F' means that the oldest device user is female;
SELECT gender FROM gender_age WHERE age = ( SELECT MAX(age) FROM gender_age )
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Tally the full names of actors in the film "Alabama Devil."
full name refers to first_name, last_name; "Alabama Devil" refers to title = 'ALABAMA DEVIL'
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ALABAMA DEVIL'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
car_retails
What is the full address of the office where the employee who is a sales representative for the customer whose business is located in the city of New York works?
full address = addressLine1 + addressLine2; NYC is a shortname of New York City.
SELECT T2.addressLine1, T2.addressLine2 FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN offices AS T3 ON T1.officeCode = T3.officeCode WHERE T2.city = 'NYC' AND T1.jobTitle = 'Sales Rep'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
movie_3
From 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM, how many times did Susan Wilson pay for film rentals?
from 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM refers to payment_date between '2005-05-30 03:43:54' and '2005-07-31 10:08:29'
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_date BETWEEN '2005-05-30 03:43:54' AND '2005-07-31 10:08:29'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
Write down the conference full name of "ICWE" and it's homepage address.
"ICWE" is the ShortName of conference
SELECT FullName, Homepage FROM Conference WHERE ShortName = 'ICWE'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
On what date did the customer with the lowest credit limit serviced by sales representative Barry Jones make payments for his/her orders?
null
SELECT T3.paymentDate FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber WHERE T1.firstName = 'Barry' AND T1.lastName = 'Jones' AND T1.jobTitle = 'Sales Rep' ORDER BY T2.creditLimit ASC LIMIT 1
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Among all the users who use a vivo device, what is the age of the youngest user?
vivo device refers to phone_brand = 'vivo'; youngest refers to MIN(age);
SELECT T1.age FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'vivo' ORDER BY T1.age LIMIT 1
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Compute the total payment made by Sarah Lewis for film rentals so far.
total payment = sum(amount)
SELECT SUM(T3.amount) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN payment AS T3 ON T1.rental_id = T3.rental_id WHERE T2.first_name = 'SARAH' AND T2.last_name = 'LEWIS'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the author ID and their affiliations of authors of the papers with a journal ID of 0 and published in 2009.
published in 2009 refers to Year = 2009; journal ID of 0 refers to JournalId = 0
SELECT DISTINCT T2.AuthorId, T2.Affiliation FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T1.JournalId = 0 AND T1.Year = 2009 AND T2.Affiliation IS NOT NULL
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
What profit can the seller Carousel DieCast Legends make from the sale of the product described as "The perfect holiday or anniversary gift for executives"?
seller and product vendor are synonyms; Carousel DieCast Legends is a product vendor; profit = SUM(SUBTRACT(msrp, buyPrice));
SELECT SUM(T2.MSRP - T2.buyPrice) FROM productlines AS T1 INNER JOIN products AS T2 ON T1.productLine = T2.productLine WHERE T2.productVendor = 'Carousel DieCast Legends' AND T1.textDescription LIKE '%perfect holiday or anniversary gift for executives%'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Among the devices with an event occurring in 2016, how many of them are owned by a user in the M23-26 user group?
in 2016 refers to year(timestamp) = 2016; M23-26 user group refers to `group` = 'M23-26';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE STRFTIME('%Y', T2.timestamp) = '2016' AND T1.`group` = 'M23-26'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Write down the email addresses of active customers who rented between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM.
email address refers to email; active refers to active = 1; between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM refers to rental_date between '2005-5-25 07:37:47' and '2005-5-26 10:06:49'
SELECT T2.email FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.rental_date BETWEEN '2005-5-25 07:37:47' AND '2005-5-26 10:06:49' AND T2.active = 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
Within the year of 2001 to 2010, find the paper published rate of 2001.
year of 2001 to 2010 refers to Year BETWEEN 2001 AND 2010; Percentage = Divide(Count (PaperId(Year = 2001)), Count (PaperID(Year BETWEEN 2001 AND 2010))) * 100
SELECT CAST(SUM(CASE WHEN Year = 2001 THEN 1 ELSE 0 END) AS REAL) / COUNT(Id) FROM Paper WHERE Year >= 2001 AND Year < 2011
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
car_retails
What is the full address of the customer who commented that DHL be used for the order that was shipped on April 4, 2005?
full address = addressLine1+addressLine2; shippedDate = '2005-04-04';
SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.shippedDate = '2005-04-04' AND T2.status = 'Shipped'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
List at least 3 categories with the lowest number of users.
lowest number of users refers to MIN(COUNT(label_id));
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id ORDER BY T2.label_id LIMIT 3
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
What is the title of the restricted film, whose length is 71 minutes and whose replacement cost is $29.99?
restricted means rating = 'R'; length is 71 minutes refers to length = 71; replacement cost is $29.99 refers to replacement_cost = 29.99
SELECT title FROM film WHERE replacement_cost = 29.99 AND rating = 'R' AND length = 71
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
video_games
What is the diffrence between the number of games produced by Culture Brain that can be played on SNES and DS?
difference = SUBTRACT(SUM(platform_name = 'SNES'), SUM(platform_name = 'DS')); SNES refers to platform_name = SNES ; DS refers to platform_name = 'DS' ;
SELECT COUNT(CASE WHEN T1.platform_name = 'SNES' THEN T3.game_id ELSE NULL END) - COUNT(CASE WHEN T1.platform_name = 'DS' THEN T3.game_id ELSE NULL END) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN game_publisher AS T3 ON T2.game_publisher_id = T3.id INNER JOIN publisher AS T4...
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
car_retails
What is the full address of the office where 4 people work and one of them is Sales Representation?
full address = addressLine1+addressLine2; Sales Manager is a job title;
SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep'
CREATE TABLE offices ( phone TEXT not null, -- Example Values: `+1 650 219 4782`, `+1 215 837 0825`, `+1 212 555 3000`, `+33 14 723 4404`, `+81 33 224 5000` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 addressLine1 TEXT not null, -- Example Values: `100 Market Street`, `1550 Court Place`, `523 ...
talkingdata
Please list the location coordinates of all the Galaxy Note 2 devices when an event happened.
location coordinates = longitude, latitude; Galaxy Note 2 refers to device_model = 'Galaxy Note 2';
SELECT T1.longitude, T1.latitude FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 2'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
Among the adult films, how many of them have a rental duration of fewer than 4 days?
adult film refers to rating = 'NC-17'; rental duration of fewer than 4 days refers to rental_duration < 4
SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND rental_duration < 4
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
authors
What is the ratio of author with affiliation and without affiliation?
with affiliation refers to Affiliation is not Null; without affiliation refers to Affiliation IS NULL; Ration = Count(Id(Affiliation is NOT NULL)) : Count (Id (Affiliation IS NULL))
SELECT CAST(SUM(CASE WHEN Affiliation IS NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(*) FROM Author
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
talkingdata
For the device with an event occurring on 2016/5/1 at 0:55:25, what is the gender of its user?
on 2016/5/1 at 0:55:25 refers to timestamp = '2016-05-01 00:55:25';
SELECT T1.gender FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-01 00:55:25'
CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, --...
movie_3
What is the percentage of horror film titles in English film titles?
horror film refers to category.name = 'Horror'; English film refers to language.name = 'English'; percentage = divide(count(film_id where category.name = 'Horror'), count(film_id)) where language.name = 'English' * 100%
SELECT CAST(SUM(IIF(T3.name = 'Horror', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN language AS T4 ON T2.language_id = T4.language_id WHERE T4.name = 'English'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...