query_id
int64 0
7k
| database_id
stringclasses 140
values | table_id
listlengths 1
5
| query
stringlengths 16
224
| answer
stringlengths 18
577
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
6,000 |
game_1
|
[
"sportsinfo"
] |
List ids for all student who are on scholarship.
|
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
|
easy
|
6,001 |
game_1
|
[
"sportsinfo"
] |
What are the ids for all sporty students who are on scholarship?
|
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
|
easy
|
6,002 |
game_1
|
[
"student",
"sportsinfo"
] |
Show last names for all student who are on scholarship.
|
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
|
medium
|
6,003 |
game_1
|
[
"student",
"sportsinfo"
] |
What are the last names for all scholarship students?
|
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
|
medium
|
6,004 |
game_1
|
[
"sportsinfo"
] |
How many games are played for all students?
|
SELECT sum(gamesplayed) FROM Sportsinfo
|
easy
|
6,005 |
game_1
|
[
"sportsinfo"
] |
What is the total number of games played?
|
SELECT sum(gamesplayed) FROM Sportsinfo
|
easy
|
6,006 |
game_1
|
[
"sportsinfo"
] |
How many games are played for all football games by students on scholarship?
|
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
|
medium
|
6,007 |
game_1
|
[
"sportsinfo"
] |
What is the total number of all football games played by scholarship students?
|
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
|
medium
|
6,008 |
game_1
|
[
"sportsinfo"
] |
Show all sport name and the number of students.
|
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
|
medium
|
6,009 |
game_1
|
[
"sportsinfo"
] |
How many students play each sport?
|
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
|
medium
|
6,010 |
game_1
|
[
"sportsinfo"
] |
Show all student IDs with the number of sports and total number of games played
|
SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
|
medium
|
6,011 |
game_1
|
[
"sportsinfo"
] |
What are the ids of all students along with how many sports and games did they play?
|
SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
|
medium
|
6,012 |
game_1
|
[
"sportsinfo"
] |
Show all student IDs with more than total 10 hours per week on all sports played.
|
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10
|
easy
|
6,013 |
game_1
|
[
"sportsinfo"
] |
What are the student IDs for everybody who worked for more than 10 hours per week on all sports?
|
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10
|
easy
|
6,014 |
game_1
|
[
"student",
"sportsinfo"
] |
What is the first name and last name of the student who have most number of sports?
|
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,015 |
game_1
|
[
"student",
"sportsinfo"
] |
What is the first and last name of the student who played the most sports?
|
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,016 |
game_1
|
[
"sportsinfo"
] |
Which sport has most number of students on scholarship?
|
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,017 |
game_1
|
[
"sportsinfo"
] |
What is the sport with the most scholarship students?
|
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,018 |
game_1
|
[
"student",
"sportsinfo"
] |
Show student ids who don't have any sports.
|
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
|
hard
|
6,019 |
game_1
|
[
"student",
"sportsinfo"
] |
What are the ids of all students who don't play sports?
|
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
|
hard
|
6,020 |
game_1
|
[
"student",
"sportsinfo"
] |
Show student ids who are on scholarship and have major 600.
|
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
|
hard
|
6,021 |
game_1
|
[
"student",
"sportsinfo"
] |
What are the student ids for those on scholarship in major number 600?
|
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
|
hard
|
6,022 |
game_1
|
[
"student",
"sportsinfo"
] |
Show student ids who are female and play football.
|
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
|
hard
|
6,023 |
game_1
|
[
"student",
"sportsinfo"
] |
What are the ids of all female students who play football?
|
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
|
hard
|
6,024 |
game_1
|
[
"student",
"sportsinfo"
] |
Show all male student ids who don't play football.
|
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
|
hard
|
6,025 |
game_1
|
[
"student",
"sportsinfo"
] |
What are the ids of all male students who do not play football?
|
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
|
hard
|
6,026 |
game_1
|
[
"student",
"sportsinfo"
] |
Show total hours per week and number of games played for student David Shieber.
|
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber"
|
hard
|
6,027 |
game_1
|
[
"student",
"sportsinfo"
] |
What is the total number of hours per work and number of games played by David Shieber?
|
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber"
|
hard
|
6,028 |
game_1
|
[
"student",
"sportsinfo"
] |
Show total hours per week and number of games played for students under 20.
|
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
|
extra
|
6,029 |
game_1
|
[
"student",
"sportsinfo"
] |
What is the total number of hours per week and number of games played by students under 20?
|
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
|
extra
|
6,030 |
game_1
|
[
"plays_games"
] |
How many students play video games?
|
SELECT count(DISTINCT StuID) FROM Plays_games
|
easy
|
6,031 |
game_1
|
[
"plays_games"
] |
How many different students play games?
|
SELECT count(DISTINCT StuID) FROM Plays_games
|
easy
|
6,032 |
game_1
|
[
"student",
"plays_games"
] |
Show ids of students who don't play video game.
|
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
|
hard
|
6,033 |
game_1
|
[
"student",
"plays_games"
] |
What are the ids of all students who are not video game players?
|
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
|
hard
|
6,034 |
game_1
|
[
"sportsinfo",
"plays_games"
] |
Show ids of students who play video game and play sports.
|
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
|
hard
|
6,035 |
game_1
|
[
"sportsinfo",
"plays_games"
] |
What are the ids of all students who played video games and sports?
|
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
|
hard
|
6,036 |
game_1
|
[
"plays_games"
] |
Show all game ids and the number of hours played.
|
SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid
|
medium
|
6,037 |
game_1
|
[
"plays_games"
] |
What are ids and total number of hours played for each game?
|
SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid
|
medium
|
6,038 |
game_1
|
[
"plays_games"
] |
Show all student ids and the number of hours played.
|
SELECT Stuid , sum(hours_played) FROM Plays_games GROUP BY Stuid
|
medium
|
6,039 |
game_1
|
[
"plays_games"
] |
What are the ids of all students and number of hours played?
|
SELECT Stuid , sum(hours_played) FROM Plays_games GROUP BY Stuid
|
medium
|
6,040 |
game_1
|
[
"video_games",
"plays_games"
] |
Show the game name that has most number of hours played.
|
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
|
extra
|
6,041 |
game_1
|
[
"video_games",
"plays_games"
] |
What is the name of the game that has been played the most?
|
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
|
extra
|
6,042 |
game_1
|
[
"video_games",
"plays_games"
] |
Show all game names played by at least 1000 hours.
|
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING sum(hours_played) >= 1000
|
medium
|
6,043 |
game_1
|
[
"video_games",
"plays_games"
] |
What are the names of all the games that have been played for at least 1000 hours?
|
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING sum(hours_played) >= 1000
|
medium
|
6,044 |
game_1
|
[
"video_games",
"student",
"plays_games"
] |
Show all game names played by Linda Smith
|
SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda"
|
hard
|
6,045 |
game_1
|
[
"video_games",
"student",
"plays_games"
] |
What are the names of all games played by Linda Smith?
|
SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda"
|
hard
|
6,046 |
game_1
|
[
"student",
"sportsinfo"
] |
Find the last and first name of students who are playing Football or Lacrosse.
|
SELECT T2.lname , T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse"
|
hard
|
6,047 |
game_1
|
[
"student",
"sportsinfo"
] |
What is the first and last name of all students who play Football or Lacrosse?
|
SELECT T2.lname , T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse"
|
hard
|
6,048 |
game_1
|
[
"student",
"sportsinfo"
] |
Find the first name and age of the students who are playing both Football and Lacrosse.
|
SELECT fname , age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
|
extra
|
6,049 |
game_1
|
[
"student",
"sportsinfo"
] |
What are the first names and ages of all students who are playing both Football and Lacrosse?
|
SELECT fname , age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
|
extra
|
6,050 |
game_1
|
[
"video_games",
"student",
"plays_games"
] |
Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games.
|
SELECT lname , sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius")
|
extra
|
6,051 |
game_1
|
[
"video_games",
"student",
"plays_games"
] |
what is the last name and gender of all students who played both Call of Destiny and Works of Widenius?
|
SELECT lname , sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius")
|
extra
|
6,052 |
customers_and_addresses
|
[
"customers"
] |
Find the name of all customers.
|
SELECT customer_name FROM customers
|
easy
|
6,053 |
customers_and_addresses
|
[
"customers"
] |
What are the names of all the customers?
|
SELECT customer_name FROM customers
|
easy
|
6,054 |
customers_and_addresses
|
[
"customers"
] |
How many customers are there?
|
SELECT count(*) FROM customers
|
easy
|
6,055 |
customers_and_addresses
|
[
"customers"
] |
Return the total number of distinct customers.
|
SELECT count(*) FROM customers
|
easy
|
6,056 |
customers_and_addresses
|
[
"order_items"
] |
What is the average amount of items ordered in each order?
|
SELECT avg(order_quantity) FROM order_items
|
easy
|
6,057 |
customers_and_addresses
|
[
"order_items"
] |
Find the average order quantity per order.
|
SELECT avg(order_quantity) FROM order_items
|
easy
|
6,058 |
customers_and_addresses
|
[
"customers"
] |
What are the names of customers who use payment method "Cash"?
|
SELECT customer_name FROM customers WHERE payment_method = "Cash"
|
easy
|
6,059 |
customers_and_addresses
|
[
"customers"
] |
Which customers use "Cash" for payment method? Return the customer names.
|
SELECT customer_name FROM customers WHERE payment_method = "Cash"
|
easy
|
6,060 |
customers_and_addresses
|
[
"customers"
] |
Find the "date became customers" of the customers whose ID is between 10 and 20.
|
SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20
|
easy
|
6,061 |
customers_and_addresses
|
[
"customers"
] |
What are the dates when customers with ids between 10 and 20 became customers?
|
SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20
|
easy
|
6,062 |
customers_and_addresses
|
[
"customers"
] |
Which payment method is used by most customers?
|
SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1
|
hard
|
6,063 |
customers_and_addresses
|
[
"customers"
] |
Find the payment method that is used most frequently.
|
SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1
|
hard
|
6,064 |
customers_and_addresses
|
[
"customers"
] |
What are the names of customers using the most popular payment method?
|
SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)
|
hard
|
6,065 |
customers_and_addresses
|
[
"customers"
] |
Find the name of the customers who use the most frequently used payment method.
|
SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)
|
hard
|
6,066 |
customers_and_addresses
|
[
"customers"
] |
What are all the payment methods?
|
SELECT DISTINCT payment_method FROM customers
|
easy
|
6,067 |
customers_and_addresses
|
[
"customers"
] |
Return all the distinct payment methods used by customers.
|
SELECT DISTINCT payment_method FROM customers
|
easy
|
6,068 |
customers_and_addresses
|
[
"products"
] |
What are the details of all products?
|
SELECT DISTINCT product_details FROM products
|
easy
|
6,069 |
customers_and_addresses
|
[
"products"
] |
Return the the details of all products.
|
SELECT DISTINCT product_details FROM products
|
easy
|
6,070 |
customers_and_addresses
|
[
"customers"
] |
Find the name of all customers whose name contains "Alex".
|
SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"
|
medium
|
6,071 |
customers_and_addresses
|
[
"customers"
] |
Which customer's name contains "Alex"? Find the full name.
|
SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"
|
medium
|
6,072 |
customers_and_addresses
|
[
"products"
] |
Find the detail of products whose detail contains the word "Latte" or the word "Americano"
|
SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"
|
extra
|
6,073 |
customers_and_addresses
|
[
"products"
] |
Which product's detail contains the word "Latte" or "Americano"? Return the full detail.
|
SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"
|
extra
|
6,074 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
What is the address content of the customer named "Maudie Kertzmann"?
|
SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann"
|
hard
|
6,075 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
Return the address content for the customer whose name is "Maudie Kertzmann".
|
SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann"
|
hard
|
6,076 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
How many customers are living in city "Lake Geovannyton"?
|
SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton"
|
hard
|
6,077 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
Find the number of customers who live in the city called Lake Geovannyton.
|
SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton"
|
hard
|
6,078 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
Find the name of customers who are living in Colorado?
|
SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado"
|
hard
|
6,079 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
What are the names of customers who live in Colorado state?
|
SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado"
|
hard
|
6,080 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
Find the list of cities that no customer is living in.
|
SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id)
|
hard
|
6,081 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
What are the cities no customers live in?
|
SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id)
|
hard
|
6,082 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
Which city has the most customers living in?
|
SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,083 |
customers_and_addresses
|
[
"addresses",
"customers",
"customer_addresses"
] |
Find the city where the most customers live.
|
SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,084 |
customers_and_addresses
|
[
"addresses"
] |
Retrieve the list of all cities.
|
SELECT DISTINCT city FROM addresses
|
easy
|
6,085 |
customers_and_addresses
|
[
"addresses"
] |
List all the distinct cities
|
SELECT DISTINCT city FROM addresses
|
easy
|
6,086 |
customers_and_addresses
|
[
"addresses"
] |
Find the city with post code 255.
|
SELECT city FROM addresses WHERE zip_postcode = 255
|
easy
|
6,087 |
customers_and_addresses
|
[
"addresses"
] |
Which city is post code 255 located in?
|
SELECT city FROM addresses WHERE zip_postcode = 255
|
easy
|
6,088 |
customers_and_addresses
|
[
"addresses"
] |
Find the state and country of all cities with post code starting with 4.
|
SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%"
|
medium
|
6,089 |
customers_and_addresses
|
[
"addresses"
] |
What are the state and country of all the cities that have post codes starting with 4.\
|
SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%"
|
medium
|
6,090 |
customers_and_addresses
|
[
"addresses"
] |
List the countries having more than 4 addresses listed.
|
SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4
|
easy
|
6,091 |
customers_and_addresses
|
[
"addresses"
] |
For which countries are there more than four distinct addresses listed?
|
SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4
|
easy
|
6,092 |
customers_and_addresses
|
[
"customer_contact_channels"
] |
List all the contact channel codes that were used less than 5 times.
|
SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5
|
easy
|
6,093 |
customers_and_addresses
|
[
"customer_contact_channels"
] |
Which contact channel codes were used less than 5 times?
|
SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5
|
easy
|
6,094 |
customers_and_addresses
|
[
"customer_contact_channels",
"customers"
] |
Which contact channel has been used by the customer with name "Tillman Ernser"?
|
SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
|
medium
|
6,095 |
customers_and_addresses
|
[
"customer_contact_channels",
"customers"
] |
Find the contact channel code that was used by the customer named "Tillman Ernser".
|
SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
|
medium
|
6,096 |
customers_and_addresses
|
[
"customer_contact_channels",
"customers"
] |
What is the "active to date" of the latest contact channel used by "Tillman Ernser"?
|
SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
|
medium
|
6,097 |
customers_and_addresses
|
[
"customer_contact_channels",
"customers"
] |
Return the the "active to date" of the latest contact channel used by the customer named "Tillman Ernser".
|
SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
|
medium
|
6,098 |
customers_and_addresses
|
[
"customer_contact_channels"
] |
What is the average time span of contact channels in the database?
|
SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels
|
easy
|
6,099 |
customers_and_addresses
|
[
"customer_contact_channels"
] |
Compute the average active time span of contact channels.
|
SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels
|
easy
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.