
CREATE TABLE "Addresses" (
	"Address_ID" INTEGER NOT NULL, 
	address_details VARCHAR(255), 
	PRIMARY KEY ("Address_ID"), 
	UNIQUE ("Address_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" (
	"Asset_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Asset_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")
)


CREATE TABLE "Channels" (
	"Channel_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Channel_ID")
)


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"), 
	FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), 
	FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), 
	FOREIGN KEY("Finance_ID") REFERENCES "Finances" ("Finance_ID"), 
	UNIQUE ("Event_ID")
)


CREATE TABLE "Finances" (
	"Finance_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Finance_ID")
)


CREATE TABLE "Locations" (
	"Location_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Location_ID")
)


CREATE TABLE "Parties" (
	"Party_ID" INTEGER NOT NULL, 
	"Party_Details" VARCHAR(255), 
	PRIMARY KEY ("Party_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 "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 "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 "Addresses" (
	"Address_ID" INTEGER NOT NULL, 
	address_details VARCHAR(255), 
	PRIMARY KEY ("Address_ID"), 
	UNIQUE ("Address_ID")
)

/*
2 rows from Addresses table:
Address_ID	address_details
1	465 Emely Bypass
West Mafalda, CO 23309
2	669 Carter Trafficway
Port Delbert, OK 66249
*/


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")
)

/*
2 rows from Agreements table:
Document_ID	Event_ID
1	13
2	13
*/


CREATE TABLE "Assets" (
	"Asset_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Asset_ID")
)

/*
2 rows from Assets table:
Asset_ID	Other_Details
1	Transportation Cars
2	Meeting Rooms
*/


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")
)

/*
2 rows from Assets_in_Events table:
Asset_ID	Event_ID
1	4
1	5
*/


CREATE TABLE "Channels" (
	"Channel_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Channel_ID")
)

/*
2 rows from Channels table:
Channel_ID	Other_Details
1	145
2	348
*/


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"), 
	FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), 
	FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), 
	FOREIGN KEY("Finance_ID") REFERENCES "Finances" ("Finance_ID"), 
	UNIQUE ("Event_ID")
)

/*
2 rows from Events table:
Event_ID	Address_ID	Channel_ID	Event_Type_Code	Finance_ID	Location_ID
1	3	12	Trade Show	2	13
2	15	13	Press Conferenc	8	11
*/


CREATE TABLE "Finances" (
	"Finance_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Finance_ID")
)

/*
2 rows from Finances table:
Finance_ID	Other_Details
1	Mutual
2	Good
*/


CREATE TABLE "Locations" (
	"Location_ID" INTEGER NOT NULL, 
	"Other_Details" VARCHAR(255), 
	PRIMARY KEY ("Location_ID")
)

/*
2 rows from Locations table:
Location_ID	Other_Details
1	Rowe PLC
2	Ebert, Green and Bogisich
*/


CREATE TABLE "Parties" (
	"Party_ID" INTEGER NOT NULL, 
	"Party_Details" VARCHAR(255), 
	PRIMARY KEY ("Party_ID")
)

/*
2 rows from Parties table:
Party_ID	Party_Details
3	European People's Party
4	European Free Alliance
*/


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")
)

/*
2 rows from Parties_in_Events table:
Party_ID	Event_ID	Role_Code
3	7	Organizer
3	8	Participant
*/


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")
)

/*
2 rows from Products table:
Product_ID	Product_Type_Code	Product_Name	Product_Price
1	Books	Business Policy	1336.2600
3	Food	Special Dinning	2894.9400
*/


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")
)

/*
2 rows from Products_in_Events table:
Product_in_Event_ID	Event_ID	Product_ID
13	4	29
23	8	3
*/
List the names of products that are not in any event.
SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events)
[{'Product_Name': 'Business Policy'}, {'Product_Name': 'Men suits'}, {'Product_Name': 'Business Policy B'}, {'Product_Name': 'Dinning'}, {'Product_Name': 'Dinning'}]