Database: e_government
Schema: Addresses: address_id (number), line_1_number_building (text), town_city (text), zip_postcode (text), state_province_county (text), country (text) | Services: service_id (number), service_type_code (text), service_name (text), service_descriptio (text) | Forms: form_id (number), form_type_code (text), service_id (number), form_number (text), form_name (text), form_description (text) | Individuals: individual_id (number), individual_first_name (text), individual_middle_name (text), inidividual_phone (text), individual_email (text), individual_address (text), individual_last_name (text) | Organizations: organization_id (number), date_formed (time), organization_name (text), uk_vat_number (text) | Parties: party_id (number), payment_method_code (text), party_phone (text), party_email (text) | Organization_Contact_Individuals: individual_id (number), organization_id (number), date_contact_from (time), date_contact_to (time) | Party_Addresses: party_id (number), address_id (number), date_address_from (time), address_type_code (text), date_address_to (time) | Party_Forms: party_id (number), form_id (number), date_completion_started (time), form_status_code (text), date_fully_completed (time) | Party_Services: booking_id (number), customer_id (number), service_id (number), service_datetime (time), booking_made_date (time)

Question: List every individual's first name, middle name and last name in alphabetical order by last name.
SQL: SELECT individual_first_name ,  individual_middle_name ,  individual_last_name FROM individuals ORDER BY individual_last_name

Question: What are the first, middle, and last names of all individuals, ordered by last name?
SQL: SELECT individual_first_name ,  individual_middle_name ,  individual_last_name FROM individuals ORDER BY individual_last_name

Question: List all the types of forms.
SQL: SELECT DISTINCT form_type_code FROM forms

Question: What are the different types of forms?
SQL: SELECT DISTINCT form_type_code FROM forms

Question: Find the name of the most popular party form.
SQL: 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

Question: What is the name of the party form that is most common?
SQL: 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

Question: Find the payment method and phone of the party with email "enrico09@example.com".
SQL: SELECT payment_method_code ,  party_phone FROM parties WHERE party_email  =  "enrico09@example.com"

Question: What is the payment method code and party phone of the party with the email 'enrico09@example.com'?
SQL: SELECT payment_method_code ,  party_phone FROM parties WHERE party_email  =  "enrico09@example.com"

Question: Find the emails of parties with the most popular party form.
SQL: 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)

Question: What are the party emails associated with parties that used the party form that is the most common?
SQL: 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)

Question: List all the name of organizations in order of the date formed.
SQL: SELECT organization_name FROM organizations ORDER BY date_formed ASC

Question: What are the names of organizations, ordered by the date they were formed, ascending?
SQL: SELECT organization_name FROM organizations ORDER BY date_formed ASC

Question: Find the name of the youngest organization.
SQL: SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1

Question: What is the name of the organization that was formed most recently?
SQL: SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1

Question: Find the last name of the latest contact individual of the organization "Labour Party".
SQL: 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

Question: What is the last name of the contact individual from the Labour party organization who was contacted most recently?
SQL: 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

Question: Find the last name of the first ever contact person of the organization with the highest UK Vat number.
SQL: 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

Question: What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations?
SQL: 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

Question: How many services are there?
SQL: SELECT count(*) FROM services

Question: Count the number of services.
SQL: SELECT count(*) FROM services

Question: Find name of the services that has never been used.
SQL: 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

Question: What are the names of the services that have never been used?
SQL: 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

Question: Find the name of all the cities and states.
SQL: SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses

Question: What are the names of all cities and states?
SQL: SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses

Question: How many cities are there in state "Colorado"?
SQL: SELECT count(*) FROM addresses WHERE state_province_county  =  "Colorado"

Question: Count the number of cities in the state of Colorado.
SQL: SELECT count(*) FROM addresses WHERE state_province_county  =  "Colorado"

Question: Find the payment method code used by more than 3 parties.
SQL: SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*)  >  3

Question: What are the payment method codes that have been used by more than 3 parties?
SQL: SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*)  >  3

Question: Find the name of organizations whose names contain "Party".
SQL: SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"

Question: What are the names of organizations that contain the word "Party"?
SQL: SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"

Question: How many distinct payment methods are used by parties?
SQL: SELECT count(DISTINCT payment_method_code) FROM parties

Question: Count the number of different payment method codes used by parties.
SQL: SELECT count(DISTINCT payment_method_code) FROM parties

Question: Which is the email of the party that has used the services the most number of times?
SQL: 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

Question: Return the party email that has used party services the greatest number of times.
SQL: 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

Question: Which state can address "6862 Kaitlyn Knolls" possibly be in?
SQL: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"

Question: Give the state corresponding to the line number building "6862 Kaitlyn Knolls".
SQL: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"

Question: What is the name of organization that has the greatest number of contact individuals?
SQL: 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

Question: Return the name of the organization which has the most contact individuals.
SQL: 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

Question: Find the last name of the individuals that have been contact individuals of an organization.
SQL: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id  =  t2.individual_id

Question: What are the last names of individuals who have been contact individuals for an organization?
SQL: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id  =  t2.individual_id