messages
list
[ { "content": "What are the names of all the documents, as well as the access counts of each, ordered alphabetically?", "role": "user" }, { "content": "SELECT document_name , access_count FROM documents ORDER BY document_name", "role": "assistant" } ]
[ { "content": "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?", "role": "user" }, { "content": "SELECT document_name , access_count FROM documents ORDER BY access_count DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "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?", "role": "user" }, { "content": "SELECT document_name , access_count FROM documents ORDER BY access_count DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Find the types of documents with more than 4 documents.", "role": "user" }, { "content": "SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 4", "role": "assistant" } ]
[ { "content": "What are the codes of types of documents of which there are for or more?", "role": "user" }, { "content": "SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 4", "role": "assistant" } ]
[ { "content": "Find the total access count of all documents in the most popular document type.", "role": "user" }, { "content": "SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the total access count of documents that are of the most common document type?", "role": "user" }, { "content": "SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the average access count of documents?", "role": "user" }, { "content": "SELECT avg(access_count) FROM documents", "role": "assistant" } ]
[ { "content": "Find the average access count across all documents?", "role": "user" }, { "content": "SELECT avg(access_count) FROM documents", "role": "assistant" } ]
[ { "content": "What is the structure of the document with the least number of accesses?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Return the structure description of the document that has been accessed the fewest number of times.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What is the type of the document named \"David CV\"?", "role": "user" }, { "content": "SELECT document_type_code FROM documents WHERE document_name = \"David CV\"", "role": "assistant" } ]
[ { "content": "Return the type code of the document named \"David CV\".", "role": "user" }, { "content": "SELECT document_type_code FROM documents WHERE document_name = \"David CV\"", "role": "assistant" } ]
[ { "content": "Find the list of documents that are both in the most three popular type and have the most three popular structure.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What are the names of documents that have both one of the three most common types and one of three most common structures?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What document types do have more than 10000 total access number.", "role": "user" }, { "content": "SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count) > 10000", "role": "assistant" } ]
[ { "content": "Return the codes of the document types that do not have a total access count of over 10000.", "role": "user" }, { "content": "SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count) > 10000", "role": "assistant" } ]
[ { "content": "What are all the section titles of the document named \"David CV\"?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Give the section titles of the document with the name \"David CV\".", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find all the name of documents without any sections.", "role": "user" }, { "content": "SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections)", "role": "assistant" } ]
[ { "content": "What are the names of documents that do not have any sections?", "role": "user" }, { "content": "SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections)", "role": "assistant" } ]
[ { "content": "List all the username and passwords of users with the most popular role.", "role": "user" }, { "content": "SELECT user_name , password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What are the usernames and passwords of users that have the most common role?", "role": "user" }, { "content": "SELECT user_name , password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Find the average access counts of documents with functional area \"Acknowledgement\".", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "What are the average access counts of documents that have the functional area description \"Acknowledgement\"?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find names of the document without any images.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What are the names of documents that do not have any images?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What is the name of the document with the most number of sections?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Return the name of the document that has the most sections.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "List all the document names which contains \"CV\".", "role": "user" }, { "content": "SELECT document_name FROM documents WHERE document_name LIKE \"%CV%\"", "role": "assistant" } ]
[ { "content": "What are the names of documents that contain the substring \"CV\"?", "role": "user" }, { "content": "SELECT document_name FROM documents WHERE document_name LIKE \"%CV%\"", "role": "assistant" } ]
[ { "content": "How many users are logged in?", "role": "user" }, { "content": "SELECT count(*) FROM users WHERE user_login = 1", "role": "assistant" } ]
[ { "content": "Count the number of users that are logged in.", "role": "user" }, { "content": "SELECT count(*) FROM users WHERE user_login = 1", "role": "assistant" } ]
[ { "content": "Find the description of the most popular role among the users that have logged in.", "role": "user" }, { "content": "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)", "role": "assistant" } ]
[ { "content": "What is the description of the most popular role among users that have logged in?", "role": "user" }, { "content": "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)", "role": "assistant" } ]
[ { "content": "Find the average access count of documents with the least popular structure.", "role": "user" }, { "content": "SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the average access count of documents that have the least common structure?", "role": "user" }, { "content": "SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1", "role": "assistant" } ]
[ { "content": "List all the image name and URLs in the order of their names.", "role": "user" }, { "content": "SELECT image_name , image_url FROM images ORDER BY image_name", "role": "assistant" } ]
[ { "content": "What are the names and urls of images, sorted alphabetically?", "role": "user" }, { "content": "SELECT image_name , image_url FROM images ORDER BY image_name", "role": "assistant" } ]
[ { "content": "Find the number of users in each role.", "role": "user" }, { "content": "SELECT count(*) , role_code FROM users GROUP BY role_code", "role": "assistant" } ]
[ { "content": "What are the different role codes for users, and how many users have each?", "role": "user" }, { "content": "SELECT count(*) , role_code FROM users GROUP BY role_code", "role": "assistant" } ]
[ { "content": "What document types have more than 2 corresponding documents?", "role": "user" }, { "content": "SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 2", "role": "assistant" } ]
[ { "content": "Give the codes of document types that have more than 2 corresponding documents.", "role": "user" }, { "content": "SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 2", "role": "assistant" } ]
[ { "content": "How many companies are there?", "role": "user" }, { "content": "SELECT count(*) FROM Companies", "role": "assistant" } ]
[ { "content": "Count the number of companies.", "role": "user" }, { "content": "SELECT count(*) FROM Companies", "role": "assistant" } ]
[ { "content": "List the names of companies in descending order of market value.", "role": "user" }, { "content": "SELECT name FROM Companies ORDER BY Market_Value_billion DESC", "role": "assistant" } ]
[ { "content": "Sort the company names in descending order of the company's market value.", "role": "user" }, { "content": "SELECT name FROM Companies ORDER BY Market_Value_billion DESC", "role": "assistant" } ]
[ { "content": "What are the names of companies whose headquarters are not \"USA\"?", "role": "user" }, { "content": "SELECT name FROM Companies WHERE Headquarters != 'USA'", "role": "assistant" } ]
[ { "content": "Find the names of the companies whose headquarters are not located in \"USA\".", "role": "user" }, { "content": "SELECT name FROM Companies WHERE Headquarters != 'USA'", "role": "assistant" } ]
[ { "content": "What are the name and assets of each company, sorted in ascending order of company name?", "role": "user" }, { "content": "SELECT name , Assets_billion FROM Companies ORDER BY name ASC", "role": "assistant" } ]
[ { "content": "List the name and assets of each company in ascending order of company name.", "role": "user" }, { "content": "SELECT name , Assets_billion FROM Companies ORDER BY name ASC", "role": "assistant" } ]
[ { "content": "What are the average profits of companies?", "role": "user" }, { "content": "SELECT avg(Profits_billion) FROM Companies", "role": "assistant" } ]
[ { "content": "Compute the average profits companies make.", "role": "user" }, { "content": "SELECT avg(Profits_billion) FROM Companies", "role": "assistant" } ]
[ { "content": "What are the maximum and minimum sales of the companies whose industries are not \"Banking\".", "role": "user" }, { "content": "SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != \"Banking\"", "role": "assistant" } ]
[ { "content": "Find the maximum and minimum sales of the companies that are not in the \"Banking\" industry.", "role": "user" }, { "content": "SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != \"Banking\"", "role": "assistant" } ]
[ { "content": "How many different industries are the companies in?", "role": "user" }, { "content": "SELECT count(DISTINCT Industry) FROM Companies", "role": "assistant" } ]
[ { "content": "Count the number of distinct company industries.", "role": "user" }, { "content": "SELECT count(DISTINCT Industry) FROM Companies", "role": "assistant" } ]
[ { "content": "List the names of buildings in descending order of building height.", "role": "user" }, { "content": "SELECT name FROM buildings ORDER BY Height DESC", "role": "assistant" } ]
[ { "content": "What are the names of buildings sorted in descending order of building height?", "role": "user" }, { "content": "SELECT name FROM buildings ORDER BY Height DESC", "role": "assistant" } ]
[ { "content": "Find the stories of the building with the largest height.", "role": "user" }, { "content": "SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the stories of highest building?", "role": "user" }, { "content": "SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "List the name of a building along with the name of a company whose office is in the building.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "For each company, return the company name and the name of the building its office is located in.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Show the names of the buildings that have more than one company offices.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Which buildings have more than one company offices? Give me the building names.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Show the name of the building that has the most company offices.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Which building has the largest number of company offices? Give me the building name.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Please show the names of the buildings whose status is \"on-hold\", in ascending order of stories.", "role": "user" }, { "content": "SELECT name FROM buildings WHERE Status = \"on-hold\" ORDER BY Stories ASC", "role": "assistant" } ]
[ { "content": "Find the names of the buildings in \"on-hold\" status, and sort them in ascending order of building stories.", "role": "user" }, { "content": "SELECT name FROM buildings WHERE Status = \"on-hold\" ORDER BY Stories ASC", "role": "assistant" } ]
[ { "content": "Please show each industry and the corresponding number of companies in that industry.", "role": "user" }, { "content": "SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry", "role": "assistant" } ]
[ { "content": "Whah are the name of each industry and the number of companies in that industry?", "role": "user" }, { "content": "SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry", "role": "assistant" } ]
[ { "content": "Please show the industries of companies in descending order of the number of companies.", "role": "user" }, { "content": "SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC", "role": "assistant" } ]
[ { "content": "Sort all the industries in descending order of the count of companies in each industry", "role": "user" }, { "content": "SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC", "role": "assistant" } ]
[ { "content": "List the industry shared by the most companies.", "role": "user" }, { "content": "SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Which industry has the most companies?", "role": "user" }, { "content": "SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "List the names of buildings that have no company office.", "role": "user" }, { "content": "SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations)", "role": "assistant" } ]
[ { "content": "Which buildings do not have any company office? Give me the building names.", "role": "user" }, { "content": "SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations)", "role": "assistant" } ]
[ { "content": "Show the industries shared by companies whose headquarters are \"USA\" and companies whose headquarters are \"China\".", "role": "user" }, { "content": "SELECT Industry FROM Companies WHERE Headquarters = \"USA\" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = \"China\"", "role": "assistant" } ]
[ { "content": "Which industries have both companies with headquarter in \"USA\" and companies with headquarter in \"China\"?", "role": "user" }, { "content": "SELECT Industry FROM Companies WHERE Headquarters = \"USA\" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = \"China\"", "role": "assistant" } ]
[ { "content": "Find the number of companies whose industry is \"Banking\" or \"Conglomerate\",", "role": "user" }, { "content": "SELECT count(*) FROM Companies WHERE Industry = \"Banking\" OR Industry = \"Conglomerate\"", "role": "assistant" } ]
[ { "content": "How many companies are in either \"Banking\" industry or \"Conglomerate\" industry?", "role": "user" }, { "content": "SELECT count(*) FROM Companies WHERE Industry = \"Banking\" OR Industry = \"Conglomerate\"", "role": "assistant" } ]
[ { "content": "Show the headquarters shared by more than two companies.", "role": "user" }, { "content": "SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2", "role": "assistant" } ]
[ { "content": "Which headquarter locations are used by more than 2 companies?", "role": "user" }, { "content": "SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2", "role": "assistant" } ]
[ { "content": "How many products are there?", "role": "user" }, { "content": "SELECT count(*) FROM Products", "role": "assistant" } ]
[ { "content": "List the name of products in ascending order of price.", "role": "user" }, { "content": "SELECT Product_Name FROM Products ORDER BY Product_Price ASC", "role": "assistant" } ]
[ { "content": "What are the names and type codes of products?", "role": "user" }, { "content": "SELECT Product_Name , Product_Type_Code FROM Products", "role": "assistant" } ]
[ { "content": "Show the prices of the products named \"Dining\" or \"Trading Policy\".", "role": "user" }, { "content": "SELECT Product_Price FROM Products WHERE Product_Name = \"Dining\" OR Product_Name = \"Trading Policy\"", "role": "assistant" } ]
[ { "content": "What is the average price for products?", "role": "user" }, { "content": "SELECT avg(Product_Price) FROM Products", "role": "assistant" } ]
[ { "content": "What is the name of the product with the highest price?", "role": "user" }, { "content": "SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Show different type codes of products and the number of products with each type code.", "role": "user" }, { "content": "SELECT Product_Type_Code , COUNT(*) FROM Products GROUP BY Product_Type_Code", "role": "assistant" } ]
[ { "content": "Show the most common type code across products.", "role": "user" }, { "content": "SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Show the product type codes that have at least two products.", "role": "user" }, { "content": "SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*) >= 2", "role": "assistant" } ]
[ { "content": "Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000.", "role": "user" }, { "content": "SELECT Product_Type_Code FROM Products WHERE Product_Price > 4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price < 3000", "role": "assistant" } ]
[ { "content": "Show the names of products and the number of events they are in.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Show the names of products and the number of events they are in, sorted by the number of events in descending order.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Show the names of products that are in at least two events.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Show the names of products that are in at least two events in ascending alphabetical order of product name.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "List the names of products that are not in any event.", "role": "user" }, { "content": "SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events)", "role": "assistant" } ]
[ { "content": "How many artworks are there?", "role": "user" }, { "content": "SELECT count(*) FROM artwork", "role": "assistant" } ]
[ { "content": "List the name of artworks in ascending alphabetical order.", "role": "user" }, { "content": "SELECT Name FROM artwork ORDER BY Name ASC", "role": "assistant" } ]