
CREATE TABLE "Manufacturers" (
	"Code" INTEGER, 
	"Name" VARCHAR(255) NOT NULL, 
	"Headquarter" VARCHAR(255) NOT NULL, 
	"Founder" VARCHAR(255) NOT NULL, 
	"Revenue" REAL, 
	PRIMARY KEY ("Code")
)


CREATE TABLE "Products" (
	"Code" INTEGER, 
	"Name" VARCHAR(255) NOT NULL, 
	"Price" DECIMAL NOT NULL, 
	"Manufacturer" INTEGER NOT NULL, 
	PRIMARY KEY ("Code"), 
	FOREIGN KEY("Manufacturer") REFERENCES "Manufacturers" ("Code")
)

CREATE TABLE "Manufacturers" (
	"Code" INTEGER, 
	"Name" VARCHAR(255) NOT NULL, 
	"Headquarter" VARCHAR(255) NOT NULL, 
	"Founder" VARCHAR(255) NOT NULL, 
	"Revenue" REAL, 
	PRIMARY KEY ("Code")
)

/*
2 rows from Manufacturers table:
Code	Name	Headquarter	Founder	Revenue
1	Sony	Tokyo	Andy	120.0
2	Creative Labs	Austin	Owen	100.0
*/


CREATE TABLE "Products" (
	"Code" INTEGER, 
	"Name" VARCHAR(255) NOT NULL, 
	"Price" DECIMAL NOT NULL, 
	"Manufacturer" INTEGER NOT NULL, 
	PRIMARY KEY ("Code"), 
	FOREIGN KEY("Manufacturer") REFERENCES "Manufacturers" ("Code")
)

/*
2 rows from Products table:
Code	Name	Price	Manufacturer
1	Hard drive	240.0000000000	5
2	Memory	120.0000000000	6
*/
What are the names of products produced by both Creative Labs and Sony?
SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer  =  T2.code WHERE T2.name  =  'Creative Labs' INTERSECT SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer  =  T2.code WHERE T2.name  =  'Sony'
[{'Nenhum': 'Nenhum resultado encontrado'}]