
CREATE TABLE device (
	"Device_ID" INTEGER, 
	"Device" TEXT, 
	"Carrier" TEXT, 
	"Package_Version" TEXT, 
	"Applications" TEXT, 
	"Software_Platform" TEXT, 
	PRIMARY KEY ("Device_ID")
)


CREATE TABLE shop (
	"Shop_ID" INTEGER, 
	"Shop_Name" TEXT, 
	"Location" TEXT, 
	"Open_Date" TEXT, 
	"Open_Year" INTEGER, 
	PRIMARY KEY ("Shop_ID")
)


CREATE TABLE stock (
	"Shop_ID" INTEGER, 
	"Device_ID" INTEGER, 
	"Quantity" INTEGER, 
	PRIMARY KEY ("Shop_ID", "Device_ID"), 
	FOREIGN KEY("Device_ID") REFERENCES device ("Device_ID"), 
	FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID")
)

CREATE TABLE device (
	"Device_ID" INTEGER, 
	"Device" TEXT, 
	"Carrier" TEXT, 
	"Package_Version" TEXT, 
	"Applications" TEXT, 
	"Software_Platform" TEXT, 
	PRIMARY KEY ("Device_ID")
)

/*
2 rows from device table:
Device_ID	Device	Carrier	Package_Version	Applications	Software_Platform
1	BlackBerry Storm 9530	MTS Mobility	5.0.0.808	5.0.0.419	Android
2	Apple	Verizon Wireless	5.0.0.328	5.0.0.328	iOS
*/


CREATE TABLE shop (
	"Shop_ID" INTEGER, 
	"Shop_Name" TEXT, 
	"Location" TEXT, 
	"Open_Date" TEXT, 
	"Open_Year" INTEGER, 
	PRIMARY KEY ("Shop_ID")
)

/*
2 rows from shop table:
Shop_ID	Shop_Name	Location	Open_Date	Open_Year
1	Dinas Device	Dinas	1 January	2014
2	Best Buy	Cymmer	15 July	2006
*/


CREATE TABLE stock (
	"Shop_ID" INTEGER, 
	"Device_ID" INTEGER, 
	"Quantity" INTEGER, 
	PRIMARY KEY ("Shop_ID", "Device_ID"), 
	FOREIGN KEY("Device_ID") REFERENCES device ("Device_ID"), 
	FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID")
)

/*
2 rows from stock table:
Shop_ID	Device_ID	Quantity
1	6	100
2	6	110
*/
What are the names of shops that have more than a single kind of device in stock?
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID  =  T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*)  >  1
[{'Shop_Name': 'Dinas Device'}, {'Shop_Name': 'Ferndale'}]