question
stringlengths 19
191
| query
stringlengths 26
371
| schema
stringclasses 14
values |
---|---|---|
Find the name and flag of ships that are not steered by any captain with Midshipman rank. | SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman') | captain: Captain_ID (INT), Name (TEXT), Ship_ID (INT), age (TEXT), Class (TEXT), Rank (TEXT)
Ship: Ship_ID (INT), Name (TEXT), Type (TEXT), Built_Year (REAL), Class (TEXT), Flag (TEXT) |
What are the names and flags of ships that do not have a captain with the rank of Midshipman? | SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman') | captain: Captain_ID (INT), Name (TEXT), Ship_ID (INT), age (TEXT), Class (TEXT), Rank (TEXT)
Ship: Ship_ID (INT), Name (TEXT), Type (TEXT), Built_Year (REAL), Class (TEXT), Flag (TEXT) |
Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank. | SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant' | captain: Captain_ID (INT), Name (TEXT), Ship_ID (INT), age (TEXT), Class (TEXT), Rank (TEXT)
Ship: Ship_ID (INT), Name (TEXT), Type (TEXT), Built_Year (REAL), Class (TEXT), Flag (TEXT) |
What are the names of ships that are commanded by both captains with the rank of Midshipman and captains with the rank of Lieutenant? | SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant' | captain: Captain_ID (INT), Name (TEXT), Ship_ID (INT), age (TEXT), Class (TEXT), Rank (TEXT)
Ship: Ship_ID (INT), Name (TEXT), Type (TEXT), Built_Year (REAL), Class (TEXT), Flag (TEXT) |
What is id of the city that hosted events in the most recent year? | SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the city that hosted some events in the most recent year. What is the id of this city? | SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the match ids of the cities that hosted competition "1994 FIFA World Cup qualification"? | SELECT match_id FROM MATCH WHERE competition = "1994 FIFA World Cup qualification" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What is the match id of the competition called "1994 FIFA World Cup qualification"? | SELECT match_id FROM MATCH WHERE competition = "1994 FIFA World Cup qualification" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the cities which were once a host city after 2010? | SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities served as a host city after 2010? | SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which city has hosted the most events? | SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY count(*) DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the city that hosted the most events. | SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY count(*) DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What is the venue of the competition "1994 FIFA World Cup qualification" hosted by "Nanjing ( Jiangsu )"? | SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the venue of the competition "1994 FIFA World Cup qualification" which was hosted by "Nanjing ( Jiangsu )". | SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Give me the temperature of Shanghai in January. | SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What is the temperature of "Shanghai" city in January? | SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What is the host year of city "Taizhou ( Zhejiang )"? | SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
IN which year did city "Taizhou ( Zhejiang )" serve as a host city? | SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )" | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which three cities have the largest regional population? | SELECT city FROM city ORDER BY regional_population DESC LIMIT 3 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What are the three largest cities in terms of regional population? | SELECT city FROM city ORDER BY regional_population DESC LIMIT 3 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which city has the lowest GDP? Please list the city name and its GDP. | SELECT city , GDP FROM city ORDER BY GDP LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What is the city with the smallest GDP? Return the city and its GDP. | SELECT city , GDP FROM city ORDER BY GDP LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which city has the highest temperature in February? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
In February, which city marks the highest temperature? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Give me a list of cities whose temperature in March is lower than that in July or higher than that in Oct? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities' temperature in March is lower than that in July or higher than that in Oct? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Give me a list of cities whose temperature in Mar is lower than that in July and which have also served as host cities? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities have lower temperature in March than in July and have been once host cities? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities. | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities have lower temperature in March than in Dec and have never served as host cities? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once host cities? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities have higher temperature in Feb than in Jun or have once served as host cities? | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Please give me a list of cities whose regional population is over 10000000. | SELECT city FROM city WHERE regional_population > 10000000 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities have regional population above 10000000? | SELECT city FROM city WHERE regional_population > 10000000 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Please give me a list of cities whose regional population is over 8000000 or under 5000000. | SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities have regional population above 8000000 or below 5000000? | SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the number of matches in different competitions. | SELECT count(*) , Competition FROM MATCH GROUP BY Competition | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
For each competition, count the number of matches. | SELECT count(*) , Competition FROM MATCH GROUP BY Competition | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
List venues of all matches in the order of their dates starting from the most recent one. | SELECT venue FROM MATCH ORDER BY date DESC | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What are the venues of all the matches? Sort them in the descending order of match date. | SELECT venue FROM MATCH ORDER BY date DESC | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
what is the GDP of the city with the largest population. | SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Find the GDP of the city with the largest regional population. | SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
What are the GDP and population of the city that already served as a host more than once? | SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING count(*) > 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
Which cities have served as host cities more than once? Return me their GDP and population. | SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING count(*) > 1 | city: City_ID (INT), City (TEXT), Hanzi (TEXT), Hanyu_Pinyin (TEXT), Regional_Population (INT), GDP (REAL)
match: Match_ID (INT), Date (TEXT), Venue (TEXT), Score (TEXT), Result (TEXT), Competition (TEXT)
temperature: City_ID (INT), Jan (REAL), Feb (REAL), Mar (REAL), Apr (REAL), Jun (REAL), Jul (REAL), Aug (REAL), Sep (REAL), Oct (REAL), Nov (REAL), Dec (REAL)
hosting_city: Year (INT), Match_ID (INT), Host_City (TEXT) |
List every individual's first name, middle name and last name in alphabetical order by last name. | SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the first, middle, and last names of all individuals, ordered by last name? | SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
List all the types of forms. | SELECT DISTINCT form_type_code FROM forms | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the different types of forms? | SELECT DISTINCT form_type_code FROM forms | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the name of the most popular party form. | SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What is the name of the party form that is most common? | SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the payment method and phone of the party with email "enrico09@example.com". | SELECT payment_method_code , party_phone FROM parties WHERE party_email = "enrico09@example.com" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What is the payment method code and party phone of the party with the email 'enrico09@example.com'? | SELECT payment_method_code , party_phone FROM parties WHERE party_email = "enrico09@example.com" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the emails of parties with the most popular party form. | SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY count(*) DESC LIMIT 1) | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the party emails associated with parties that used the party form that is the most common? | SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY count(*) DESC LIMIT 1) | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
List all the name of organizations in order of the date formed. | SELECT organization_name FROM organizations ORDER BY date_formed ASC | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the names of organizations, ordered by the date they were formed, ascending? | SELECT organization_name FROM organizations ORDER BY date_formed ASC | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the name of the youngest organization. | SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What is the name of the organization that was formed most recently? | SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the last name of the latest contact individual of the organization "Labour Party". | SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = "Labour Party" ORDER BY t2.date_contact_to DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What is the last name of the contact individual from the Labour party organization who was contacted most recently? | SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = "Labour Party" ORDER BY t2.date_contact_to DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the last name of the first ever contact person of the organization with the highest UK Vat number. | SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.uk_vat_number = (SELECT max(uk_vat_number) FROM organizations) ORDER BY t2.date_contact_to ASC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations? | SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.uk_vat_number = (SELECT max(uk_vat_number) FROM organizations) ORDER BY t2.date_contact_to ASC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
How many services are there? | SELECT count(*) FROM services | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Count the number of services. | SELECT count(*) FROM services | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find name of the services that has never been used. | SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the names of the services that have never been used? | SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the name of all the cities and states. | SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the names of all cities and states? | SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
How many cities are there in state "Colorado"? | SELECT count(*) FROM addresses WHERE state_province_county = "Colorado" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Count the number of cities in the state of Colorado. | SELECT count(*) FROM addresses WHERE state_province_county = "Colorado" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the payment method code used by more than 3 parties. | SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the payment method codes that have been used by more than 3 parties? | SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the name of organizations whose names contain "Party". | SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the names of organizations that contain the word "Party"? | SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
How many distinct payment methods are used by parties? | SELECT count(DISTINCT payment_method_code) FROM parties | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Count the number of different payment method codes used by parties. | SELECT count(DISTINCT payment_method_code) FROM parties | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Which is the email of the party that has used the services the most number of times? | SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY count(*) DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Return the party email that has used party services the greatest number of times. | SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY count(*) DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Which state can address "6862 Kaitlyn Knolls" possibly be in? | SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Give the state corresponding to the line number building "6862 Kaitlyn Knolls". | SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%" | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What is the name of organization that has the greatest number of contact individuals? | SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id GROUP BY t1.organization_name ORDER BY count(*) DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Return the name of the organization which has the most contact individuals. | SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id GROUP BY t1.organization_name ORDER BY count(*) DESC LIMIT 1 | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
Find the last name of the individuals that have been contact individuals of an organization. | SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
What are the last names of individuals who have been contact individuals for an organization? | SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id | Addresses: address_id (INTEGER), line_1_number_building (VARCHAR(80)), town_city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50))
Services: service_id (INTEGER), service_type_code (VARCHAR(15)), service_name (VARCHAR(80)), service_descriptio (VARCHAR(255))
Forms: form_id (INTEGER), form_type_code (VARCHAR(15)), service_id (INTEGER), form_number (VARCHAR(50)), form_name (VARCHAR(80)), form_description (VARCHAR(255))
Individuals: individual_id (INTEGER), individual_first_name (VARCHAR(80)), individual_middle_name (VARCHAR(80)), inidividual_phone (VARCHAR(80)), individual_email (VARCHAR(80)), individual_address (VARCHAR(255)), individual_last_name (VARCHAR(80))
Organizations: organization_id (INTEGER), date_formed (DATETIME), organization_name (VARCHAR(255)), uk_vat_number (VARCHAR(20))
Parties: party_id (INTEGER), payment_method_code (VARCHAR(15)), party_phone (VARCHAR(80)), party_email (VARCHAR(80))
Organization_Contact_Individuals: individual_id (INTEGER), organization_id (INTEGER), date_contact_from (DATETIME), date_contact_to (DATETIME)
Party_Addresses: party_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type_code (VARCHAR(15)), date_address_to (DATETIME)
Party_Forms: party_id (INTEGER), form_id (INTEGER), date_completion_started (DATETIME), form_status_code (VARCHAR(15)), date_fully_completed (DATETIME)
Party_Services: booking_id (INTEGER), customer_id (INTEGER), service_id (INTEGER), service_datetime (DATETIME), booking_made_date (DATETIME) |
How many drivers are there? | SELECT count(*) FROM driver | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the name, home city, and age for all drivers. | SELECT name , home_city , age FROM driver | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the party and the number of drivers in each party. | SELECT party , count(*) FROM driver GROUP BY party | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the name of drivers in descending order of age. | SELECT name FROM driver ORDER BY age DESC | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show all different home cities. | SELECT DISTINCT home_city FROM driver | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the home city with the most number of drivers. | SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1 | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the party with drivers from Hartford and drivers older than 40. | SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40 | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show home city where at least two drivers older than 40 are from. | SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING count(*) >= 2 | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show all home cities except for those having a driver older than 40. | SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40 | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the names of the drivers without a school bus. | SELECT name FROM driver WHERE driver_id NOT IN (SELECT driver_id FROM school_bus) | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the types of schools that have two schools. | SELECT TYPE FROM school GROUP BY TYPE HAVING count(*) = 2 | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the school name and driver name for all school buses. | SELECT T2.school , T3.name FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN driver AS T3 ON T1.driver_id = T3.driver_id | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
What is the maximum, minimum and average years spent working on a school bus? | SELECT max(years_working) , min(years_working) , avg(years_working) FROM school_bus | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the school name and type for schools without a school bus. | SELECT school , TYPE FROM school WHERE school_id NOT IN (SELECT school_id FROM school_bus) | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
Show the type of school and the number of buses for each type. | SELECT T2.type , count(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
How many drivers are from Hartford city or younger than 40? | SELECT count(*) FROM driver WHERE home_city = 'Hartford' OR age < 40 | driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT)
school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT)
school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL) |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card- Downloads last month
- 3