cnatale/presto-athena-txt-2-sql huggingface dataset:
How many tasks does each project have? List the task count and the project detail.
Additional table information: table: tracking_grants_for_research
SQL: SELECT COUNT(*), T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id
For each project id, how many tasks are there?
Additional table information: table: tracking_grants_for_research
SQL: SELECT COUNT(*), T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id
What are the staff roles of the staff who
Additional table information: table: tracking_grants_for_research
SQL: SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'
What roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'?
Additional table information: table: tracking_grants_for_research
SQL: SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'
What are the descriptions of all the project outcomes?
Additional table information: table: tracking_grants_for_research
SQL: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code
List the description of the outcomes for all projects.
Additional table information: table: tracking_grants_for_research
SQL: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code
Which role is most common for the staff?
Additional table information: table: tracking_grants_for_research
SQL: SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1
What is the most common role for the staff?
Additional table information: table: tracking_grants_for_research
SQL: SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1
How many friends does Dan have?
Additional table information: table: network_2
SQL: SELECT COUNT(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'
How many females does this network has?
Additional table information: table: network_2
SQL: SELECT COUNT(*) FROM Person WHERE gender = 'female'
How many females are in the network?
Additional table information: table: network_2
SQL: SELECT COUNT(*) FROM Person WHERE gender = 'female'
What is the average age for all person?
Additional table information: table: network_2
SQL: SELECT AVG(age) FROM Person
What is the average age for all people in the table?
Additional table information: table: network_2
SQL: SELECT AVG(age) FROM Person
How many different cities are they from?
Additional table information: table: network_2
SQL: SELECT COUNT(DISTINCT city) FROM Person
How many different cities do people originate from?
Additional table information: table: network_2
SQL: SELECT COUNT(DISTINCT city) FROM Person
How many type of jobs do they have?
Additional table information: table: network_2
SQL: SELECT COUNT(DISTINCT job) FROM Person
How many different jobs are listed?
Additional table information: table: network_2
SQL: SELECT COUNT(DISTINCT job) FROM Person
Who is the oldest person?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM person)
What is the name of the person who is the oldest?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM person)
Who is the oldest person whose job is student?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE job = 'student' AND age = (SELECT MAX(age) FROM person WHERE job = 'student')
What is the name of the oldest student?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE job = 'student' AND age = (SELECT MAX(age) FROM person WHERE job = 'student')
Who is the youngest male?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT MIN(age) FROM person WHERE gender = 'male')
What is the name of the youngest male?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT MIN(age) FROM person WHERE gender = 'male')
How old is the doctor named Zach?
Additional table information: table: network_2
SQL: SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach'
What is the age of the doctor named Zach?
Additional table information: table: network_2
SQL: SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach'
Who is the person whose age is below 30?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE age < 30
What is the name of the person whose age is below 30?
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE age < 30
How many people whose age is greater 30 and job is engineer?
Additional table information: table: network_2
SQL: SELECT COUNT(*) FROM Person WHERE age > 30 AND job = 'engineer'
HOw many engineers are older than 30?
Additional table information: table: network_2
SQL: SELECT COUNT(*) FROM Person WHERE age > 30 AND job = 'engineer'
What is the average age for each gender?
Additional table information: table: network_2
SQL: SELECT AVG(age), gender FROM Person GROUP BY gender
How old is each gender, on average?
Additional table information: table: network_2
SQL: SELECT AVG(age), gender FROM Person GROUP BY gender
What is average age for different job title?
Additional table information: table: network_2
SQL: SELECT AVG(age), job FROM Person GROUP BY job
How old is the average person for each job?
Additional table information: table: network_2
SQL: SELECT AVG(age), job FROM Person GROUP BY job
What is average age of male for different job title?
Additional table information: table: network_2
SQL: SELECT AVG(age), job FROM Person WHERE gender = 'male' GROUP BY job
What is the average age for a male in each job?
Additional table information: table: network_2
SQL: SELECT AVG(age), job FROM Person WHERE gender = 'male' GROUP BY job
What is minimum age for different job title?
Additional table information: table: network_2
SQL: SELECT MIN(age), job FROM Person GROUP BY job
How old is the youngest person for each job?
Additional table information: table: network_2
SQL: SELECT MIN(age), job FROM Person GROUP BY job
Find the number of people who is under 40 for each gender.
Additional table information: table: network_2
SQL: SELECT COUNT(*), gender FROM Person WHERE age < 40 GROUP BY gender
How many people are under 40 for each gender?
Additional table information: table: network_2
SQL: SELECT COUNT(*), gender FROM Person WHERE age < 40 GROUP BY gender
Find the name of people whose age is greater than any engineer sorted by their age.
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM person WHERE job = 'engineer') ORDER BY age NULLS FIRST
What is the name of all the people who are older than at least one engineer? Order them by age.
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM person WHERE job = 'engineer') ORDER BY age NULLS FIRST
Find the number of people whose age is greater than all engineers.
Additional table information: table: network_2
SQL: SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM person WHERE job = 'engineer')
How many people are older than every engineer?
Additional table information: table: network_2
SQL: SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM person WHERE job = 'engineer')
list the name, job title of all people ordered by their names.
Additional table information: table: network_2
SQL: SELECT name, job FROM Person ORDER BY name NULLS FIRST
What are the names and job titles of every person ordered alphabetically by name?
Additional table information: table: network_2
SQL: SELECT name, job FROM Person ORDER BY name NULLS FIRST
Find the names of all person sorted in the descending order using age.
Additional table information: table: network_2
SQL: SELECT name FROM Person ORDER BY age DESC
What are the names of everybody sorted by age in descending order?
Additional table information: table: network_2
SQL: SELECT name FROM Person ORDER BY age DESC
Find the name and age of all males in order of their age.
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE gender = 'male' ORDER BY age NULLS FIRST
What is the name and age of every male? Order the results by age.
Additional table information: table: network_2
SQL: SELECT name FROM Person WHERE gender = 'male' ORDER BY age NULLS FIRST
Find the name and age of the person who is a friend of both Dan and Alice.
Additional table information: table: network_2
SQL: SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice'
What are the names and ages of every person who is a friend of both Dan and Alice?
Additional table information: table: network_2
SQL: SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice'
Find the name and age of the person who is a friend of Dan or Alice.
Additional table information: table: network_2
SQL: SELECT DISTINCT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice'
What are the different names and ages of every friend of either Dan or alice?
Additional table information: table: network_2
SQL: SELECT DISTINCT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice'
Find the name of the person who has friends with age above 40 and under age 30?
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) INTERSECT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)
What are the names of every person who has a friend over 40 and under 30?
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) INTERSECT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)
Find the name of the person who has friends with age above 40 but not under age 30?
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)
What are the names of the people who are older 40 but no friends under age 30?
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)
Find the name of the person who has no student friends.
Additional table information: table: network_2
SQL: SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student'
What are the names of the people who have no friends who are students?
Additional table information: table: network_2
SQL: SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student'
Find the person who has exactly one friend.
Additional table information: table: network_2
SQL: SELECT name FROM PersonFriend GROUP BY name HAVING COUNT(*) = 1
What are the names of everybody who has exactly one friend?
Additional table information: table: network_2
SQL: SELECT name FROM PersonFriend GROUP BY name HAVING COUNT(*) = 1
Who are the friends of Bob?
Additional table information: table: network_2
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'
Who are Bob's friends?
Additional table information: table: network_2
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'
Find the name of persons who are friends with Bob.
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'
What are the names of all of Bob's friends?
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'
Find the names of females who are friends with Zach
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female'
What are the names of all females who are friends with Zach?
Additional table information: table: network_2
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female'
Find the female friends of Alice.
Additional table information: table: network_2
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'
What are all the friends of Alice who are female?
Additional table information: table: network_2
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'
Find the male friend of Alice whose job is a doctor?
Additional table information: table: network_2
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor'
Who are the friends of Alice that are doctors?
Additional table information: table: network_2
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor'
Who has a friend that is from new york city?
Additional table information: table: network_2
SQL: SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city'
What are the names of all friends who are from New York?
Additional table information: table: network_2
SQL: SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city'
Who has friends that are younger than the average age?
Additional table information: table: network_2
SQL: SELECT DISTINCT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age < (SELECT AVG(age) FROM person)
What are the different names of friends who are younger than the average age for a friend?
Additional table information: table: network_2
SQL: SELECT DISTINCT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age < (SELECT AVG(age) FROM person)
Who has friends that are older than the average age? Print their friends and their ages as well
Additional table information: table: network_2
SQL: SELECT DISTINCT T2.name, T2.friend, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM person)
Whare the names, friends, and ages of all people who are older than the average age of a person?
Additional table information: table: network_2
SQL: SELECT DISTINCT T2.name, T2.friend, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM person)
Who is the friend of Zach with longest year relationship?
Additional table information: table: network_2
SQL: SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')
Which friend of Zach has the longest-lasting friendship?
Additional table information: table: network_2
SQL: SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')
What is the age of the friend of Zach with longest year relationship?
Additional table information: table: network_2
SQL: SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2.year = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')
What are the ages of all of Zach's friends who are in the longest relationship?
Additional table information: table: network_2
SQL: SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2.year = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')
Find the name of persons who are friends with Alice for the shortest years.
Additional table information: table: network_2
SQL: SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT MIN(YEAR) FROM PersonFriend WHERE friend = 'Alice')
What are the names of all people who are friends with Alice for the shortest amount of time?
Additional table information: table: network_2
SQL: SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT MIN(YEAR) FROM PersonFriend WHERE friend = 'Alice')
Find the name, age, and job title of persons who are friends with Alice for the longest years.
Additional table information: table: network_2
SQL: SELECT T1.name, T1.age, T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT MAX(YEAR) FROM PersonFriend WHERE friend = 'Alice')
What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time?
Additional table information: table: network_2
SQL: SELECT T1.name, T1.age, T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT MAX(YEAR) FROM PersonFriend WHERE friend = 'Alice')
Who is the person that has no friend?
Additional table information: table: network_2
SQL: SELECT name FROM person EXCEPT SELECT name FROM PersonFriend
What are the names of all people who do not have friends?
Additional table information: table: network_2
SQL: SELECT name FROM person EXCEPT SELECT name FROM PersonFriend
Which person whose friends have the oldest average age?
Additional table information: table: network_2
SQL: SELECT T2.name, AVG(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY AVG(T1.age) DESC LIMIT 1
What is the name of the person who has the oldest average age for their friends, and what is that average age?
Additional table information: table: network_2
SQL: SELECT T2.name, AVG(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY AVG(T1.age) DESC LIMIT 1
What is the total number of people who has no friend living in the city of Austin.
Additional table information: table: network_2
SQL: SELECT COUNT(DISTINCT name) FROM PersonFriend WHERE NOT friend IN (SELECT name FROM person WHERE city = 'Austin')
What is the total number of people who have no friends living in Austin?
Additional table information: table: network_2
SQL: SELECT COUNT(DISTINCT name) FROM PersonFriend WHERE NOT friend IN (SELECT name FROM person WHERE city = 'Austin')
Find Alice's friends of friends.
Additional table information: table: network_2
SQL: SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name <> 'Alice'
What are the names of all of Alice's friends of friends?
Additional table information: table: network_2
SQL: SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name <> 'Alice'
How many members are there?
Additional table information: table: decoration_competition
SQL: SELECT COUNT(*) FROM member
List the names of members in ascending alphabetical order.
Additional table information: table: decoration_competition
SQL: SELECT Name FROM member ORDER BY Name ASC NULLS FIRST
What are the names and countries of members?
Additional table information: table: decoration_competition
SQL: SELECT Name, Country FROM member
Show the names of members whose country is 'United States' or 'Canada'.
Additional table information: table: decoration_competition
SQL: SELECT Name FROM member WHERE Country = 'United States' OR Country = 'Canada'
Show the different countries and the number of members from each.
Additional table information: table: decoration_competition
SQL: SELECT Country, COUNT(*) FROM member GROUP BY Country
Show the most common country across members.
Additional table information: table: decoration_competition
SQL: SELECT Country FROM member GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1
Which countries have more than two members?
Additional table information: table: decoration_competition
SQL: SELECT Country FROM member GROUP BY Country HAVING COUNT(*) > 2
Show the leader names and locations of colleges.
Additional table information: table: decoration_competition
SQL: SELECT Leader_Name, College_Location FROM college
Show the names of members and names of colleges they go to.
Additional table information: table: decoration_competition
SQL: SELECT T2.Name, T1.Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID
Show the names of members and the locations of colleges they go to in ascending alphabetical order of member names.
Additional table information: table: decoration_competition
SQL: SELECT T2.Name, T1.College_Location FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID ORDER BY T2.Name ASC NULLS FIRST
Show the distinct leader names of colleges associated with members from country 'Canada'.
Additional table information: table: decoration_competition
SQL: SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = 'Canada'
Show the names of members and the decoration themes they have.
Additional table information: table: decoration_competition
SQL: SELECT T1.Name, T2.Decoration_Theme FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID
Show the names of members that have a rank in round higher than 3.
Additional table information: table: decoration_competition
SQL: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID WHERE T2.Rank_in_Round > 3
Show the names of members in ascending order of their rank in rounds.
Additional table information: table: decoration_competition
SQL: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round ASC NULLS FIRST
List the names of members who did not participate in any round.
Additional table information: table: decoration_competition
SQL: SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM round)
Find the name and access counts of all documents, in alphabetic order of the document name.
Additional table information: table: document_management
SQL: SELECT document_name, access_count FROM documents ORDER BY document_name NULLS FIRST
What are the names of all the documents, as well as the access counts of each, ordered alphabetically?
Additional table information: table: document_management
SQL: SELECT document_name, access_count FROM documents ORDER BY document_name NULLS FIRST
Find the name of the document that has been accessed the greatest number of times, as well as the count of how many times it has been accessed?
Additional table information: table: document_management
SQL: SELECT document_name, access_count FROM documents ORDER BY access_count DESC LIMIT 1
What is the name of the document which has been accessed the most times, as well as the number of times it has been accessed?
Additional table information: table: document_management
SQL: SELECT document_name, access_count FROM documents ORDER BY access_count DESC LIMIT 1
Find the types of documents with more than 4 documents.
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 4
What are the codes of types of documents of which there are for or more?
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 4
Find the total access count of all documents in the most popular document type.
Additional table information: table: document_management
SQL: SELECT SUM(access_count) FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
What is the total access count of documents that are of the most common document type?
Additional table information: table: document_management
SQL: SELECT SUM(access_count) FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
What is the average access count of documents?
Additional table information: table: document_management
SQL: SELECT AVG(access_count) FROM documents
Find the average access count across all documents?
Additional table information: table: document_management
SQL: SELECT AVG(access_count) FROM documents
What is the structure of the document with the least number of accesses?
Additional table information: table: document_management
SQL: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code = t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY COUNT(*) DESC LIMIT 1
Return the structure description of the document that has been accessed the fewest number of times.
Additional table information: table: document_management
SQL: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code = t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY COUNT(*) DESC LIMIT 1
What is the type of the document named 'David CV'?
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents WHERE document_name = 'David CV'
Return the type code of the document named 'David CV'.
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents WHERE document_name = 'David CV'
Find the list of documents that are both in the most three popular type and have the most three popular structure.
Additional table information: table: document_management
SQL: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) DESC LIMIT 3
What are the names of documents that have both one of the three most common types and one of three most common structures?
Additional table information: table: document_management
SQL: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) DESC LIMIT 3
What document types do have more than 10000 total access number.
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING SUM(access_count) > 10000
Return the codes of the document types that do not have a total access count of over 10000.
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING SUM(access_count) > 10000
What are all the section titles of the document named 'David CV'?
Additional table information: table: document_management
SQL: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = 'David CV'
Give the section titles of the document with the name 'David CV'.
Additional table information: table: document_management
SQL: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = 'David CV'
Find all the name of documents without any sections.
Additional table information: table: document_management
SQL: SELECT document_name FROM documents WHERE NOT document_code IN (SELECT document_code FROM document_sections)
What are the names of documents that do not have any sections?
Additional table information: table: document_management
SQL: SELECT document_name FROM documents WHERE NOT document_code IN (SELECT document_code FROM document_sections)
List all the username and passwords of users with the most popular role.
Additional table information: table: document_management
SQL: SELECT user_name, password FROM users GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1
What are the usernames and passwords of users that have the most common role?
Additional table information: table: document_management
SQL: SELECT user_name, password FROM users GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1
Find the average access counts of documents with functional area 'Acknowledgement'.
Additional table information: table: document_management
SQL: SELECT AVG(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code = t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code = t3.functional_area_code WHERE t3.functional_area_description = 'Acknowledgement'
What are the average access counts of documents that have the functional area description 'Acknowledgement'?
Additional table information: table: document_management
SQL: SELECT AVG(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code = t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code = t3.functional_area_code WHERE t3.functional_area_description = 'Acknowledgement'
Find names of the document without any images.
Additional table information: table: document_management
SQL: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code JOIN document_sections_images AS t3 ON t2.section_id = t3.section_id
What are the names of documents that do not have any images?
Additional table information: table: document_management
SQL: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code JOIN document_sections_images AS t3 ON t2.section_id = t3.section_id
What is the name of the document with the most number of sections?
Additional table information: table: document_management
SQL: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY COUNT(*) DESC LIMIT 1
Return the name of the document that has the most sections.
Additional table information: table: document_management
SQL: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY COUNT(*) DESC LIMIT 1
List all the document names which contains 'CV'.
Additional table information: table: document_management
SQL: SELECT document_name FROM documents WHERE document_name LIKE '%CV%'
What are the names of documents that contain the substring 'CV'?
Additional table information: table: document_management
SQL: SELECT document_name FROM documents WHERE document_name LIKE '%CV%'
How many users are logged in?
Additional table information: table: document_management
SQL: SELECT COUNT(*) FROM users WHERE user_login = 1
Count the number of users that are logged in.
Additional table information: table: document_management
SQL: SELECT COUNT(*) FROM users WHERE user_login = 1
Find the description of the most popular role among the users that have logged in.
Additional table information: table: document_management
SQL: SELECT role_description FROM ROLES WHERE role_code = (SELECT role_code FROM users WHERE user_login = 1 GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1)
What is the description of the most popular role among users that have logged in?
Additional table information: table: document_management
SQL: SELECT role_description FROM ROLES WHERE role_code = (SELECT role_code FROM users WHERE user_login = 1 GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1)
Find the average access count of documents with the least popular structure.
Additional table information: table: document_management
SQL: SELECT AVG(access_count) FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
What is the average access count of documents that have the least common structure?
Additional table information: table: document_management
SQL: SELECT AVG(access_count) FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
List all the image name and URLs in the order of their names.
Additional table information: table: document_management
SQL: SELECT image_name, image_url FROM images ORDER BY image_name NULLS FIRST
What are the names and urls of images, sorted alphabetically?
Additional table information: table: document_management
SQL: SELECT image_name, image_url FROM images ORDER BY image_name NULLS FIRST
Find the number of users in each role.
Additional table information: table: document_management
SQL: SELECT COUNT(*), role_code FROM users GROUP BY role_code
What are the different role codes for users, and how many users have each?
Additional table information: table: document_management
SQL: SELECT COUNT(*), role_code FROM users GROUP BY role_code
What document types have more than 2 corresponding documents?
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 2
Give the codes of document types that have more than 2 corresponding documents.
Additional table information: table: document_management
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 2
How many companies are there?
Additional table information: table: company_office
SQL: SELECT COUNT(*) FROM Companies
Count the number of companies.
Additional table information: table: company_office
SQL: SELECT COUNT(*) FROM Companies
List the names of companies in descending order of market value.
Additional table information: table: company_office
SQL: SELECT name FROM Companies ORDER BY Market_Value_billion DESC
Sort the company names in descending order of the company's market value.
Additional table information: table: company_office
SQL: SELECT name FROM Companies ORDER BY Market_Value_billion DESC
What are the names of companies whose headquarters are not 'USA'?
Additional table information: table: company_office
SQL: SELECT name FROM Companies WHERE Headquarters <> 'USA'
Find the names of the companies whose headquarters are not located in 'USA'.
Additional table information: table: company_office
SQL: SELECT name FROM Companies WHERE Headquarters <> 'USA'
What are the name and assets of each company, sorted in ascending order of company name?
Additional table information: table: company_office
SQL: SELECT name, Assets_billion FROM Companies ORDER BY name ASC NULLS FIRST
List the name and assets of each company in ascending order of company name.
Additional table information: table: company_office
SQL: SELECT name, Assets_billion FROM Companies ORDER BY name ASC NULLS FIRST
What are the average profits of companies?
Additional table information: table: company_office
SQL: SELECT AVG(Profits_billion) FROM Companies
Compute the average profits companies make.
Additional table information: table: company_office
SQL: SELECT AVG(Profits_billion) FROM Companies
What are the maximum and minimum sales of the companies whose industries are not 'Banking'.
Additional table information: table: company_office
SQL: SELECT MAX(Sales_billion), MIN(Sales_billion) FROM Companies WHERE Industry <> 'Banking'
Find the maximum and minimum sales of the companies that are not in the 'Banking' industry.
Additional table information: table: company_office
SQL: SELECT MAX(Sales_billion), MIN(Sales_billion) FROM Companies WHERE Industry <> 'Banking'
How many different industries are the companies in?
Additional table information: table: company_office
SQL: SELECT COUNT(DISTINCT Industry) FROM Companies
Count the number of distinct company industries.
Additional table information: table: company_office
SQL: SELECT COUNT(DISTINCT Industry) FROM Companies
List the names of buildings in descending order of building height.
Additional table information: table: company_office
SQL: SELECT name FROM buildings ORDER BY Height DESC
What are the names of buildings sorted in descending order of building height?
Additional table information: table: company_office
SQL: SELECT name FROM buildings ORDER BY Height DESC
Find the stories of the building with the largest height.
Additional table information: table: company_office
SQL: SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1
What is the stories of highest building?
Additional table information: table: company_office
SQL: SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1
List the name of a building along with the name of a company whose office is in the building.
Additional table information: table: company_office
SQL: SELECT T3.name, T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id
For each company, return the company name and the name of the building its office is located in.
Additional table information: table: company_office
SQL: SELECT T3.name, T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id
Show the names of the buildings that have more than one company offices.
Additional table information: table: company_office
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id HAVING COUNT(*) > 1
Which buildings have more than one company offices? Give me the building names.
Additional table information: table: company_office
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id HAVING COUNT(*) > 1
Show the name of the building that has the most company offices.
Additional table information: table: company_office
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
Which building has the largest number of company offices? Give me the building name.
Additional table information: table: company_office
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
Please show the names of the buildings whose status is 'on-hold', in ascending order of stories.
Additional table information: table: company_office
SQL: SELECT name FROM buildings WHERE Status = 'on-hold' ORDER BY Stories ASC NULLS FIRST
Find the names of the buildings in 'on-hold' status, and sort them in ascending order of building stories.
Additional table information: table: company_office
SQL: SELECT name FROM buildings WHERE Status = 'on-hold' ORDER BY Stories ASC NULLS FIRST
Please show each industry and the corresponding number of companies in that industry.
Additional table information: table: company_office
SQL: SELECT Industry, COUNT(*) FROM Companies GROUP BY Industry
Whah are the name of each industry and the number of companies in that industry?
Additional table information: table: company_office
SQL: SELECT Industry, COUNT(*) FROM Companies GROUP BY Industry
Please show the industries of companies in descending order of the number of companies.
Additional table information: table: company_office
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC
Sort all the industries in descending order of the count of companies in each industry
Additional table information: table: company_office
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC
List the industry shared by the most companies.
Additional table information: table: company_office
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1
Which industry has the most companies?
Additional table information: table: company_office
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1
List the names of buildings that have no company office.
Additional table information: table: company_office
SQL: SELECT name FROM buildings WHERE NOT id IN (SELECT building_id FROM Office_locations)
Which buildings do not have any company office? Give me the building names.
Additional table information: table: company_office
SQL: SELECT name FROM buildings WHERE NOT id IN (SELECT building_id FROM Office_locations)
Show the industries shared by companies whose headquarters are 'USA' and companies whose headquarters are 'China'.
Additional table information: table: company_office
SQL: SELECT Industry FROM Companies WHERE Headquarters = 'USA' INTERSECT SELECT Industry FROM Companies WHERE Headquarters = 'China'
Which industries have both companies with headquarter in 'USA' and companies with headquarter in 'China'?
Additional table information: table: company_office
SQL: SELECT Industry FROM Companies WHERE Headquarters = 'USA' INTERSECT SELECT Industry FROM Companies WHERE Headquarters = 'China'
Find the number of companies whose industry is 'Banking' or 'Conglomerate',
Additional table information: table: company_office
SQL: SELECT COUNT(*) FROM Companies WHERE Industry = 'Banking' OR Industry = 'Conglomerate'
How many companies are in either 'Banking' industry or 'Conglomerate' industry?
Additional table information: table: company_office
SQL: SELECT COUNT(*) FROM Companies WHERE Industry = 'Banking' OR Industry = 'Conglomerate'
Show the headquarters shared by more than two companies.
Additional table information: table: company_office
SQL: SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2
Which headquarter locations are used by more than 2 companies?
Additional table information: table: company_office
SQL: SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2
How many products are there?
Additional table information: table: solvency_ii
SQL: SELECT COUNT(*) FROM Products
List the name of products in ascending order of price.
Additional table information: table: solvency_ii
SQL: SELECT Product_Name FROM Products ORDER BY Product_Price ASC NULLS FIRST
What are the names and type codes of products?
Additional table information: table: solvency_ii
SQL: SELECT Product_Name, Product_Type_Code FROM Products
Show the prices of the products named 'Dining' or 'Trading Policy'.
Additional table information: table: solvency_ii
SQL: SELECT Product_Price FROM Products WHERE Product_Name = 'Dining' OR Product_Name = 'Trading Policy'
What is the average price for products?
Additional table information: table: solvency_ii
SQL: SELECT AVG(Product_Price) FROM Products
What is the name of the product with the highest price?
Additional table information: table: solvency_ii
SQL: SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1
Show different type codes of products and the number of products with each type code.
Additional table information: table: solvency_ii
SQL: SELECT Product_Type_Code, COUNT(*) FROM Products GROUP BY Product_Type_Code
Show the most common type code across products.
Additional table information: table: solvency_ii
SQL: SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
Show the product type codes that have at least two products.
Additional table information: table: solvency_ii
SQL: SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*) >= 2
Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000.
Additional table information: table: solvency_ii
SQL: SELECT Product_Type_Code FROM Products WHERE Product_Price > 4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price < 3000
Show the names of products and the number of events they are in.
Additional table information: table: solvency_ii
SQL: SELECT T1.Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name
Show the names of products and the number of events they are in, sorted by the number of events in descending order.
Additional table information: table: solvency_ii
SQL: SELECT T1.Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY COUNT(*) DESC
Show the names of products that are in at least two events.
Additional table information: table: solvency_ii
SQL: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*) >= 2
Show the names of products that are in at least two events in ascending alphabetical order of product name.
Additional table information: table: solvency_ii
SQL: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*) >= 2 ORDER BY T1.Product_Name NULLS FIRST
List the names of products that are not in any event.
Additional table information: table: solvency_ii
SQL: SELECT Product_Name FROM Products WHERE NOT Product_ID IN (SELECT Product_ID FROM Products_in_Events)
How many artworks are there?
Additional table information: table: entertainment_awards
SQL: SELECT COUNT(*) FROM artwork
List the name of artworks in ascending alphabetical order.
Additional table information: table: entertainment_awards
SQL: SELECT Name FROM artwork ORDER BY Name ASC NULLS FIRST
List the name of artworks whose type is not 'Program Talent Show'.
Additional table information: table: entertainment_awards
SQL: SELECT Name FROM artwork WHERE TYPE <> 'Program Talent Show'
What are the names and locations of festivals?
Additional table information: table: entertainment_awards
SQL: SELECT Festival_Name, LOCATION FROM festival_detail
What are the names of the chairs of festivals, sorted in ascending order of the year held?
Additional table information: table: entertainment_awards
SQL: SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC NULLS FIRST
What is the location of the festival with the largest number of audience?
Additional table information: table: entertainment_awards
SQL: SELECT LOCATION FROM festival_detail ORDER BY Num_of_Audience DESC LIMIT 1
What are the names of festivals held in year 2007?
Additional table information: table: entertainment_awards
SQL: SELECT Festival_Name FROM festival_detail WHERE YEAR = 2007
What is the average number of audience for festivals?
Additional table information: table: entertainment_awards
SQL: SELECT AVG(Num_of_Audience) FROM festival_detail
Show the names of the three most recent festivals.
Additional table information: table: entertainment_awards
SQL: SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3
For each nomination, show the name of the artwork and name of the festival where it is nominated.
Additional table information: table: entertainment_awards
SQL: SELECT T2.Name, T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID
Show distinct types of artworks that are nominated in festivals in 2007.
Additional table information: table: entertainment_awards
SQL: SELECT DISTINCT T2.Type FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T3.Year = 2007