| db_id
				 stringclasses 127
				values | query
				 stringlengths 20 523 | question
				 stringlengths 16 224 | schema
				 stringclasses 127
				values | 
|---|---|---|---|
| 
	document_management | 
	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? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT user_name ,  password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 | 
	List all the username and passwords of users with the most popular role. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT user_name ,  password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 | 
	What are the usernames and passwords of users that have the most common role? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code  =  t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code  =  t3.functional_area_code WHERE t3.functional_area_description  =  "Acknowledgement" | 
	Find the average access counts of documents with functional area "Acknowledgement". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code  =  t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code  =  t3.functional_area_code WHERE t3.functional_area_description  =  "Acknowledgement" | 
	What are the average access counts of documents that have the functional area description "Acknowledgement"? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	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? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	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 | 
	What is the name of the document with the most number of sections? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1 | 
	Return the name of the document that has the most sections. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT document_name FROM documents WHERE document_name LIKE "%CV%" | 
	List all the document names which contains "CV". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT document_name FROM documents WHERE document_name LIKE "%CV%" | 
	What are the names of documents that contain the substring "CV"? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT count(*) FROM users WHERE user_login  =  1 | 
	How many users are logged in? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT count(*) FROM users WHERE user_login  =  1 | 
	Count the number of users that are logged in. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT role_description FROM ROLES WHERE role_code  =  (SELECT role_code FROM users WHERE user_login  =  1 GROUP BY role_code ORDER BY count(*) DESC LIMIT 1) | 
	Find the description of the most popular role among the users that have logged in. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT role_description FROM ROLES WHERE role_code  =  (SELECT role_code FROM users WHERE user_login  =  1 GROUP BY role_code ORDER BY count(*) DESC LIMIT 1) | 
	What is the description of the most popular role among users that have logged in? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1 | 
	Find the average access count of documents with the least popular structure. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1 | 
	What is the average access count of documents that have the least common structure? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT image_name ,  image_url FROM images ORDER BY image_name | 
	List all the image name and URLs in the order of their names. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT image_name ,  image_url FROM images ORDER BY image_name | 
	What are the names and urls of images, sorted alphabetically? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT count(*) ,  role_code FROM users GROUP BY role_code | 
	Find the number of users in each role. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT count(*) ,  role_code FROM users GROUP BY role_code | 
	What are the different role codes for users, and how many users have each? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  2 | 
	What document types have more than 2 corresponding documents? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	document_management | 
	SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  2 | 
	Give the codes of document types that have more than 2 corresponding documents. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE `Roles` (
`role_code` VARCHAR(15) PRIMARY KEY,
`role_description` VARCHAR(80)
);
CREATE TABLE `Users` (
`user_id` INTEGER PRIMARY KEY,
`role_code` VARCHAR(15) NOT NULL,
`user_name` VARCHAR(40),
`user_login` VARCHAR(40),
`password` VARCHAR(40),
FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` )
);
CREATE TABLE `Document_Structures` (
`document_structure_code` VARCHAR(15) PRIMARY KEY,
`parent_document_structure_code` VARCHAR(15),
`document_structure_description` VARCHAR(80)
);
CREATE TABLE `Functional_Areas` (
`functional_area_code` VARCHAR(15) PRIMARY KEY,
`parent_functional_area_code` VARCHAR(15),
`functional_area_description` VARCHAR(80) NOT NULL
);
CREATE TABLE `Images` (
`image_id` INTEGER PRIMARY KEY,
`image_alt_text` VARCHAR(80),
`image_name` VARCHAR(40),
`image_url` VARCHAR(255)
);
CREATE TABLE `Documents` (
`document_code` VARCHAR(15) PRIMARY KEY,
`document_structure_code` VARCHAR(15) NOT NULL,
`document_type_code` VARCHAR(15) NOT NULL,
`access_count` INTEGER,
`document_name` VARCHAR(80),
FOREIGN KEY (`document_structure_code` ) REFERENCES `Document_Structures`(`document_structure_code` )
);
CREATE TABLE `Document_Functional_Areas` (
`document_code` VARCHAR(15) NOT NULL,
`functional_area_code` VARCHAR(15) NOT NULL,
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` ),
FOREIGN KEY (`functional_area_code` ) REFERENCES `Functional_Areas`(`functional_area_code` )
);
CREATE TABLE `Document_Sections` (
`section_id` INTEGER PRIMARY KEY,
`document_code` VARCHAR(15) NOT NULL,
`section_sequence` INTEGER,
`section_code` VARCHAR(20),
`section_title` VARCHAR(80),
FOREIGN KEY (`document_code` ) REFERENCES `Documents`(`document_code` )
);
CREATE TABLE `Document_Sections_Images` (
`section_id` INTEGER NOT NULL,
`image_id` INTEGER NOT NULL,
PRIMARY KEY (`section_id`,`image_id`),
FOREIGN KEY (`section_id` ) REFERENCES `Document_Sections`(`section_id` ),
FOREIGN KEY (`image_id` ) REFERENCES `Images`(`image_id` )
);
INSERT INTO Roles (`role_code`, `role_description`) VALUES ('DBA', 'Database Administrator')INSERT INTO Users (`user_id`, `role_code`, `user_name`, `user_login`, `password`) VALUES (1, 'PROJ-MGR', 'dickens.elta', '0', 'e72b5a2d50b39a8760764a5f7a9d68ca2f076877')INSERT INTO Document_Structures (`document_structure_code`, `parent_document_structure_code`, `document_structure_description`) VALUES ('1', '1', 'Header')INSERT INTO Functional_Areas (`functional_area_code`, `parent_functional_area_code`, `functional_area_description`) VALUES ('8', '8', 'Signature')INSERT INTO Images (`image_id`, `image_alt_text`, `image_name`, `image_url`) VALUES (1, 'Lea', 'top1', 'http://www.rempelnader.com/1.jpg')INSERT INTO Documents (`document_code`, `document_structure_code`, `document_type_code`, `access_count`, `document_name`) VALUES ('217', '8', 'Book', 1864, 'Learning English')INSERT INTO Document_Functional_Areas (`document_code`, `functional_area_code`) VALUES ('675', '9')INSERT INTO Document_Sections (`section_id`, `document_code`, `section_sequence`, `section_code`, `section_title`) VALUES (40, '465', 4964, '93', 'after')INSERT INTO Document_Sections_Images (`section_id`, `image_id`) VALUES (93, 6) | 
| 
	company_office | 
	SELECT count(*) FROM Companies | 
	How many companies are there? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT count(*) FROM Companies | 
	Count the number of companies. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM Companies ORDER BY Market_Value_billion DESC | 
	List the names of companies in descending order of market value. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM Companies ORDER BY Market_Value_billion DESC | 
	Sort the company names in descending order of the company's market value. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM Companies WHERE Headquarters != 'USA' | 
	What are the names of companies whose headquarters are not "USA"? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM Companies WHERE Headquarters != 'USA' | 
	Find the names of the companies whose headquarters are not located in "USA". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name ,  Assets_billion FROM Companies ORDER BY name ASC | 
	List the name and assets of each company in ascending order of company name. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT avg(Profits_billion) FROM Companies | 
	What are the average profits of companies? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT avg(Profits_billion) FROM Companies | 
	Compute the average profits companies make. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking" | 
	What are the maximum and minimum sales of the companies whose industries are not "Banking". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking" | 
	Find the maximum and minimum sales of the companies that are not in the "Banking" industry. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT count(DISTINCT Industry) FROM Companies | 
	How many different industries are the companies in? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT count(DISTINCT Industry) FROM Companies | 
	Count the number of distinct company industries. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM buildings ORDER BY Height DESC | 
	List the names of buildings in descending order of building height. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM buildings ORDER BY Height DESC | 
	What are the names of buildings sorted in descending order of building height? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1 | 
	Find the stories of the building with the largest height. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1 | 
	What is the stories of highest building? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id HAVING COUNT(*)  >  1 | 
	Show the names of the buildings that have more than one company offices. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id HAVING COUNT(*)  >  1 | 
	Which buildings have more than one company offices? Give me the building names. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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 | 
	Show the name of the building that has the most company offices. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1 | 
	Which building has the largest number of company offices? Give me the building name. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM buildings WHERE Status  =  "on-hold" ORDER BY Stories ASC | 
	Please show the names of the buildings whose status is "on-hold", in ascending order of stories. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM buildings WHERE Status  =  "on-hold" ORDER BY Stories ASC | 
	Find the names of the buildings in "on-hold" status, and sort them in ascending order of building stories. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Industry ,  COUNT(*) FROM Companies GROUP BY Industry | 
	Please show each industry and the corresponding number of companies in that industry. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Industry ,  COUNT(*) FROM Companies GROUP BY Industry | 
	Whah are the name of each industry and the number of companies in that industry? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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 | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 | 
	List the industry shared by the most companies. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 | 
	Which industry has the most companies? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations) | 
	List the names of buildings that have no company office. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Industry FROM Companies WHERE Headquarters  =  "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters  =  "China" | 
	Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "China". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Industry FROM Companies WHERE Headquarters  =  "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters  =  "China" | 
	Which industries have both companies with headquarter in "USA" and companies with headquarter in "China"? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT count(*) FROM Companies WHERE Industry  =  "Banking" OR Industry  =  "Conglomerate" | 
	Find the number of companies whose industry is "Banking" or "Conglomerate", | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT count(*) FROM Companies WHERE Industry  =  "Banking" OR Industry  =  "Conglomerate" | 
	How many companies are in either "Banking" industry or "Conglomerate" industry? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*)  >  2 | 
	Show the headquarters shared by more than two companies. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	company_office | 
	SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*)  >  2 | 
	Which headquarter locations are used by more than 2 companies? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "buildings" (
"id" int,
"name" text,
"City" text,
"Height" int,
"Stories" int,
"Status" text,
PRIMARY KEY("id")
);
CREATE TABLE "Companies" (
"id" int,
"name" text,
"Headquarters" text,
"Industry" text,
"Sales_billion" real,
"Profits_billion" real,
"Assets_billion" real,
"Market_Value_billion" text,
PRIMARY KEY ("id")
);
CREATE TABLE "Office_locations" (
"building_id" int,
"company_id" int,
"move_in_year" int,
PRIMARY KEY ("building_id", "company_id"),
FOREIGN KEY ("building_id") REFERENCES "buildings"("id"),
FOREIGN KEY ("company_id") REFERENCES "Companies"("id")
);
INSERT INTO  "buildings" VALUES (1, "Torre KOI","Monterrey","220","67","under construction");
INSERT INTO  "Companies" VALUES ("1","JPMorgan Chase","USA","Banking","115.5","17.4","2117.6","182.2");
INSERT INTO  "Office_locations" VALUES (1,1,2021);
 | 
