cnatale/presto-athena-txt-2-sql huggingface dataset:
Return the number of United Airlines flights leaving from AHD Airport.
Additional table information: table: flight_2
SQL: SELECT COUNT(*) FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.SourceAirport = 'AHD'
How many United Airlines flights go to City 'Aberdeen'?
Additional table information: table: flight_2
SQL: SELECT COUNT(*) FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode JOIN AIRLINES AS T3 ON T3.uid = T1.Airline WHERE T2.City = 'Aberdeen' AND T3.Airline = 'United Airlines'
Count the number of United Airlines flights that arrive in Aberdeen.
Additional table information: table: flight_2
SQL: SELECT COUNT(*) FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode JOIN AIRLINES AS T3 ON T3.uid = T1.Airline WHERE T2.City = 'Aberdeen' AND T3.Airline = 'United Airlines'
Which city has most number of arriving flights?
Additional table information: table: flight_2
SQL: SELECT T1.City FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport GROUP BY T1.City ORDER BY COUNT(*) DESC LIMIT 1
Which city has the most frequent destination airport?
Additional table information: table: flight_2
SQL: SELECT T1.City FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport GROUP BY T1.City ORDER BY COUNT(*) DESC LIMIT 1
Which city has most number of departing flights?
Additional table information: table: flight_2
SQL: SELECT T1.City FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.SourceAirport GROUP BY T1.City ORDER BY COUNT(*) DESC LIMIT 1
Which city is the most frequent source airport?
Additional table information: table: flight_2
SQL: SELECT T1.City FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.SourceAirport GROUP BY T1.City ORDER BY COUNT(*) DESC LIMIT 1
What is the code of airport that has the highest number of flights?
Additional table information: table: flight_2
SQL: SELECT T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) DESC LIMIT 1
What is the airport code of the airport with the most flights?
Additional table information: table: flight_2
SQL: SELECT T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) DESC LIMIT 1
What is the code of airport that has fewest number of flights?
Additional table information: table: flight_2
SQL: SELECT T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) NULLS FIRST LIMIT 1
Give the code of the airport with the least flights.
Additional table information: table: flight_2
SQL: SELECT T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) NULLS FIRST LIMIT 1
Which airline has most number of flights?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline ORDER BY COUNT(*) DESC LIMIT 1
What airline serves the most flights?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline ORDER BY COUNT(*) DESC LIMIT 1
Find the abbreviation and country of the airline that has fewest number of flights?
Additional table information: table: flight_2
SQL: SELECT T1.Abbreviation, T1.Country FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline ORDER BY COUNT(*) NULLS FIRST LIMIT 1
What is the abbreviation of the airilne has the fewest flights and what country is it in?
Additional table information: table: flight_2
SQL: SELECT T1.Abbreviation, T1.Country FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline ORDER BY COUNT(*) NULLS FIRST LIMIT 1
What are airlines that have some flight departing from airport 'AHD'?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'AHD'
Which airlines have a flight with source airport AHD?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'AHD'
What are airlines that have flights arriving at airport 'AHD'?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.DestAirport = 'AHD'
Which airlines have a flight with destination airport AHD?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.DestAirport = 'AHD'
Find all airlines that have flights from both airports 'APG' and 'CVO'.
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'APG' INTERSECT SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'CVO'
Which airlines have departing flights from both APG and CVO airports?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'APG' INTERSECT SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'CVO'
Find all airlines that have flights from airport 'CVO' but not from 'APG'.
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'CVO' EXCEPT SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'APG'
Which airlines have departures from CVO but not from APG airports?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'CVO' EXCEPT SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'APG'
Find all airlines that have at least 10 flights.
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) > 10
Which airlines have at least 10 flights?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) > 10
Find all airlines that have fewer than 200 flights.
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) < 200
Which airlines have less than 200 flights?
Additional table information: table: flight_2
SQL: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) < 200
What are flight numbers of Airline 'United Airlines'?
Additional table information: table: flight_2
SQL: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = 'United Airlines'
Which flight numbers correspond to United Airlines flights?
Additional table information: table: flight_2
SQL: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = 'United Airlines'
What are flight numbers of flights departing from Airport 'APG'?
Additional table information: table: flight_2
SQL: SELECT FlightNo FROM FLIGHTS WHERE SourceAirport = 'APG'
Give the flight numbers of flights leaving from APG.
Additional table information: table: flight_2
SQL: SELECT FlightNo FROM FLIGHTS WHERE SourceAirport = 'APG'
What are flight numbers of flights arriving at Airport 'APG'?
Additional table information: table: flight_2
SQL: SELECT FlightNo FROM FLIGHTS WHERE DestAirport = 'APG'
Give the flight numbers of flights landing at APG.
Additional table information: table: flight_2
SQL: SELECT FlightNo FROM FLIGHTS WHERE DestAirport = 'APG'
What are flight numbers of flights departing from City 'Aberdeen '?
Additional table information: table: flight_2
SQL: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.SourceAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'
Give the flight numbers of flights leaving from Aberdeen.
Additional table information: table: flight_2
SQL: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.SourceAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'
What are flight numbers of flights arriving at City 'Aberdeen'?
Additional table information: table: flight_2
SQL: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'
Give the flight numbers of flights arriving in Aberdeen.
Additional table information: table: flight_2
SQL: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'
Find the number of flights landing in the city of Aberdeen or Abilene.
Additional table information: table: flight_2
SQL: SELECT COUNT(*) FROM Flights AS T1 JOIN Airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.city = 'Aberdeen' OR T2.city = 'Abilene'
How many flights land in Aberdeen or Abilene?
Additional table information: table: flight_2
SQL: SELECT COUNT(*) FROM Flights AS T1 JOIN Airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.city = 'Aberdeen' OR T2.city = 'Abilene'
Find the name of airports which do not have any flight in and out.
Additional table information: table: flight_2
SQL: SELECT AirportName FROM Airports WHERE NOT AirportCode IN (SELECT SourceAirport FROM Flights UNION SELECT DestAirport FROM Flights)
Which airports do not have departing or arriving flights?
Additional table information: table: flight_2
SQL: SELECT AirportName FROM Airports WHERE NOT AirportCode IN (SELECT SourceAirport FROM Flights UNION SELECT DestAirport FROM Flights)
How many employees are there?
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*) FROM employee
Count the number of employees
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*) FROM employee
Sort employee names by their age in ascending order.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM employee ORDER BY age NULLS FIRST
List the names of employees and sort in ascending order of age.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM employee ORDER BY age NULLS FIRST
What is the number of employees from each city?
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*), city FROM employee GROUP BY city
Count the number of employees for each city.
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*), city FROM employee GROUP BY city
Which cities do more than one employee under age 30 come from?
Additional table information: table: employee_hire_evaluation
SQL: SELECT city FROM employee WHERE age < 30 GROUP BY city HAVING COUNT(*) > 1
Find the cities that have more than one employee under age 30.
Additional table information: table: employee_hire_evaluation
SQL: SELECT city FROM employee WHERE age < 30 GROUP BY city HAVING COUNT(*) > 1
Find the number of shops in each location.
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*), LOCATION FROM shop GROUP BY LOCATION
How many shops are there in each location?
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*), LOCATION FROM shop GROUP BY LOCATION
Find the manager name and district of the shop whose number of products is the largest.
Additional table information: table: employee_hire_evaluation
SQL: SELECT manager_name, district FROM shop ORDER BY number_products DESC LIMIT 1
What are the manager name and district of the shop that sells the largest number of products?
Additional table information: table: employee_hire_evaluation
SQL: SELECT manager_name, district FROM shop ORDER BY number_products DESC LIMIT 1
find the minimum and maximum number of products of all stores.
Additional table information: table: employee_hire_evaluation
SQL: SELECT MIN(Number_products), MAX(Number_products) FROM shop
What are the minimum and maximum number of products across all the shops?
Additional table information: table: employee_hire_evaluation
SQL: SELECT MIN(Number_products), MAX(Number_products) FROM shop
Return the name, location and district of all shops in descending order of number of products.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name, LOCATION, district FROM shop ORDER BY number_products DESC
Sort all the shops by number products in descending order, and return the name, location and district of each shop.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name, LOCATION, district FROM shop ORDER BY number_products DESC
Find the names of stores whose number products is more than the average number of products.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM shop WHERE number_products > (SELECT AVG(number_products) FROM shop)
Which shops' number products is above the average? Give me the shop names.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM shop WHERE number_products > (SELECT AVG(number_products) FROM shop)
find the name of employee who was awarded the most times in the evaluation.
Additional table information: table: employee_hire_evaluation
SQL: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY COUNT(*) DESC LIMIT 1
Which employee received the most awards in evaluations? Give me the employee name.
Additional table information: table: employee_hire_evaluation
SQL: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY COUNT(*) DESC LIMIT 1
Find the name of the employee who got the highest one time bonus.
Additional table information: table: employee_hire_evaluation
SQL: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID ORDER BY t2.bonus DESC LIMIT 1
Which employee received the biggest bonus? Give me the employee name.
Additional table information: table: employee_hire_evaluation
SQL: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID ORDER BY t2.bonus DESC LIMIT 1
Find the names of employees who never won any award in the evaluation.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM employee WHERE NOT Employee_ID IN (SELECT Employee_ID FROM evaluation)
What are the names of the employees who never received any evaluation?
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM employee WHERE NOT Employee_ID IN (SELECT Employee_ID FROM evaluation)
What is the name of the shop that is hiring the largest number of employees?
Additional table information: table: employee_hire_evaluation
SQL: SELECT t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t1.shop_id ORDER BY COUNT(*) DESC LIMIT 1
Which shop has the most employees? Give me the shop name.
Additional table information: table: employee_hire_evaluation
SQL: SELECT t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t1.shop_id ORDER BY COUNT(*) DESC LIMIT 1
Find the name of the shops that do not hire any employee.
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM hiring)
Which shops run with no employees? Find the shop names
Additional table information: table: employee_hire_evaluation
SQL: SELECT name FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM hiring)
Find the number of employees hired in each shop; show the shop name as well.
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*), t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name
For each shop, return the number of employees working there and the name of the shop.
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(*), t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name
What is total bonus given in all evaluations?
Additional table information: table: employee_hire_evaluation
SQL: SELECT SUM(bonus) FROM evaluation
Find the total amount of bonus given in all the evaluations.
Additional table information: table: employee_hire_evaluation
SQL: SELECT SUM(bonus) FROM evaluation
Give me all the information about hiring.
Additional table information: table: employee_hire_evaluation
SQL: SELECT * FROM hiring
What is all the information about hiring?
Additional table information: table: employee_hire_evaluation
SQL: SELECT * FROM hiring
Which district has both stores with less than 3000 products and stores with more than 10000 products?
Additional table information: table: employee_hire_evaluation
SQL: SELECT district FROM shop WHERE Number_products < 3000 INTERSECT SELECT district FROM shop WHERE Number_products > 10000
Find the districts in which there are both shops selling less than 3000 products and shops selling more than 10000 products.
Additional table information: table: employee_hire_evaluation
SQL: SELECT district FROM shop WHERE Number_products < 3000 INTERSECT SELECT district FROM shop WHERE Number_products > 10000
How many different store locations are there?
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(DISTINCT LOCATION) FROM shop
Count the number of distinct store locations.
Additional table information: table: employee_hire_evaluation
SQL: SELECT COUNT(DISTINCT LOCATION) FROM shop
How many documents do we have?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Documents
Count the number of documents.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Documents
List document IDs, document names, and document descriptions for all documents.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id, document_name, document_description FROM Documents
What are the ids, names, and descriptions for all documents?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id, document_name, document_description FROM Documents
What is the document name and template id for document with description with the letter 'w' in it?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_name, template_id FROM Documents WHERE Document_Description LIKE '%w%'
Return the names and template ids for documents that contain the letter w in their description.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_name, template_id FROM Documents WHERE Document_Description LIKE '%w%'
What is the document id, template id and description for document named 'Robbin CV'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id, template_id, Document_Description FROM Documents WHERE document_name = 'Robbin CV'
Return the document id, template id, and description for the document with the name Robbin CV.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id, template_id, Document_Description FROM Documents WHERE document_name = 'Robbin CV'
How many different templates do all document use?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(DISTINCT template_id) FROM Documents
Count the number of different templates used for documents.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(DISTINCT template_id) FROM Documents
How many documents are using the template with type code 'PPT'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Template_Type_Code = 'PPT'
Count the number of documents that use the PPT template type.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Template_Type_Code = 'PPT'
Show all template ids and number of documents using each template.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id, COUNT(*) FROM Documents GROUP BY template_id
What are all different template ids used for documents, and how many times were each of them used?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id, COUNT(*) FROM Documents GROUP BY template_id
What is the id and type code for the template used by the most documents?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_id, T2.Template_Type_Code FROM Documents AS T1 JOIN Templates AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_id ORDER BY COUNT(*) DESC LIMIT 1
Return the id and type code of the template that is used for the greatest number of documents.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_id, T2.Template_Type_Code FROM Documents AS T1 JOIN Templates AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_id ORDER BY COUNT(*) DESC LIMIT 1
Show ids for all templates that are used by more than one document.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id FROM Documents GROUP BY template_id HAVING COUNT(*) > 1
What are the template ids of any templates used in more than a single document?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id FROM Documents GROUP BY template_id HAVING COUNT(*) > 1
Show ids for all templates not used by any document.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents
What are the ids for templates that are not used in any documents?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents
How many templates do we have?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Templates
Count the number of templates.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Templates
Show template ids, version numbers, and template type codes for all templates.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id, version_number, template_type_code FROM Templates
What are the ids, version numbers, and type codes for each template?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id, version_number, template_type_code FROM Templates
Show all distinct template type codes for all templates.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT DISTINCT template_type_code FROM Templates
What are the different template type codes?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT DISTINCT template_type_code FROM Templates
What are the ids of templates with template type code PP or PPT?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id FROM Templates WHERE template_type_code = 'PP' OR template_type_code = 'PPT'
Return the ids of templates that have the code PP or PPT.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_id FROM Templates WHERE template_type_code = 'PP' OR template_type_code = 'PPT'
How many templates have template type code CV?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Templates WHERE template_type_code = 'CV'
Count the number of templates of the type CV.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Templates WHERE template_type_code = 'CV'
What is the version number and template type code for the template with version number later than 5?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT version_number, template_type_code FROM Templates WHERE version_number > 5
Return the version numbers and template type codes of templates with a version number greater than 5.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT version_number, template_type_code FROM Templates WHERE version_number > 5
Show all template type codes and number of templates for each.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code, COUNT(*) FROM Templates GROUP BY template_type_code
What are the different template type codes, and how many templates correspond to each?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code, COUNT(*) FROM Templates GROUP BY template_type_code
Which template type code has most number of templates?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Templates GROUP BY template_type_code ORDER BY COUNT(*) DESC LIMIT 1
Return the type code of the template type that the most templates belong to.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Templates GROUP BY template_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show all template type codes with less than three templates.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING COUNT(*) < 3
What are the codes of template types that have fewer than 3 templates?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING COUNT(*) < 3
What the smallest version number and its template type code?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT MIN(Version_Number), template_type_code FROM Templates
Return the lowest version number, along with its corresponding template type code.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT MIN(Version_Number), template_type_code FROM Templates
What is the template type code of the template used by document with the name 'Data base'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T2.document_name = 'Data base'
Return the template type code of the template that is used by a document named Data base.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T2.document_name = 'Data base'
Show all document names using templates with template type code BK.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T1.template_type_code = 'BK'
What are the names of documents that use templates with the code BK?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T1.template_type_code = 'BK'
Show all template type codes and the number of documents using each type.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_type_code, COUNT(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code
What are the different template type codes, and how many documents use each type?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_type_code, COUNT(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code
Which template type code is used by most number of documents?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code ORDER BY COUNT(*) DESC LIMIT 1
Return the code of the template type that is most commonly used in documents.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show all template type codes that are not used by any document.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Templates EXCEPT SELECT template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id
What are the codes of template types that are not used for any document?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Templates EXCEPT SELECT template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id
Show all template type codes and descriptions.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code, template_type_description FROM Ref_template_types
What are the type codes and descriptions for all template types?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code, template_type_description FROM Ref_template_types
What is the template type descriptions for template type code 'AD'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_description FROM Ref_template_types WHERE template_type_code = 'AD'
Return the template type description of the template type with the code AD.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_description FROM Ref_template_types WHERE template_type_code = 'AD'
What is the template type code for template type description 'Book'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Ref_template_types WHERE template_type_description = 'Book'
Return the type code of the template type with the description 'Book'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT template_type_code FROM Ref_template_types WHERE template_type_description = 'Book'
What are the distinct template type descriptions for the templates ever used by any document?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID = T3.template_ID
Return the different descriptions for templates that have been used in a document.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID = T3.template_ID
What are the template ids with template type description 'Presentation'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T2.template_id FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code WHERE T1.template_type_description = 'Presentation'
Return the ids corresponding to templates with the description 'Presentation'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T2.template_id FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code WHERE T1.template_type_description = 'Presentation'
How many paragraphs in total?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Paragraphs
Count the number of paragraphs.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Paragraphs
How many paragraphs for the document with name 'Summer Show'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID = T2.document_ID WHERE T2.document_name = 'Summer Show'
Count the number of paragraphs in the document named 'Summer Show'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID = T2.document_ID WHERE T2.document_name = 'Summer Show'
Show paragraph details for paragraph with text 'Korea ' .
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT other_details FROM paragraphs WHERE paragraph_text LIKE 'korea'
What are the details for the paragraph that includes the text 'Korea ' ?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT other_details FROM paragraphs WHERE paragraph_text LIKE 'korea'
Show all paragraph ids and texts for the document with name 'Welcome to NY'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.paragraph_id, T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.Document_Name = 'Welcome to NY'
What are the ids and texts of paragraphs in the document titled 'Welcome to NY'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.paragraph_id, T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.Document_Name = 'Welcome to NY'
Show all paragraph texts for the document 'Customer reviews'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = 'Customer reviews'
What are the paragraph texts for the document with the name 'Customer reviews'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = 'Customer reviews'
Show all document ids and the number of paragraphs in each document. Order by document id.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id, COUNT(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id NULLS FIRST
Return the different document ids along with the number of paragraphs corresponding to each, ordered by id.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id, COUNT(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id NULLS FIRST
Show all document ids, names and the number of paragraphs in each document.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.document_id, T2.document_name, COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id
What are the ids and names of each document, as well as the number of paragraphs in each?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.document_id, T2.document_name, COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id
List all document ids with at least two paragraphs.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) >= 2
What are the ids of documents that have 2 or more paragraphs?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) >= 2
What is the document id and name with greatest number of paragraphs?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.document_id, T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY COUNT(*) DESC LIMIT 1
Return the id and name of the document with the most paragraphs.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT T1.document_id, T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY COUNT(*) DESC LIMIT 1
What is the document id with least number of paragraphs?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Return the id of the document with the fewest paragraphs.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
What is the document id with 1 to 2 paragraphs?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) BETWEEN 1 AND 2
Give the ids of documents that have between one and two paragraphs.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) BETWEEN 1 AND 2
Show the document id with paragraph text 'Brazil' and 'Ireland'.
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Brazil' INTERSECT SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Ireland'
What are the ids of documents that contain the paragraph text 'Brazil' and 'Ireland'?
Additional table information: table: cre_Doc_Template_Mgt
SQL: SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Brazil' INTERSECT SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Ireland'
How many teachers are there?
Additional table information: table: course_teach
SQL: SELECT COUNT(*) FROM teacher
What is the total count of teachers?
Additional table information: table: course_teach
SQL: SELECT COUNT(*) FROM teacher
List the names of teachers in ascending order of age.
Additional table information: table: course_teach
SQL: SELECT Name FROM teacher ORDER BY Age ASC NULLS FIRST
What are the names of the teachers ordered by ascending age?
Additional table information: table: course_teach
SQL: SELECT Name FROM teacher ORDER BY Age ASC NULLS FIRST
What are the age and hometown of teachers?
Additional table information: table: course_teach
SQL: SELECT Age, Hometown FROM teacher
What is the age and hometown of every teacher?
Additional table information: table: course_teach
SQL: SELECT Age, Hometown FROM teacher
List the name of teachers whose hometown is not `` Little Lever Urban District '' .
Additional table information: table: course_teach
SQL: SELECT name FROM teacher WHERE hometown <> 'little lever urban district'
What are the names of the teachers whose hometown is not `` Little Lever Urban District '' ?
Additional table information: table: course_teach
SQL: SELECT name FROM teacher WHERE hometown <> 'little lever urban district'
Show the name of teachers aged either 32 or 33?
Additional table information: table: course_teach
SQL: SELECT Name FROM teacher WHERE Age = 32 OR Age = 33
What are the names of the teachers who are aged either 32 or 33?
Additional table information: table: course_teach
SQL: SELECT Name FROM teacher WHERE Age = 32 OR Age = 33
What is the hometown of the youngest teacher?
Additional table information: table: course_teach
SQL: SELECT Hometown FROM teacher ORDER BY Age ASC NULLS FIRST LIMIT 1
Where is the youngest teacher from?
Additional table information: table: course_teach
SQL: SELECT Hometown FROM teacher ORDER BY Age ASC NULLS FIRST LIMIT 1
Show different hometown of teachers and the number of teachers from each hometown.
Additional table information: table: course_teach
SQL: SELECT Hometown, COUNT(*) FROM teacher GROUP BY Hometown
For each hometown, how many teachers are there?
Additional table information: table: course_teach
SQL: SELECT Hometown, COUNT(*) FROM teacher GROUP BY Hometown
List the most common hometown of teachers.
Additional table information: table: course_teach
SQL: SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1
What is the most commmon hometowns for teachers?
Additional table information: table: course_teach
SQL: SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1
Show the hometowns shared by at least two teachers.
Additional table information: table: course_teach
SQL: SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2
What are the towns from which at least two teachers come from?
Additional table information: table: course_teach
SQL: SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2
Show names of teachers and the courses they are arranged to teach.
Additional table information: table: course_teach
SQL: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID
What is the name of each teacher and what course they teach?
Additional table information: table: course_teach
SQL: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID
Show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name.
Additional table information: table: course_teach
SQL: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name NULLS FIRST
What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?
Additional table information: table: course_teach
SQL: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name NULLS FIRST
Show the name of the teacher for the math course.
Additional table information: table: course_teach
SQL: SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID WHERE T2.Course = 'Math'
What are the names of the people who teach math courses?
Additional table information: table: course_teach
SQL: SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID WHERE T2.Course = 'Math'
Show names of teachers and the number of courses they teach.
Additional table information: table: course_teach
SQL: SELECT T2.Name, COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name
What are the names of the teachers and how many courses do they teach?
Additional table information: table: course_teach
SQL: SELECT T2.Name, COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name
Show names of teachers that teach at least two courses.
Additional table information: table: course_teach
SQL: SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
What are the names of the teachers who teach at least two courses?
Additional table information: table: course_teach
SQL: SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
List the names of teachers who have not been arranged to teach courses.
Additional table information: table: course_teach
SQL: SELECT Name FROM teacher WHERE NOT Teacher_id IN (SELECT Teacher_id FROM course_arrange)
What are the names of the teachers whose courses have not been arranged?
Additional table information: table: course_teach
SQL: SELECT Name FROM teacher WHERE NOT Teacher_id IN (SELECT Teacher_id FROM course_arrange)
How many visitors below age 30 are there?
Additional table information: table: museum_visit
SQL: SELECT COUNT(*) FROM visitor WHERE age < 30
Find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low.
Additional table information: table: museum_visit
SQL: SELECT name FROM visitor WHERE Level_of_membership > 4 ORDER BY Level_of_membership DESC
What is the average age of the visitors whose membership level is not higher than 4?
Additional table information: table: museum_visit
SQL: SELECT AVG(age) FROM visitor WHERE Level_of_membership <= 4
Find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young.
Additional table information: table: museum_visit
SQL: SELECT name, Level_of_membership FROM visitor WHERE Level_of_membership > 4 ORDER BY age DESC
Find the id and name of the museum that has the most staff members?
Additional table information: table: museum_visit
SQL: SELECT museum_id, name FROM museum ORDER BY num_of_staff DESC LIMIT 1
Find the average number of staff working for the museums that were open before 2009.
Additional table information: table: museum_visit
SQL: SELECT AVG(num_of_staff) FROM museum WHERE open_year < 2009
What are the opening year and staff number of the museum named Plaza Museum?
Additional table information: table: museum_visit
SQL: SELECT Num_of_Staff, Open_Year FROM museum WHERE name = 'Plaza Museum'
find the names of museums which have more staff than the minimum staff number of all museums opened after 2010.
Additional table information: table: museum_visit
SQL: SELECT name FROM museum WHERE num_of_staff > (SELECT MIN(num_of_staff) FROM museum WHERE open_year > 2010)
find the id, name and age for visitors who visited some museums more than once.
Additional table information: table: museum_visit
SQL: SELECT t1.id, t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t1.id HAVING COUNT(*) > 1
What are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets?
Additional table information: table: museum_visit
SQL: SELECT t2.visitor_id, t1.name, t1.Level_of_membership FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t2.visitor_id ORDER BY SUM(t2.Total_spent) DESC LIMIT 1
What are the id and name of the museum visited most times?
Additional table information: table: museum_visit
SQL: SELECT t2.Museum_ID, t1.name FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID GROUP BY t2.Museum_ID ORDER BY COUNT(*) DESC LIMIT 1
What is the name of the museum that had no visitor yet?
Additional table information: table: museum_visit
SQL: SELECT name FROM museum WHERE NOT Museum_ID IN (SELECT museum_id FROM visit)
Find the name and age of the visitor who bought the most tickets at once.
Additional table information: table: museum_visit
SQL: SELECT t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id ORDER BY t2.num_of_ticket DESC LIMIT 1
What are the average and maximum number of tickets bought in all visits?
Additional table information: table: museum_visit
SQL: SELECT AVG(num_of_ticket), MAX(num_of_ticket) FROM visit
What is the total ticket expense of the visitors whose membership level is 1?
Additional table information: table: museum_visit
SQL: SELECT SUM(t2.Total_spent) FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id WHERE t1.Level_of_membership = 1
What is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011?
Additional table information: table: museum_visit
SQL: SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year < 2009 INTERSECT SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year > 2011
Find the number of visitors who did not visit any museum opened after 2010.
Additional table information: table: museum_visit
SQL: SELECT COUNT(*) FROM visitor WHERE NOT id IN (SELECT t2.visitor_id FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID WHERE t1.open_year > 2010)
How many museums were opened after 2013 or before 2008?
Additional table information: table: museum_visit
SQL: SELECT COUNT(*) FROM museum WHERE open_year > 2013 OR open_year < 2008
Find the total number of players.
Additional table information: table: wta_1
SQL: SELECT COUNT(*) FROM players
How many players are there?
Additional table information: table: wta_1
SQL: SELECT COUNT(*) FROM players
Find the total number of matches.
Additional table information: table: wta_1
SQL: SELECT COUNT(*) FROM matches