db_id
stringlengths
3
31
query
stringlengths
18
577
question
stringlengths
3
224
schema
stringlengths
177
6.14k
primary_keys
stringlengths
16
545
foreign_keys
stringlengths
16
1.48k
city_record
SELECT count(*) , Competition FROM MATCH GROUP BY Competition
Find the number of matches in different competitions.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
SELECT count(*) , Competition FROM MATCH GROUP BY Competition
For each competition, count the number of matches.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
SELECT venue FROM MATCH ORDER BY date DESC
List venues of all matches in the order of their dates starting from the most recent one.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
SELECT venue FROM MATCH ORDER BY date DESC
What are the venues of all the matches? Sort them in the descending order of match date.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
what is the GDP of the city with the largest population.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
Find the GDP of the city with the largest regional population.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
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
What are the GDP and population of the city that already served as a host more than once?
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
city_record
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
Which cities have served as host cities more than once? Return me their GDP and population.
[Schema (values) (types)]: | city_record | city : city_id (text) , city (number) , hanzi (text) , hanyu_pinyin (text) , regional_population (text) , gdp (number) | match : match_id (text) , date (number) , venue (text) , score (text) , result (text) , competition (number) | temperature : city_id (text) , jan (number) , feb (text) , mar (text) , apr (text) , jun (number) , jul (number) , aug (number) , sep (text) , oct (text) , nov (text) , dec (text) | hosting_city : year (text) , match_id (number) , host_city (text);
[Primary Keys]: city : city_id, match : match_id, temperature : city_id, hosting_city : year
[Foreign Keys]: temperature : city_id = city : city_id | hosting_city : match_id = match : match_id | hosting_city : host_city = city : city_id
e_government
SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name
List every individual's first name, middle name and last name in alphabetical order by last name.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name
What are the first, middle, and last names of all individuals, ordered by last name?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT DISTINCT form_type_code FROM forms
List all the types of forms.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT DISTINCT form_type_code FROM forms
What are the different types of forms?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Find the name of the most popular party form.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
What is the name of the party form that is most common?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "[email protected]"
Find the payment method and phone of the party with email "[email protected]".
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "[email protected]"
What is the payment method code and party phone of the party with the email '[email protected]'?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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)
Find the emails of parties with the most popular party form.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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)
What are the party emails associated with parties that used the party form that is the most common?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT organization_name FROM organizations ORDER BY date_formed ASC
List all the name of organizations in order of the date formed.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT organization_name FROM organizations ORDER BY date_formed ASC
What are the names of organizations, ordered by the date they were formed, ascending?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1
Find the name of the youngest organization.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1
What is the name of the organization that was formed most recently?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Find the last name of the latest contact individual of the organization "Labour Party".
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
What is the last name of the contact individual from the Labour party organization who was contacted most recently?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Find the last name of the first ever contact person of the organization with the highest UK Vat number.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT count(*) FROM services
How many services are there?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT count(*) FROM services
Count the number of services.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Find name of the services that has never been used.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
What are the names of the services that have never been used?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses
Find the name of all the cities and states.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses
What are the names of all cities and states?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT count(*) FROM addresses WHERE state_province_county = "Colorado"
How many cities are there in state "Colorado"?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT count(*) FROM addresses WHERE state_province_county = "Colorado"
Count the number of cities in the state of Colorado.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3
Find the payment method code used by more than 3 parties.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3
What are the payment method codes that have been used by more than 3 parties?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"
Find the name of organizations whose names contain "Party".
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"
What are the names of organizations that contain the word "Party"?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT count(DISTINCT payment_method_code) FROM parties
How many distinct payment methods are used by parties?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT count(DISTINCT payment_method_code) FROM parties
Count the number of different payment method codes used by parties.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Which is the email of the party that has used the services the most number of times?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Return the party email that has used party services the greatest number of times.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
Which state can address "6862 Kaitlyn Knolls" possibly be in?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
Give the state corresponding to the line number building "6862 Kaitlyn Knolls".
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
What is the name of organization that has the greatest number of contact individuals?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
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
Return the name of the organization which has the most contact individuals.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id
Find the last name of the individuals that have been contact individuals of an organization.
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
e_government
SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id
What are the last names of individuals who have been contact individuals for an organization?
[Schema (values) (types)]: | e_government | Addresses : address_id (text) , line_1_number_building (number) , town_city (text) , zip_postcode (text) , state_province_county (text) , country (text) | Services : service_id (text) , service_type_code (number) , service_name (text) , service_descriptio (text) | Forms : form_id (text) , form_type_code (number) , service_id (text) , form_number (text) , form_name (text) , form_description (text) | Individuals : individual_id (text) , individual_first_name (number) , individual_middle_name (text) , inidividual_phone (text) , individual_email (text) , individual_address (text) , individual_last_name (text) | Organizations : organization_id (text) , date_formed (number) , organization_name (text) , uk_vat_number (text) | Parties : party_id (text) , payment_method_code (number) , party_phone (text) , party_email (text) | Organization_Contact_Individuals : individual_id (text) , organization_id (number) , date_contact_from (text) , date_contact_to (text) | Party_Addresses : party_id (text) , address_id (number) , date_address_from (text) , address_type_code (text) , date_address_to (text) | Party_Forms : party_id (text) , form_id (number) , date_completion_started (text) , form_status_code (text) , date_fully_completed (text) | Party_Services : booking_id (text) , customer_id (number) , service_id (text) , service_datetime (text) , booking_made_date (text);
[Primary Keys]: addresses : address_id, services : service_id, forms : form_id, individuals : individual_id, organizations : organization_id, parties : party_id, organization_contact_individuals : individual_id, party_addresses : party_id, party_forms : party_id
[Foreign Keys]: forms : service_id = services : service_id | organization_contact_individuals : individual_id = individuals : individual_id | organization_contact_individuals : organization_id = organizations : organization_id | party_addresses : party_id = parties : party_id | party_addresses : address_id = addresses : address_id | party_forms : form_id = forms : form_id | party_forms : party_id = parties : party_id | party_services : customer_id = parties : party_id | party_services : service_id = services : service_id
school_bus
SELECT count(*) FROM driver
How many drivers are there?
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT name , home_city , age FROM driver
Show the name, home city, and age for all drivers.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT party , count(*) FROM driver GROUP BY party
Show the party and the number of drivers in each party.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT name FROM driver ORDER BY age DESC
Show the name of drivers in descending order of age.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT DISTINCT home_city FROM driver
Show all different home cities.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1
Show the home city with the most number of drivers.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40
Show the party with drivers from Hartford and drivers older than 40.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING count(*) >= 2
Show home city where at least two drivers older than 40 are from.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40
Show all home cities except for those having a driver older than 40.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT name FROM driver WHERE driver_id NOT IN (SELECT driver_id FROM school_bus)
Show the names of the drivers without a school bus.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT TYPE FROM school GROUP BY TYPE HAVING count(*) = 2
Show the types of schools that have two schools.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
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
Show the school name and driver name for all school buses.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT max(years_working) , min(years_working) , avg(years_working) FROM school_bus
What is the maximum, minimum and average years spent working on a school bus?
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT school , TYPE FROM school WHERE school_id NOT IN (SELECT school_id FROM school_bus)
Show the school name and type for schools without a school bus.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT T2.type , count(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type
Show the type of school and the number of buses for each type.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT count(*) FROM driver WHERE home_city = 'Hartford' OR age < 40
How many drivers are from Hartford city or younger than 40?
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40
List names for drivers from Hartford city and younger than 40.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
school_bus
SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id = t2.driver_id ORDER BY years_working DESC LIMIT 1
find the name of driver who is driving the school bus with the longest working history.
[Schema (values) (types)]: | school_bus | driver : driver_id (text) , name (number) , party (text) , home_city (text) , age (text) | school : school_id (text) , grade (number) , school (text) , location (text) , type (text) | school_bus : school_id (text) , driver_id (number) , years_working (text) , if_full_time (text);
[Primary Keys]: driver : driver_id, school : school_id, school_bus : school_id
[Foreign Keys]: school_bus : driver_id = driver : driver_id | school_bus : school_id = school : school_id
flight_company
SELECT count(*) FROM flight WHERE velocity > 200
How many flights have a velocity larger than 200?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT vehicle_flight_number , date , pilot FROM flight ORDER BY altitude ASC
List the vehicle flight number, date and pilot of all the flights, ordered by altitude.
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT id , country , city , name FROM airport ORDER BY name
List the id, country, city and name of the airports ordered alphabetically by the name.
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT max(group_equity_shareholding) FROM operate_company
What is maximum group equity shareholding of the companies?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT avg(velocity) FROM flight WHERE pilot = 'Thompson'
What is the velocity of the pilot named 'Thompson'?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT T1.name , T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
What are the names and types of the companies that have ever operated a flight?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT name FROM airport WHERE country != 'Iceland'
What are the names of the airports which are not in the country 'Iceland'?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200
What are the distinct types of the companies that have operated any flights with velocity less than 200?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT T1.id , T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING count(*) > 1
What are the ids and names of the companies that operated more than one flight?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT T1.id , T1.name , T1.IATA FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
What is the id, name and IATA code of the airport that had most number of flights?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT TYPE , count(*) FROM operate_company GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
What is the most common company type, and how many are there?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT count(*) FROM airport WHERE id NOT IN ( SELECT airport_id FROM flight WHERE pilot = 'Thompson' );
How many airports haven't the pilot 'Thompson' driven an aircraft?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Cargo' INTERSECT SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Catering services'
List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities.
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT name FROM airport WHERE name LIKE '%international%'
Which of the airport names contains the word 'international'?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT T3.id , count(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id
How many companies operates airlines in each airport?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT count(*) , country FROM airport GROUP BY country
how many airports are there in each country?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT country FROM airport GROUP BY country HAVING count(*) > 2
which countries have more than 2 airports?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
flight_company
SELECT pilot FROM flight GROUP BY pilot ORDER BY count(*) DESC LIMIT 1
which pilot is in charge of the most number of flights?
[Schema (values) (types)]: | flight_company | airport : id (text) , city (number) , country (text) , iata (text) , icao (text) , name (text) | operate_company : id (text) , name (number) , type (text) , principal_activities (text) , incorporated_in (text) , group_equity_shareholding (text) | flight : id (text) , vehicle_flight_number (number) , date (text) , pilot (text) , velocity (text) , altitude (text) , airport_id (text) , company_id (number);
[Primary Keys]: airport : id, operate_company : id, flight : id
[Foreign Keys]: flight : company_id = operate_company : id | flight : airport_id = airport : id
cre_Docs_and_Epenses
SELECT count(*) FROM Accounts
How many accounts do we have?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT count(*) FROM Accounts
Count the number of accounts.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT account_id , account_details FROM Accounts
Show all account ids and account details.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT account_id , account_details FROM Accounts
What are the ids and details of all accounts?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT count(*) FROM Statements
How many statements do we have?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT count(*) FROM Statements
Count the number of statements.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT STATEMENT_ID , statement_details FROM Statements
List all statement ids and statement details.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT STATEMENT_ID , statement_details FROM Statements
What are the ids and details of all statements?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
Show statement id, statement detail, account detail for accounts.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
What are the statement ids, statement details, and account details, for all accounts?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID
Show all statement id and the number of accounts for each statement.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID
What are the different statement ids on accounts, and the number of accounts for each?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
Show the statement id and the statement detail for the statement with most number of accounts.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
What are the statement id and statement detail for the statement that has the most corresponding accounts?
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id
cre_Docs_and_Epenses
SELECT count(*) FROM Documents
Show the number of documents.
[Schema (values) (types)]: | cre_Docs_and_Epenses | Ref_Document_Types : document_type_code (text) , document_type_name (text) , document_type_description (text) | Ref_Budget_Codes : budget_type_code (text) , budget_type_description (text) | Projects : project_id (text) , project_details (text) | Documents : document_id (text) , document_type_code (text) , project_id (text) , document_date (text) , document_name (text) , document_description (text) , other_details (number) | Statements : statement_id (text) , statement_details (text) | Documents_with_Expenses : document_id (text) , budget_type_code (text) , document_details (text) | Accounts : account_id (text) , statement_id (text) , account_details (text);
[Primary Keys]: ref_document_types : document_type_code, ref_budget_codes : budget_type_code, projects : project_id, documents : document_id, statements : statement_id, documents_with_expenses : document_id, accounts : account_id
[Foreign Keys]: documents : project_id = projects : project_id | documents : document_type_code = ref_document_types : document_type_code | statements : statement_id = documents : document_id | documents_with_expenses : document_id = documents : document_id | documents_with_expenses : budget_type_code = ref_budget_codes : budget_type_code | accounts : statement_id = statements : statement_id