| 
	solvency_ii | 
	SELECT count(*) FROM Products | 
	How many products are there? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Name FROM Products ORDER BY Product_Price ASC | 
	List the name of products in ascending order of price. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Name ,  Product_Type_Code FROM Products | 
	What are the names and type codes of products? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Price FROM Products WHERE Product_Name  =  "Dining" OR Product_Name  =  "Trading Policy" | 
	Show the prices of the products named "Dining" or "Trading Policy". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT avg(Product_Price) FROM Products | 
	What is the average price for products? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1 | 
	What is the name of the product with the highest price? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1 | 
	Show the most common type code across products. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*)  >=  2 | 
	Show the product type codes that have at least two products. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT Product_Type_Code FROM Products WHERE Product_Price  >  4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price  <  3000 | 
	Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID  =  T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*)  >=  2 | 
	Show the names of products that are in at least two events. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	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 | 
	Show the names of products that are in at least two events in ascending alphabetical order of product name. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	solvency_ii | 
	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. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL ,
address_details VARCHAR(255),
PRIMARY KEY (Address_ID),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
PRIMARY KEY (Product_ID),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL,
Party_Details VARCHAR(255),
PRIMARY KEY (Party_ID)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Asset_ID)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Channel_ID)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL ,
Other_Details VARCHAR(255),
PRIMARY KEY (Finance_ID)
);
West Mafalda, CO 23309');
Port Delbert, OK 66249');
Bogisichland, VT 71460');
East Marionfort, VT 89477-0433');
Luellamouth, MT 67912');
O''Reillychester, CA 92522-9526');
Chelsealand, NE 22947-6129');
Jaydenfurt, NE 85011-5059');
Gaylordtown, VT 05705');
Lake Immanuel, UT 01388');
Haagberg, AK 41204-1496');
East Beauview, LA 19968-4755');
North Scottymouth, IN 85224-1392');
Ricechester, DC 70816-9058');
West Colemanburgh, MO 87777');
CREATE TABLE Events (
Event_ID INTEGER NOT NULL ,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID),
UNIQUE (Event_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
PRIMARY KEY (Product_in_Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL ,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Document_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL,
Event_ID INTEGER NOT NULL,
PRIMARY KEY (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
);
INSERT INTO `Addresses` (`Address_ID`, `address_details`) VALUES (1, '465 Emely Bypass
INSERT INTO `Assets` (`Asset_ID`, `Other_Details`) VALUES (1, 'Transportation Cars')INSERT INTO `Channels` (`Channel_ID`, `Other_Details`) VALUES (1, '145')INSERT INTO `Finances` (`Finance_ID`, `Other_Details`) VALUES (1, 'Mutual')INSERT INTO `Locations` (`Location_ID`, `Other_Details`) VALUES (1, 'Rowe PLC')INSERT INTO `Parties` (`Party_ID`, `Party_Details`) VALUES (3, 'European People''s Party')INSERT INTO `Products` (`Product_ID`, `Product_Type_Code`, `Product_Name`, `Product_Price`) VALUES (1, 'Books', 'Business Policy', '1336.2600')INSERT INTO `Events` (`Event_ID`, `Address_ID`, `Channel_ID`, `Event_Type_Code`, `Finance_ID`, `Location_ID`) VALUES (1, 3, 12, 'Trade Show', 2, 13)INSERT INTO `Products_in_Events` (`Product_in_Event_ID`, `Event_ID`, `Product_ID`) VALUES (13, 4, 29)INSERT INTO `Parties_in_Events` (`Party_ID`, `Event_ID`, `Role_Code`) VALUES (3, 7, 'Organizer')INSERT INTO `Agreements` (`Document_ID`, `Event_ID`) VALUES (13, 5)INSERT INTO `Assets_in_Events` (`Asset_ID`, `Event_ID`) VALUES (1, 4) | 
| 
	entertainment_awards | 
	SELECT count(*) FROM artwork | 
	How many artworks are there? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Name FROM artwork ORDER BY Name ASC | 
	List the name of artworks in ascending alphabetical order. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Name FROM artwork WHERE TYPE != "Program Talent Show" | 
	List the name of artworks whose type is not "Program Talent Show". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Festival_Name ,  LOCATION FROM festival_detail | 
	What are the names and locations of festivals? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC | 
	What are the names of the chairs of festivals, sorted in ascending order of the year held? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT LOCATION FROM festival_detail ORDER BY Num_of_Audience DESC LIMIT 1 | 
	What is the location of the festival with the largest number of audience? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Festival_Name FROM festival_detail WHERE YEAR  =  2007 | 
	What are the names of festivals held in year 2007? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT avg(Num_of_Audience) FROM festival_detail | 
	What is the average number of audience for festivals? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3 | 
	Show the names of the three most recent festivals. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT T2.Name ,  T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID | 
	For each nomination, show the name of the artwork and name of the festival where it is nominated. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT DISTINCT T2.Type FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID WHERE T3.Year  =  2007 | 
	Show distinct types of artworks that are nominated in festivals in 2007. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT T2.Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID ORDER BY T3.Year | 
	Show the names of artworks in ascending order of the year they are nominated in. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID WHERE T2.Type  =  "Program Talent Show" | 
	Show the names of festivals that have nominated artworks of type "Program Talent Show". | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT T1.Festival_ID ,  T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID GROUP BY T1.Festival_ID HAVING COUNT(*)  >=  2 | 
	Show the ids and names of festivals that have at least two nominations for artworks. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT T1.Festival_ID ,  T3.Festival_Name ,  COUNT(*) FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID GROUP BY T1.Festival_ID | 
	Show the id, name of each festival and the number of artworks it has nominated. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT TYPE ,  COUNT(*) FROM artwork GROUP BY TYPE | 
	Please show different types of artworks with the corresponding number of artworks of each type. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT TYPE FROM artwork GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1 | 
	List the most common type of artworks. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*)  >  1 | 
	List the year in which there are more than one festivals. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Name FROM Artwork WHERE Artwork_ID NOT IN (SELECT Artwork_ID FROM nomination) | 
	List the name of artworks that are not nominated. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT Num_of_Audience FROM festival_detail WHERE YEAR  =  2008 OR YEAR  =  2010 | 
	Show the number of audience in year 2008 or 2010. | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT sum(Num_of_Audience) FROM festival_detail | 
	What are the total number of the audiences who visited any of the festivals? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
| 
	entertainment_awards | 
	SELECT YEAR FROM festival_detail WHERE LOCATION  =  'United States' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION != 'United States' | 
	In which year are there festivals both inside the 'United States' and outside the 'United States'? | 
	PRAGMA foreign_keys = ON;
CREATE TABLE "festival_detail" (
"Festival_ID" int,
"Festival_Name" text,
"Chair_Name" text,
"Location" text,
"Year" int,
"Num_of_Audience" int,
PRIMARY KEY ("Festival_ID")
);
CREATE TABLE artwork (
"Artwork_ID" int,
"Type" text,
"Name" text,
PRIMARY KEY ("Artwork_ID")
);
CREATE TABLE nomination (
"Artwork_ID" int,
"Festival_ID" int,
"Result" text,
PRIMARY KEY ("Artwork_ID","Festival_ID"),
FOREIGN KEY ("Artwork_ID") REFERENCES `artwork`("Artwork_ID"),
FOREIGN KEY ("Festival_ID") REFERENCES `festival_detail`("Festival_ID")
);
INSERT INTO  "festival_detail" VALUES (1,"Panasonic Awards","Raymond Floyd","United States","2006","152");
INSERT INTO  artwork VALUES (1,"Program Music/Variety Show","Indonesian Idol");
INSERT INTO  nomination VALUES (1,2,"Nominated");
 | 
			Subsets and Splits
				
	
				
			
				
No community queries yet
The top public SQL queries from the community will appear here once available.