db_id stringclasses 140 values | schema listlengths 0 26 | question stringlengths 16 224 | query stringlengths 18 577 | query_toks listlengths 4 90 | query_toks_no_value listlengths 4 125 | question_toks listlengths 4 44 |
|---|---|---|---|---|---|---|
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the names of all the documents, as well as the access counts of each, ordered alphabetically? | SELECT document_name , access_count FROM documents ORDER BY document_name | [
"SELECT",
"document_name",
",",
"access_count",
"FROM",
"documents",
"ORDER",
"BY",
"document_name"
] | [
"select",
"document_name",
",",
"access_count",
"from",
"documents",
"order",
"by",
"document_name"
] | [
"What",
"are",
"the",
"names",
"of",
"all",
"the",
"documents",
",",
"as",
"well",
"as",
"the",
"access",
"counts",
"of",
"each",
",",
"ordered",
"alphabetically",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | 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? | SELECT document_name , access_count FROM documents ORDER BY access_count DESC LIMIT 1 | [
"SELECT",
"document_name",
",",
"access_count",
"FROM",
"documents",
"ORDER",
"BY",
"access_count",
"DESC",
"LIMIT",
"1"
] | [
"select",
"document_name",
",",
"access_count",
"from",
"documents",
"order",
"by",
"access_count",
"desc",
"limit",
"value"
] | [
"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",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | 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? | SELECT document_name , access_count FROM documents ORDER BY access_count DESC LIMIT 1 | [
"SELECT",
"document_name",
",",
"access_count",
"FROM",
"documents",
"ORDER",
"BY",
"access_count",
"DESC",
"LIMIT",
"1"
] | [
"select",
"document_name",
",",
"access_count",
"from",
"documents",
"order",
"by",
"access_count",
"desc",
"limit",
"value"
] | [
"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",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the types of documents with more than 4 documents. | SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 4 | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"HAVING",
"count",
"(",
"*",
")",
">",
"4"
] | [
"select",
"document_type_code",
"from",
"documents",
"group",
"by",
"document_type_code",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Find",
"the",
"types",
"of",
"documents",
"with",
"more",
"than",
"4",
"documents",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the codes of types of documents of which there are for or more? | SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 4 | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"HAVING",
"count",
"(",
"*",
")",
">",
"4"
] | [
"select",
"document_type_code",
"from",
"documents",
"group",
"by",
"document_type_code",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"What",
"are",
"the",
"codes",
"of",
"types",
"of",
"documents",
"of",
"which",
"there",
"are",
"for",
"or",
"more",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the total access count of all documents in the most popular document type. | SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"sum",
"(",
"access_count",
")",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"sum",
"(",
"access_count",
")",
"from",
"documents",
"group",
"by",
"document_type_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"total",
"access",
"count",
"of",
"all",
"documents",
"in",
"the",
"most",
"popular",
"document",
"type",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the total access count of documents that are of the most common document type? | SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"sum",
"(",
"access_count",
")",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"sum",
"(",
"access_count",
")",
"from",
"documents",
"group",
"by",
"document_type_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"What",
"is",
"the",
"total",
"access",
"count",
"of",
"documents",
"that",
"are",
"of",
"the",
"most",
"common",
"document",
"type",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the average access count of documents? | SELECT avg(access_count) FROM documents | [
"SELECT",
"avg",
"(",
"access_count",
")",
"FROM",
"documents"
] | [
"select",
"avg",
"(",
"access_count",
")",
"from",
"documents"
] | [
"What",
"is",
"the",
"average",
"access",
"count",
"of",
"documents",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the average access count across all documents? | SELECT avg(access_count) FROM documents | [
"SELECT",
"avg",
"(",
"access_count",
")",
"FROM",
"documents"
] | [
"select",
"avg",
"(",
"access_count",
")",
"from",
"documents"
] | [
"Find",
"the",
"average",
"access",
"count",
"across",
"all",
"documents",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the structure of the document with the least number of accesses? | 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 | [
"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"
] | [
"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",
"value"
] | [
"What",
"is",
"the",
"structure",
"of",
"the",
"document",
"with",
"the",
"least",
"number",
"of",
"accesses",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Return the structure description of the document that has been accessed the fewest number of times. | 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 | [
"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"
] | [
"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",
"value"
] | [
"Return",
"the",
"structure",
"description",
"of",
"the",
"document",
"that",
"has",
"been",
"accessed",
"the",
"fewest",
"number",
"of",
"times",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the type of the document named "David CV"? | SELECT document_type_code FROM documents WHERE document_name = "David CV" | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"WHERE",
"document_name",
"=",
"``",
"David",
"CV",
"''"
] | [
"select",
"document_type_code",
"from",
"documents",
"where",
"document_name",
"=",
"value"
] | [
"What",
"is",
"the",
"type",
"of",
"the",
"document",
"named",
"``",
"David",
"CV",
"''",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Return the type code of the document named "David CV". | SELECT document_type_code FROM documents WHERE document_name = "David CV" | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"WHERE",
"document_name",
"=",
"``",
"David",
"CV",
"''"
] | [
"select",
"document_type_code",
"from",
"documents",
"where",
"document_name",
"=",
"value"
] | [
"Return",
"the",
"type",
"code",
"of",
"the",
"document",
"named",
"``",
"David",
"CV",
"''",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the list of documents that are both in the most three popular type and have the most three popular structure. | 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 | [
"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"
] | [
"select",
"document_name",
"from",
"documents",
"group",
"by",
"document_type_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value",
"intersect",
"select",
"document_name",
"from",
"documents",
"group",
"by",
"document_structure_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"list",
"of",
"documents",
"that",
"are",
"both",
"in",
"the",
"most",
"three",
"popular",
"type",
"and",
"have",
"the",
"most",
"three",
"popular",
"structure",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the names of documents that have both one of the three most common types and one of three most common structures? | 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 | [
"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"
] | [
"select",
"document_name",
"from",
"documents",
"group",
"by",
"document_type_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value",
"intersect",
"select",
"document_name",
"from",
"documents",
"group",
"by",
"document_structure_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"What",
"are",
"the",
"names",
"of",
"documents",
"that",
"have",
"both",
"one",
"of",
"the",
"three",
"most",
"common",
"types",
"and",
"one",
"of",
"three",
"most",
"common",
"structures",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What document types do have more than 10000 total access number. | SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count) > 10000 | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"HAVING",
"sum",
"(",
"access_count",
")",
">",
"10000"
] | [
"select",
"document_type_code",
"from",
"documents",
"group",
"by",
"document_type_code",
"having",
"sum",
"(",
"access_count",
")",
">",
"value"
] | [
"What",
"document",
"types",
"do",
"have",
"more",
"than",
"10000",
"total",
"access",
"number",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Return the codes of the document types that do not have a total access count of over 10000. | SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count) > 10000 | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"HAVING",
"sum",
"(",
"access_count",
")",
">",
"10000"
] | [
"select",
"document_type_code",
"from",
"documents",
"group",
"by",
"document_type_code",
"having",
"sum",
"(",
"access_count",
")",
">",
"value"
] | [
"Return",
"the",
"codes",
"of",
"the",
"document",
"types",
"that",
"do",
"not",
"have",
"a",
"total",
"access",
"count",
"of",
"over",
"10000",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are all the section titles of the document named "David CV"? | 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" | [
"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",
"''"
] | [
"select",
"t2",
".",
"section_title",
"from",
"documents",
"as",
"t1",
"join",
"document_sections",
"as",
"t2",
"on",
"t1",
".",
"document_code",
"=",
"t2",
".",
"document_code",
"where",
"t1",
".",
"document_name",
"=",
"value"
] | [
"What",
"are",
"all",
"the",
"section",
"titles",
"of",
"the",
"document",
"named",
"``",
"David",
"CV",
"''",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Give the section titles of the document with the name "David CV". | 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" | [
"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",
"''"
] | [
"select",
"t2",
".",
"section_title",
"from",
"documents",
"as",
"t1",
"join",
"document_sections",
"as",
"t2",
"on",
"t1",
".",
"document_code",
"=",
"t2",
".",
"document_code",
"where",
"t1",
".",
"document_name",
"=",
"value"
] | [
"Give",
"the",
"section",
"titles",
"of",
"the",
"document",
"with",
"the",
"name",
"``",
"David",
"CV",
"''",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find all the name of documents without any sections. | SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections) | [
"SELECT",
"document_name",
"FROM",
"documents",
"WHERE",
"document_code",
"NOT",
"IN",
"(",
"SELECT",
"document_code",
"FROM",
"document_sections",
")"
] | [
"select",
"document_name",
"from",
"documents",
"where",
"document_code",
"not",
"in",
"(",
"select",
"document_code",
"from",
"document_sections",
")"
] | [
"Find",
"all",
"the",
"name",
"of",
"documents",
"without",
"any",
"sections",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the names of documents that do not have any sections? | SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections) | [
"SELECT",
"document_name",
"FROM",
"documents",
"WHERE",
"document_code",
"NOT",
"IN",
"(",
"SELECT",
"document_code",
"FROM",
"document_sections",
")"
] | [
"select",
"document_name",
"from",
"documents",
"where",
"document_code",
"not",
"in",
"(",
"select",
"document_code",
"from",
"document_sections",
")"
] | [
"What",
"are",
"the",
"names",
"of",
"documents",
"that",
"do",
"not",
"have",
"any",
"sections",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | List all the username and passwords of users with the most popular role. | SELECT user_name , password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"user_name",
",",
"password",
"FROM",
"users",
"GROUP",
"BY",
"role_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"user_name",
",",
"password",
"from",
"users",
"group",
"by",
"role_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"List",
"all",
"the",
"username",
"and",
"passwords",
"of",
"users",
"with",
"the",
"most",
"popular",
"role",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the usernames and passwords of users that have the most common role? | SELECT user_name , password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"user_name",
",",
"password",
"FROM",
"users",
"GROUP",
"BY",
"role_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"user_name",
",",
"password",
"from",
"users",
"group",
"by",
"role_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"What",
"are",
"the",
"usernames",
"and",
"passwords",
"of",
"users",
"that",
"have",
"the",
"most",
"common",
"role",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the average access counts of documents with functional area "Acknowledgement". | 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" | [
"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",
"''"
] | [
"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",
"=",
"value"
] | [
"Find",
"the",
"average",
"access",
"counts",
"of",
"documents",
"with",
"functional",
"area",
"``",
"Acknowledgement",
"''",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the average access counts of documents that have the functional area description "Acknowledgement"? | 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" | [
"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",
"''"
] | [
"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",
"=",
"value"
] | [
"What",
"are",
"the",
"average",
"access",
"counts",
"of",
"documents",
"that",
"have",
"the",
"functional",
"area",
"description",
"``",
"Acknowledgement",
"''",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find names of the document without any images. | 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 | [
"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"
] | [
"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"
] | [
"Find",
"names",
"of",
"the",
"document",
"without",
"any",
"images",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the names of documents that do not have any images? | 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 | [
"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"
] | [
"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",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the name of the document with the most number of sections? | 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 | [
"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"
] | [
"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",
"value"
] | [
"What",
"is",
"the",
"name",
"of",
"the",
"document",
"with",
"the",
"most",
"number",
"of",
"sections",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Return the name of the document that has the most sections. | 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 | [
"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"
] | [
"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",
"value"
] | [
"Return",
"the",
"name",
"of",
"the",
"document",
"that",
"has",
"the",
"most",
"sections",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | List all the document names which contains "CV". | SELECT document_name FROM documents WHERE document_name LIKE "%CV%" | [
"SELECT",
"document_name",
"FROM",
"documents",
"WHERE",
"document_name",
"LIKE",
"``",
"%",
"CV",
"%",
"''"
] | [
"select",
"document_name",
"from",
"documents",
"where",
"document_name",
"like",
"value"
] | [
"List",
"all",
"the",
"document",
"names",
"which",
"contains",
"``",
"CV",
"''",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the names of documents that contain the substring "CV"? | SELECT document_name FROM documents WHERE document_name LIKE "%CV%" | [
"SELECT",
"document_name",
"FROM",
"documents",
"WHERE",
"document_name",
"LIKE",
"``",
"%",
"CV",
"%",
"''"
] | [
"select",
"document_name",
"from",
"documents",
"where",
"document_name",
"like",
"value"
] | [
"What",
"are",
"the",
"names",
"of",
"documents",
"that",
"contain",
"the",
"substring",
"``",
"CV",
"''",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | How many users are logged in? | SELECT count(*) FROM users WHERE user_login = 1 | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"users",
"WHERE",
"user_login",
"=",
"1"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"users",
"where",
"user_login",
"=",
"value"
] | [
"How",
"many",
"users",
"are",
"logged",
"in",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Count the number of users that are logged in. | SELECT count(*) FROM users WHERE user_login = 1 | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"users",
"WHERE",
"user_login",
"=",
"1"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"users",
"where",
"user_login",
"=",
"value"
] | [
"Count",
"the",
"number",
"of",
"users",
"that",
"are",
"logged",
"in",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the description of the most popular role among the users that have logged in. | 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) | [
"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",
")"
] | [
"select",
"role_description",
"from",
"roles",
"where",
"role_code",
"=",
"(",
"select",
"role_code",
"from",
"users",
"where",
"user_login",
"=",
"value",
"group",
"by",
"role_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value",
")"
] | [
"Find",
"the",
"description",
"of",
"the",
"most",
"popular",
"role",
"among",
"the",
"users",
"that",
"have",
"logged",
"in",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the description of the most popular role among users that have logged in? | 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) | [
"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",
")"
] | [
"select",
"role_description",
"from",
"roles",
"where",
"role_code",
"=",
"(",
"select",
"role_code",
"from",
"users",
"where",
"user_login",
"=",
"value",
"group",
"by",
"role_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value",
")"
] | [
"What",
"is",
"the",
"description",
"of",
"the",
"most",
"popular",
"role",
"among",
"users",
"that",
"have",
"logged",
"in",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the average access count of documents with the least popular structure. | SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1 | [
"SELECT",
"avg",
"(",
"access_count",
")",
"FROM",
"documents",
"GROUP",
"BY",
"document_structure_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"ASC",
"LIMIT",
"1"
] | [
"select",
"avg",
"(",
"access_count",
")",
"from",
"documents",
"group",
"by",
"document_structure_code",
"order",
"by",
"count",
"(",
"*",
")",
"asc",
"limit",
"value"
] | [
"Find",
"the",
"average",
"access",
"count",
"of",
"documents",
"with",
"the",
"least",
"popular",
"structure",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What is the average access count of documents that have the least common structure? | SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1 | [
"SELECT",
"avg",
"(",
"access_count",
")",
"FROM",
"documents",
"GROUP",
"BY",
"document_structure_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"ASC",
"LIMIT",
"1"
] | [
"select",
"avg",
"(",
"access_count",
")",
"from",
"documents",
"group",
"by",
"document_structure_code",
"order",
"by",
"count",
"(",
"*",
")",
"asc",
"limit",
"value"
] | [
"What",
"is",
"the",
"average",
"access",
"count",
"of",
"documents",
"that",
"have",
"the",
"least",
"common",
"structure",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | List all the image name and URLs in the order of their names. | SELECT image_name , image_url FROM images ORDER BY image_name | [
"SELECT",
"image_name",
",",
"image_url",
"FROM",
"images",
"ORDER",
"BY",
"image_name"
] | [
"select",
"image_name",
",",
"image_url",
"from",
"images",
"order",
"by",
"image_name"
] | [
"List",
"all",
"the",
"image",
"name",
"and",
"URLs",
"in",
"the",
"order",
"of",
"their",
"names",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the names and urls of images, sorted alphabetically? | SELECT image_name , image_url FROM images ORDER BY image_name | [
"SELECT",
"image_name",
",",
"image_url",
"FROM",
"images",
"ORDER",
"BY",
"image_name"
] | [
"select",
"image_name",
",",
"image_url",
"from",
"images",
"order",
"by",
"image_name"
] | [
"What",
"are",
"the",
"names",
"and",
"urls",
"of",
"images",
",",
"sorted",
"alphabetically",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Find the number of users in each role. | SELECT count(*) , role_code FROM users GROUP BY role_code | [
"SELECT",
"count",
"(",
"*",
")",
",",
"role_code",
"FROM",
"users",
"GROUP",
"BY",
"role_code"
] | [
"select",
"count",
"(",
"*",
")",
",",
"role_code",
"from",
"users",
"group",
"by",
"role_code"
] | [
"Find",
"the",
"number",
"of",
"users",
"in",
"each",
"role",
"."
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What are the different role codes for users, and how many users have each? | SELECT count(*) , role_code FROM users GROUP BY role_code | [
"SELECT",
"count",
"(",
"*",
")",
",",
"role_code",
"FROM",
"users",
"GROUP",
"BY",
"role_code"
] | [
"select",
"count",
"(",
"*",
")",
",",
"role_code",
"from",
"users",
"group",
"by",
"role_code"
] | [
"What",
"are",
"the",
"different",
"role",
"codes",
"for",
"users",
",",
"and",
"how",
"many",
"users",
"have",
"each",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | What document types have more than 2 corresponding documents? | SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 2 | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"HAVING",
"count",
"(",
"*",
")",
">",
"2"
] | [
"select",
"document_type_code",
"from",
"documents",
"group",
"by",
"document_type_code",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"What",
"document",
"types",
"have",
"more",
"than",
"2",
"corresponding",
"documents",
"?"
] |
document_management | [
"CREATE TABLE `Roles` (\n`role_code` VARCHAR(15) PRIMARY KEY,\n`role_description` VARCHAR(80)\n);",
"CREATE TABLE `Users` (\n`user_id` INTEGER PRIMARY KEY,\n`role_code` VARCHAR(15) NOT NULL,\n`user_name` VARCHAR(40),\n`user_login` VARCHAR(40),\n`password` VARCHAR(40),\nFOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )\n);",
"CREATE TABLE `Document_Structures` (\n`document_structure_code` VARCHAR(15) PRIMARY KEY,\n`parent_document_structure_code` VARCHAR(15),\n`document_structure_description` VARCHAR(80)\n);",
"CREATE TABLE `Functional_Areas` (\n`functional_area_code` VARCHAR(15) PRIMARY KEY,\n`parent_functional_area_code` VARCHAR(15),\n`functional_area_description` VARCHAR(80) NOT NULL\n);",
"CREATE TABLE `Images` (\n`image_id` INTEGER PRIMARY KEY,\n`image_alt_text` VARCHAR(80),\n`image_name` VARCHAR(40),\n`image_url` VARCHAR(255)\n);",
"CREATE TABLE `Documents` (\n`document_code` VARCHAR(15) PRIMARY KEY,\n`document_structure_code` VARCHAR(15) NOT NULL,\n`document_type_code` VARCHAR(15) NOT NULL,\n`access_count` INTEGER,\n`document_name` VARCHAR(80),\nFOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )\n);",
"CREATE TABLE `Document_Functional_Areas` (\n`document_code` VARCHAR(15) NOT NULL,\n`functional_area_code` VARCHAR(15) NOT NULL,\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),\nFOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )\n);",
"CREATE TABLE `Document_Sections` (\n`section_id` INTEGER PRIMARY KEY,\n`document_code` VARCHAR(15) NOT NULL,\n`section_sequence` INTEGER,\n`section_code` VARCHAR(20),\n`section_title` VARCHAR(80),\nFOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )\n);",
"CREATE TABLE `Document_Sections_Images` (\n`section_id` INTEGER NOT NULL,\n`image_id` INTEGER NOT NULL,\nPRIMARY KEY (`section_id`,`image_id`),\nFOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),\nFOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )\n);"
] | Give the codes of document types that have more than 2 corresponding documents. | SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 2 | [
"SELECT",
"document_type_code",
"FROM",
"documents",
"GROUP",
"BY",
"document_type_code",
"HAVING",
"count",
"(",
"*",
")",
">",
"2"
] | [
"select",
"document_type_code",
"from",
"documents",
"group",
"by",
"document_type_code",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Give",
"the",
"codes",
"of",
"document",
"types",
"that",
"have",
"more",
"than",
"2",
"corresponding",
"documents",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | How many companies are there? | SELECT count(*) FROM Companies | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Companies"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"companies"
] | [
"How",
"many",
"companies",
"are",
"there",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Count the number of companies. | SELECT count(*) FROM Companies | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Companies"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"companies"
] | [
"Count",
"the",
"number",
"of",
"companies",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | List the names of companies in descending order of market value. | SELECT name FROM Companies ORDER BY Market_Value_billion DESC | [
"SELECT",
"name",
"FROM",
"Companies",
"ORDER",
"BY",
"Market_Value_billion",
"DESC"
] | [
"select",
"name",
"from",
"companies",
"order",
"by",
"market_value_billion",
"desc"
] | [
"List",
"the",
"names",
"of",
"companies",
"in",
"descending",
"order",
"of",
"market",
"value",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Sort the company names in descending order of the company's market value. | SELECT name FROM Companies ORDER BY Market_Value_billion DESC | [
"SELECT",
"name",
"FROM",
"Companies",
"ORDER",
"BY",
"Market_Value_billion",
"DESC"
] | [
"select",
"name",
"from",
"companies",
"order",
"by",
"market_value_billion",
"desc"
] | [
"Sort",
"the",
"company",
"names",
"in",
"descending",
"order",
"of",
"the",
"company",
"'s",
"market",
"value",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | What are the names of companies whose headquarters are not "USA"? | SELECT name FROM Companies WHERE Headquarters != 'USA' | [
"SELECT",
"name",
"FROM",
"Companies",
"WHERE",
"Headquarters",
"!",
"=",
"'USA",
"'"
] | [
"select",
"name",
"from",
"companies",
"where",
"headquarters",
"!",
"=",
"value"
] | [
"What",
"are",
"the",
"names",
"of",
"companies",
"whose",
"headquarters",
"are",
"not",
"``",
"USA",
"''",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Find the names of the companies whose headquarters are not located in "USA". | SELECT name FROM Companies WHERE Headquarters != 'USA' | [
"SELECT",
"name",
"FROM",
"Companies",
"WHERE",
"Headquarters",
"!",
"=",
"'USA",
"'"
] | [
"select",
"name",
"from",
"companies",
"where",
"headquarters",
"!",
"=",
"value"
] | [
"Find",
"the",
"names",
"of",
"the",
"companies",
"whose",
"headquarters",
"are",
"not",
"located",
"in",
"``",
"USA",
"''",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | What are the name and assets of each company, sorted in ascending order of company name? | SELECT name , Assets_billion FROM Companies ORDER BY name ASC | [
"SELECT",
"name",
",",
"Assets_billion",
"FROM",
"Companies",
"ORDER",
"BY",
"name",
"ASC"
] | [
"select",
"name",
",",
"assets_billion",
"from",
"companies",
"order",
"by",
"name",
"asc"
] | [
"What",
"are",
"the",
"name",
"and",
"assets",
"of",
"each",
"company",
",",
"sorted",
"in",
"ascending",
"order",
"of",
"company",
"name",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | List the name and assets of each company in ascending order of company name. | SELECT name , Assets_billion FROM Companies ORDER BY name ASC | [
"SELECT",
"name",
",",
"Assets_billion",
"FROM",
"Companies",
"ORDER",
"BY",
"name",
"ASC"
] | [
"select",
"name",
",",
"assets_billion",
"from",
"companies",
"order",
"by",
"name",
"asc"
] | [
"List",
"the",
"name",
"and",
"assets",
"of",
"each",
"company",
"in",
"ascending",
"order",
"of",
"company",
"name",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | What are the average profits of companies? | SELECT avg(Profits_billion) FROM Companies | [
"SELECT",
"avg",
"(",
"Profits_billion",
")",
"FROM",
"Companies"
] | [
"select",
"avg",
"(",
"profits_billion",
")",
"from",
"companies"
] | [
"What",
"are",
"the",
"average",
"profits",
"of",
"companies",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Compute the average profits companies make. | SELECT avg(Profits_billion) FROM Companies | [
"SELECT",
"avg",
"(",
"Profits_billion",
")",
"FROM",
"Companies"
] | [
"select",
"avg",
"(",
"profits_billion",
")",
"from",
"companies"
] | [
"Compute",
"the",
"average",
"profits",
"companies",
"make",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | What are the maximum and minimum sales of the companies whose industries are not "Banking". | SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != "Banking" | [
"SELECT",
"max",
"(",
"Sales_billion",
")",
",",
"min",
"(",
"Sales_billion",
")",
"FROM",
"Companies",
"WHERE",
"Industry",
"!",
"=",
"``",
"Banking",
"''"
] | [
"select",
"max",
"(",
"sales_billion",
")",
",",
"min",
"(",
"sales_billion",
")",
"from",
"companies",
"where",
"industry",
"!",
"=",
"value"
] | [
"What",
"are",
"the",
"maximum",
"and",
"minimum",
"sales",
"of",
"the",
"companies",
"whose",
"industries",
"are",
"not",
"``",
"Banking",
"''",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Find the maximum and minimum sales of the companies that are not in the "Banking" industry. | SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != "Banking" | [
"SELECT",
"max",
"(",
"Sales_billion",
")",
",",
"min",
"(",
"Sales_billion",
")",
"FROM",
"Companies",
"WHERE",
"Industry",
"!",
"=",
"``",
"Banking",
"''"
] | [
"select",
"max",
"(",
"sales_billion",
")",
",",
"min",
"(",
"sales_billion",
")",
"from",
"companies",
"where",
"industry",
"!",
"=",
"value"
] | [
"Find",
"the",
"maximum",
"and",
"minimum",
"sales",
"of",
"the",
"companies",
"that",
"are",
"not",
"in",
"the",
"``",
"Banking",
"''",
"industry",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | How many different industries are the companies in? | SELECT count(DISTINCT Industry) FROM Companies | [
"SELECT",
"count",
"(",
"DISTINCT",
"Industry",
")",
"FROM",
"Companies"
] | [
"select",
"count",
"(",
"distinct",
"industry",
")",
"from",
"companies"
] | [
"How",
"many",
"different",
"industries",
"are",
"the",
"companies",
"in",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Count the number of distinct company industries. | SELECT count(DISTINCT Industry) FROM Companies | [
"SELECT",
"count",
"(",
"DISTINCT",
"Industry",
")",
"FROM",
"Companies"
] | [
"select",
"count",
"(",
"distinct",
"industry",
")",
"from",
"companies"
] | [
"Count",
"the",
"number",
"of",
"distinct",
"company",
"industries",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | List the names of buildings in descending order of building height. | SELECT name FROM buildings ORDER BY Height DESC | [
"SELECT",
"name",
"FROM",
"buildings",
"ORDER",
"BY",
"Height",
"DESC"
] | [
"select",
"name",
"from",
"buildings",
"order",
"by",
"height",
"desc"
] | [
"List",
"the",
"names",
"of",
"buildings",
"in",
"descending",
"order",
"of",
"building",
"height",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | What are the names of buildings sorted in descending order of building height? | SELECT name FROM buildings ORDER BY Height DESC | [
"SELECT",
"name",
"FROM",
"buildings",
"ORDER",
"BY",
"Height",
"DESC"
] | [
"select",
"name",
"from",
"buildings",
"order",
"by",
"height",
"desc"
] | [
"What",
"are",
"the",
"names",
"of",
"buildings",
"sorted",
"in",
"descending",
"order",
"of",
"building",
"height",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Find the stories of the building with the largest height. | SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1 | [
"SELECT",
"Stories",
"FROM",
"buildings",
"ORDER",
"BY",
"Height",
"DESC",
"LIMIT",
"1"
] | [
"select",
"stories",
"from",
"buildings",
"order",
"by",
"height",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"stories",
"of",
"the",
"building",
"with",
"the",
"largest",
"height",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | What is the stories of highest building? | SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1 | [
"SELECT",
"Stories",
"FROM",
"buildings",
"ORDER",
"BY",
"Height",
"DESC",
"LIMIT",
"1"
] | [
"select",
"stories",
"from",
"buildings",
"order",
"by",
"height",
"desc",
"limit",
"value"
] | [
"What",
"is",
"the",
"stories",
"of",
"highest",
"building",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | List the name of a building along with the name of a company whose office is in the building. | 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 | [
"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"
] | [
"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"
] | [
"List",
"the",
"name",
"of",
"a",
"building",
"along",
"with",
"the",
"name",
"of",
"a",
"company",
"whose",
"office",
"is",
"in",
"the",
"building",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | For each company, return the company name and the name of the building its office is located in. | 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 | [
"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"
] | [
"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",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Show the names of the buildings that have more than one company offices. | 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 | [
"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"
] | [
"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",
"(",
"*",
")",
">",
"value"
] | [
"Show",
"the",
"names",
"of",
"the",
"buildings",
"that",
"have",
"more",
"than",
"one",
"company",
"offices",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Which buildings have more than one company offices? Give me the building names. | 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 | [
"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"
] | [
"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",
"(",
"*",
")",
">",
"value"
] | [
"Which",
"buildings",
"have",
"more",
"than",
"one",
"company",
"offices",
"?",
"Give",
"me",
"the",
"building",
"names",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Show the name of the building that has the most company offices. | 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 | [
"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"
] | [
"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",
"value"
] | [
"Show",
"the",
"name",
"of",
"the",
"building",
"that",
"has",
"the",
"most",
"company",
"offices",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Which building has the largest number of company offices? Give me the building name. | 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 | [
"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"
] | [
"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",
"value"
] | [
"Which",
"building",
"has",
"the",
"largest",
"number",
"of",
"company",
"offices",
"?",
"Give",
"me",
"the",
"building",
"name",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Please show the names of the buildings whose status is "on-hold", in ascending order of stories. | SELECT name FROM buildings WHERE Status = "on-hold" ORDER BY Stories ASC | [
"SELECT",
"name",
"FROM",
"buildings",
"WHERE",
"Status",
"=",
"``",
"on-hold",
"''",
"ORDER",
"BY",
"Stories",
"ASC"
] | [
"select",
"name",
"from",
"buildings",
"where",
"status",
"=",
"value",
"order",
"by",
"stories",
"asc"
] | [
"Please",
"show",
"the",
"names",
"of",
"the",
"buildings",
"whose",
"status",
"is",
"``",
"on-hold",
"''",
",",
"in",
"ascending",
"order",
"of",
"stories",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Find the names of the buildings in "on-hold" status, and sort them in ascending order of building stories. | SELECT name FROM buildings WHERE Status = "on-hold" ORDER BY Stories ASC | [
"SELECT",
"name",
"FROM",
"buildings",
"WHERE",
"Status",
"=",
"``",
"on-hold",
"''",
"ORDER",
"BY",
"Stories",
"ASC"
] | [
"select",
"name",
"from",
"buildings",
"where",
"status",
"=",
"value",
"order",
"by",
"stories",
"asc"
] | [
"Find",
"the",
"names",
"of",
"the",
"buildings",
"in",
"``",
"on-hold",
"''",
"status",
",",
"and",
"sort",
"them",
"in",
"ascending",
"order",
"of",
"building",
"stories",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Please show each industry and the corresponding number of companies in that industry. | SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry | [
"SELECT",
"Industry",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"Companies",
"GROUP",
"BY",
"Industry"
] | [
"select",
"industry",
",",
"count",
"(",
"*",
")",
"from",
"companies",
"group",
"by",
"industry"
] | [
"Please",
"show",
"each",
"industry",
"and",
"the",
"corresponding",
"number",
"of",
"companies",
"in",
"that",
"industry",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Whah are the name of each industry and the number of companies in that industry? | SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry | [
"SELECT",
"Industry",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"Companies",
"GROUP",
"BY",
"Industry"
] | [
"select",
"industry",
",",
"count",
"(",
"*",
")",
"from",
"companies",
"group",
"by",
"industry"
] | [
"Whah",
"are",
"the",
"name",
"of",
"each",
"industry",
"and",
"the",
"number",
"of",
"companies",
"in",
"that",
"industry",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Please show the industries of companies in descending order of the number of companies. | SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC | [
"SELECT",
"Industry",
"FROM",
"Companies",
"GROUP",
"BY",
"Industry",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC"
] | [
"select",
"industry",
"from",
"companies",
"group",
"by",
"industry",
"order",
"by",
"count",
"(",
"*",
")",
"desc"
] | [
"Please",
"show",
"the",
"industries",
"of",
"companies",
"in",
"descending",
"order",
"of",
"the",
"number",
"of",
"companies",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Sort all the industries in descending order of the count of companies in each industry | SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC | [
"SELECT",
"Industry",
"FROM",
"Companies",
"GROUP",
"BY",
"Industry",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC"
] | [
"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"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | List the industry shared by the most companies. | SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 | [
"SELECT",
"Industry",
"FROM",
"Companies",
"GROUP",
"BY",
"Industry",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"industry",
"from",
"companies",
"group",
"by",
"industry",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"List",
"the",
"industry",
"shared",
"by",
"the",
"most",
"companies",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Which industry has the most companies? | SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 | [
"SELECT",
"Industry",
"FROM",
"Companies",
"GROUP",
"BY",
"Industry",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"industry",
"from",
"companies",
"group",
"by",
"industry",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Which",
"industry",
"has",
"the",
"most",
"companies",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | List the names of buildings that have no company office. | SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations) | [
"SELECT",
"name",
"FROM",
"buildings",
"WHERE",
"id",
"NOT",
"IN",
"(",
"SELECT",
"building_id",
"FROM",
"Office_locations",
")"
] | [
"select",
"name",
"from",
"buildings",
"where",
"id",
"not",
"in",
"(",
"select",
"building_id",
"from",
"office_locations",
")"
] | [
"List",
"the",
"names",
"of",
"buildings",
"that",
"have",
"no",
"company",
"office",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Which buildings do not have any company office? Give me the building names. | SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations) | [
"SELECT",
"name",
"FROM",
"buildings",
"WHERE",
"id",
"NOT",
"IN",
"(",
"SELECT",
"building_id",
"FROM",
"Office_locations",
")"
] | [
"select",
"name",
"from",
"buildings",
"where",
"id",
"not",
"in",
"(",
"select",
"building_id",
"from",
"office_locations",
")"
] | [
"Which",
"buildings",
"do",
"not",
"have",
"any",
"company",
"office",
"?",
"Give",
"me",
"the",
"building",
"names",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "China". | SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China" | [
"SELECT",
"Industry",
"FROM",
"Companies",
"WHERE",
"Headquarters",
"=",
"``",
"USA",
"''",
"INTERSECT",
"SELECT",
"Industry",
"FROM",
"Companies",
"WHERE",
"Headquarters",
"=",
"``",
"China",
"''"
] | [
"select",
"industry",
"from",
"companies",
"where",
"headquarters",
"=",
"value",
"intersect",
"select",
"industry",
"from",
"companies",
"where",
"headquarters",
"=",
"value"
] | [
"Show",
"the",
"industries",
"shared",
"by",
"companies",
"whose",
"headquarters",
"are",
"``",
"USA",
"''",
"and",
"companies",
"whose",
"headquarters",
"are",
"``",
"China",
"''",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Which industries have both companies with headquarter in "USA" and companies with headquarter in "China"? | SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China" | [
"SELECT",
"Industry",
"FROM",
"Companies",
"WHERE",
"Headquarters",
"=",
"``",
"USA",
"''",
"INTERSECT",
"SELECT",
"Industry",
"FROM",
"Companies",
"WHERE",
"Headquarters",
"=",
"``",
"China",
"''"
] | [
"select",
"industry",
"from",
"companies",
"where",
"headquarters",
"=",
"value",
"intersect",
"select",
"industry",
"from",
"companies",
"where",
"headquarters",
"=",
"value"
] | [
"Which",
"industries",
"have",
"both",
"companies",
"with",
"headquarter",
"in",
"``",
"USA",
"''",
"and",
"companies",
"with",
"headquarter",
"in",
"``",
"China",
"''",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Find the number of companies whose industry is "Banking" or "Conglomerate", | SELECT count(*) FROM Companies WHERE Industry = "Banking" OR Industry = "Conglomerate" | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Companies",
"WHERE",
"Industry",
"=",
"``",
"Banking",
"''",
"OR",
"Industry",
"=",
"``",
"Conglomerate",
"''"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"companies",
"where",
"industry",
"=",
"value",
"or",
"industry",
"=",
"value"
] | [
"Find",
"the",
"number",
"of",
"companies",
"whose",
"industry",
"is",
"``",
"Banking",
"''",
"or",
"``",
"Conglomerate",
"''",
","
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | How many companies are in either "Banking" industry or "Conglomerate" industry? | SELECT count(*) FROM Companies WHERE Industry = "Banking" OR Industry = "Conglomerate" | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Companies",
"WHERE",
"Industry",
"=",
"``",
"Banking",
"''",
"OR",
"Industry",
"=",
"``",
"Conglomerate",
"''"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"companies",
"where",
"industry",
"=",
"value",
"or",
"industry",
"=",
"value"
] | [
"How",
"many",
"companies",
"are",
"in",
"either",
"``",
"Banking",
"''",
"industry",
"or",
"``",
"Conglomerate",
"''",
"industry",
"?"
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Show the headquarters shared by more than two companies. | SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2 | [
"SELECT",
"Headquarters",
"FROM",
"Companies",
"GROUP",
"BY",
"Headquarters",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"2"
] | [
"select",
"headquarters",
"from",
"companies",
"group",
"by",
"headquarters",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Show",
"the",
"headquarters",
"shared",
"by",
"more",
"than",
"two",
"companies",
"."
] |
company_office | [
"CREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);",
"CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);",
"CREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);"
] | Which headquarter locations are used by more than 2 companies? | SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2 | [
"SELECT",
"Headquarters",
"FROM",
"Companies",
"GROUP",
"BY",
"Headquarters",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"2"
] | [
"select",
"headquarters",
"from",
"companies",
"group",
"by",
"headquarters",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Which",
"headquarter",
"locations",
"are",
"used",
"by",
"more",
"than",
"2",
"companies",
"?"
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | How many products are there? | SELECT count(*) FROM Products | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Products"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"products"
] | [
"How",
"many",
"products",
"are",
"there",
"?"
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | List the name of products in ascending order of price. | SELECT Product_Name FROM Products ORDER BY Product_Price ASC | [
"SELECT",
"Product_Name",
"FROM",
"Products",
"ORDER",
"BY",
"Product_Price",
"ASC"
] | [
"select",
"product_name",
"from",
"products",
"order",
"by",
"product_price",
"asc"
] | [
"List",
"the",
"name",
"of",
"products",
"in",
"ascending",
"order",
"of",
"price",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | What are the names and type codes of products? | SELECT Product_Name , Product_Type_Code FROM Products | [
"SELECT",
"Product_Name",
",",
"Product_Type_Code",
"FROM",
"Products"
] | [
"select",
"product_name",
",",
"product_type_code",
"from",
"products"
] | [
"What",
"are",
"the",
"names",
"and",
"type",
"codes",
"of",
"products",
"?"
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the prices of the products named "Dining" or "Trading Policy". | SELECT Product_Price FROM Products WHERE Product_Name = "Dining" OR Product_Name = "Trading Policy" | [
"SELECT",
"Product_Price",
"FROM",
"Products",
"WHERE",
"Product_Name",
"=",
"``",
"Dining",
"''",
"OR",
"Product_Name",
"=",
"``",
"Trading",
"Policy",
"''"
] | [
"select",
"product_price",
"from",
"products",
"where",
"product_name",
"=",
"value",
"or",
"product_name",
"=",
"value"
] | [
"Show",
"the",
"prices",
"of",
"the",
"products",
"named",
"``",
"Dining",
"''",
"or",
"``",
"Trading",
"Policy",
"''",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | What is the average price for products? | SELECT avg(Product_Price) FROM Products | [
"SELECT",
"avg",
"(",
"Product_Price",
")",
"FROM",
"Products"
] | [
"select",
"avg",
"(",
"product_price",
")",
"from",
"products"
] | [
"What",
"is",
"the",
"average",
"price",
"for",
"products",
"?"
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | What is the name of the product with the highest price? | SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1 | [
"SELECT",
"Product_Name",
"FROM",
"Products",
"ORDER",
"BY",
"Product_Price",
"DESC",
"LIMIT",
"1"
] | [
"select",
"product_name",
"from",
"products",
"order",
"by",
"product_price",
"desc",
"limit",
"value"
] | [
"What",
"is",
"the",
"name",
"of",
"the",
"product",
"with",
"the",
"highest",
"price",
"?"
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show different type codes of products and the number of products with each type code. | SELECT Product_Type_Code , COUNT(*) FROM Products GROUP BY Product_Type_Code | [
"SELECT",
"Product_Type_Code",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"Products",
"GROUP",
"BY",
"Product_Type_Code"
] | [
"select",
"product_type_code",
",",
"count",
"(",
"*",
")",
"from",
"products",
"group",
"by",
"product_type_code"
] | [
"Show",
"different",
"type",
"codes",
"of",
"products",
"and",
"the",
"number",
"of",
"products",
"with",
"each",
"type",
"code",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the most common type code across products. | SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1 | [
"SELECT",
"Product_Type_Code",
"FROM",
"Products",
"GROUP",
"BY",
"Product_Type_Code",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Show",
"the",
"most",
"common",
"type",
"code",
"across",
"products",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the product type codes that have at least two products. | SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*) >= 2 | [
"SELECT",
"Product_Type_Code",
"FROM",
"Products",
"GROUP",
"BY",
"Product_Type_Code",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"=",
"2"
] | [
"select",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] | [
"Show",
"the",
"product",
"type",
"codes",
"that",
"have",
"at",
"least",
"two",
"products",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000. | SELECT Product_Type_Code FROM Products WHERE Product_Price > 4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price < 3000 | [
"SELECT",
"Product_Type_Code",
"FROM",
"Products",
"WHERE",
"Product_Price",
">",
"4500",
"INTERSECT",
"SELECT",
"Product_Type_Code",
"FROM",
"Products",
"WHERE",
"Product_Price",
"<",
"3000"
] | [
"select",
"product_type_code",
"from",
"products",
"where",
"product_price",
">",
"value",
"intersect",
"select",
"product_type_code",
"from",
"products",
"where",
"product_price",
"<",
"value"
] | [
"Show",
"the",
"product",
"type",
"codes",
"that",
"have",
"both",
"products",
"with",
"price",
"higher",
"than",
"4500",
"and",
"products",
"with",
"price",
"lower",
"than",
"3000",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the names of products and the number of events they are in. | 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 | [
"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"
] | [
"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",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the names of products and the number of events they are in, sorted by the number of events in descending order. | 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 | [
"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"
] | [
"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",
"and",
"the",
"number",
"of",
"events",
"they",
"are",
"in",
",",
"sorted",
"by",
"the",
"number",
"of",
"events",
"in",
"descending",
"order",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the names of products that are in at least two events. | 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 | [
"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"
] | [
"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",
"(",
"*",
")",
">",
"=",
"value"
] | [
"Show",
"the",
"names",
"of",
"products",
"that",
"are",
"in",
"at",
"least",
"two",
"events",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | Show the names of products that are in at least two events in ascending alphabetical order of product name. | 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 | [
"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"
] | [
"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",
"(",
"*",
")",
">",
"=",
"value",
"order",
"by",
"t1",
".",
"product_name"
] | [
"Show",
"the",
"names",
"of",
"products",
"that",
"are",
"in",
"at",
"least",
"two",
"events",
"in",
"ascending",
"alphabetical",
"order",
"of",
"product",
"name",
"."
] |
solvency_ii | [
"CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);",
"CREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);",
"CREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);",
"CREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);",
"CREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);",
"CREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);",
"CREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);",
"CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);",
"CREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);",
"CREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);",
"CREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);"
] | List the names of products that are not in any event. | SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events) | [
"SELECT",
"Product_Name",
"FROM",
"Products",
"WHERE",
"Product_ID",
"NOT",
"IN",
"(",
"SELECT",
"Product_ID",
"FROM",
"Products_in_Events",
")"
] | [
"select",
"product_name",
"from",
"products",
"where",
"product_id",
"not",
"in",
"(",
"select",
"product_id",
"from",
"products_in_events",
")"
] | [
"List",
"the",
"names",
"of",
"products",
"that",
"are",
"not",
"in",
"any",
"event",
"."
] |
entertainment_awards | [
"CREATE TABLE \"festival_detail\" (\n\"Festival_ID\" int,\n\"Festival_Name\" text,\n\"Chair_Name\" text,\n\"Location\" text,\n\"Year\" int,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Festival_ID\")\n);",
"CREATE TABLE artwork (\n\"Artwork_ID\" int,\n\"Type\" text,\n\"Name\" text,\nPRIMARY KEY (\"Artwork_ID\")\n);",
"CREATE TABLE nomination (\n\"Artwork_ID\" int,\n\"Festival_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Artwork_ID\",\"Festival_ID\"),\nFOREIGN KEY (\"Artwork_ID\") REFERENCES `artwork`(\"Artwork_ID\"),\nFOREIGN KEY (\"Festival_ID\") REFERENCES `festival_detail`(\"Festival_ID\")\n);"
] | How many artworks are there? | SELECT count(*) FROM artwork | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"artwork"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"artwork"
] | [
"How",
"many",
"artworks",
"are",
"there",
"?"
] |
entertainment_awards | [
"CREATE TABLE \"festival_detail\" (\n\"Festival_ID\" int,\n\"Festival_Name\" text,\n\"Chair_Name\" text,\n\"Location\" text,\n\"Year\" int,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Festival_ID\")\n);",
"CREATE TABLE artwork (\n\"Artwork_ID\" int,\n\"Type\" text,\n\"Name\" text,\nPRIMARY KEY (\"Artwork_ID\")\n);",
"CREATE TABLE nomination (\n\"Artwork_ID\" int,\n\"Festival_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Artwork_ID\",\"Festival_ID\"),\nFOREIGN KEY (\"Artwork_ID\") REFERENCES `artwork`(\"Artwork_ID\"),\nFOREIGN KEY (\"Festival_ID\") REFERENCES `festival_detail`(\"Festival_ID\")\n);"
] | List the name of artworks in ascending alphabetical order. | SELECT Name FROM artwork ORDER BY Name ASC | [
"SELECT",
"Name",
"FROM",
"artwork",
"ORDER",
"BY",
"Name",
"ASC"
] | [
"select",
"name",
"from",
"artwork",
"order",
"by",
"name",
"asc"
] | [
"List",
"the",
"name",
"of",
"artworks",
"in",
"ascending",
"alphabetical",
"order",
"."
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.