
CREATE TABLE market (
	"Market_ID" INTEGER, 
	"District" TEXT, 
	"Num_of_employees" INTEGER, 
	"Num_of_shops" REAL, 
	"Ranking" INTEGER, 
	PRIMARY KEY ("Market_ID")
)


CREATE TABLE phone (
	"Name" TEXT, 
	"Phone_ID" INTEGER, 
	"Memory_in_G" INTEGER, 
	"Carrier" TEXT, 
	"Price" REAL, 
	PRIMARY KEY ("Phone_ID")
)


CREATE TABLE phone_market (
	"Market_ID" INTEGER, 
	"Phone_ID" TEXT, 
	"Num_of_stock" INTEGER, 
	PRIMARY KEY ("Market_ID", "Phone_ID"), 
	FOREIGN KEY("Phone_ID") REFERENCES phone ("Phone_ID"), 
	FOREIGN KEY("Market_ID") REFERENCES market ("Market_ID")
)

CREATE TABLE market (
	"Market_ID" INTEGER, 
	"District" TEXT, 
	"Num_of_employees" INTEGER, 
	"Num_of_shops" REAL, 
	"Ranking" INTEGER, 
	PRIMARY KEY ("Market_ID")
)

/*
2 rows from market table:
Market_ID	District	Num_of_employees	Num_of_shops	Ranking
1	Alberta	1966	40.0	1
2	British Columbia	1965	49.0	21
*/


CREATE TABLE phone (
	"Name" TEXT, 
	"Phone_ID" INTEGER, 
	"Memory_in_G" INTEGER, 
	"Carrier" TEXT, 
	"Price" REAL, 
	PRIMARY KEY ("Phone_ID")
)

/*
2 rows from phone table:
Name	Phone_ID	Memory_in_G	Carrier	Price
IPhone 5s	1	32	Sprint	320.0
IPhone 6	5	128	Sprint	480.0
*/


CREATE TABLE phone_market (
	"Market_ID" INTEGER, 
	"Phone_ID" TEXT, 
	"Num_of_stock" INTEGER, 
	PRIMARY KEY ("Market_ID", "Phone_ID"), 
	FOREIGN KEY("Phone_ID") REFERENCES phone ("Phone_ID"), 
	FOREIGN KEY("Market_ID") REFERENCES market ("Market_ID")
)

/*
2 rows from phone_market table:
Market_ID	Phone_ID	Num_of_stock
1	1	2232
2	2	4324
*/
What are the memories and carriers of phones?
SELECT Memory_in_G ,  Carrier FROM phone
[{'Memory_in_G': 32, 'Carrier': 'Sprint'}, {'Memory_in_G': 128, 'Carrier': 'Sprint'}, {'Memory_in_G': 128, 'Carrier': 'TMobile'}, {'Memory_in_G': 16, 'Carrier': 'TMobile'}, {'Memory_in_G': 64, 'Carrier': 'TMobile'}]