
CREATE TABLE business (
	bid INTEGER, 
	business_id TEXT, 
	name TEXT, 
	full_address TEXT, 
	city TEXT, 
	latitude TEXT, 
	longitude TEXT, 
	review_count INTEGER, 
	is_open INTEGER, 
	rating REAL, 
	state TEXT, 
	PRIMARY KEY (bid)
)


CREATE TABLE category (
	id INTEGER, 
	business_id TEXT, 
	category_name TEXT, 
	PRIMARY KEY (id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)


CREATE TABLE checkin (
	cid INTEGER, 
	business_id TEXT, 
	count INTEGER, 
	day TEXT, 
	PRIMARY KEY (cid), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)


CREATE TABLE neighbourhood (
	id INTEGER, 
	business_id TEXT, 
	neighbourhood_name TEXT, 
	PRIMARY KEY (id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)


CREATE TABLE review (
	rid INTEGER, 
	business_id TEXT, 
	user_id TEXT, 
	rating REAL, 
	text TEXT, 
	year INTEGER, 
	month TEXT, 
	PRIMARY KEY (rid), 
	FOREIGN KEY(user_id) REFERENCES user (user_id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)


CREATE TABLE tip (
	tip_id INTEGER, 
	business_id TEXT, 
	text TEXT, 
	user_id TEXT, 
	likes INTEGER, 
	year INTEGER, 
	month TEXT, 
	PRIMARY KEY (tip_id), 
	FOREIGN KEY(user_id) REFERENCES user (user_id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)


CREATE TABLE user (
	uid INTEGER, 
	user_id TEXT, 
	name TEXT, 
	PRIMARY KEY (uid)
)

CREATE TABLE business (
	bid INTEGER, 
	business_id TEXT, 
	name TEXT, 
	full_address TEXT, 
	city TEXT, 
	latitude TEXT, 
	longitude TEXT, 
	review_count INTEGER, 
	is_open INTEGER, 
	rating REAL, 
	state TEXT, 
	PRIMARY KEY (bid)
)

/*
2 rows from business table:
bid	business_id	name	full_address	city	latitude	longitude	review_count	is_open	rating	state

*/


CREATE TABLE category (
	id INTEGER, 
	business_id TEXT, 
	category_name TEXT, 
	PRIMARY KEY (id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)

/*
2 rows from category table:
id	business_id	category_name

*/


CREATE TABLE checkin (
	cid INTEGER, 
	business_id TEXT, 
	count INTEGER, 
	day TEXT, 
	PRIMARY KEY (cid), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)

/*
2 rows from checkin table:
cid	business_id	count	day

*/


CREATE TABLE neighbourhood (
	id INTEGER, 
	business_id TEXT, 
	neighbourhood_name TEXT, 
	PRIMARY KEY (id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)

/*
2 rows from neighbourhood table:
id	business_id	neighbourhood_name

*/


CREATE TABLE review (
	rid INTEGER, 
	business_id TEXT, 
	user_id TEXT, 
	rating REAL, 
	text TEXT, 
	year INTEGER, 
	month TEXT, 
	PRIMARY KEY (rid), 
	FOREIGN KEY(user_id) REFERENCES user (user_id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)

/*
2 rows from review table:
rid	business_id	user_id	rating	text	year	month

*/


CREATE TABLE tip (
	tip_id INTEGER, 
	business_id TEXT, 
	text TEXT, 
	user_id TEXT, 
	likes INTEGER, 
	year INTEGER, 
	month TEXT, 
	PRIMARY KEY (tip_id), 
	FOREIGN KEY(user_id) REFERENCES user (user_id), 
	FOREIGN KEY(business_id) REFERENCES business (business_id)
)

/*
2 rows from tip table:
tip_id	business_id	text	user_id	likes	year	month

*/


CREATE TABLE user (
	uid INTEGER, 
	user_id TEXT, 
	name TEXT, 
	PRIMARY KEY (uid)
)

/*
2 rows from user table:
uid	user_id	name

*/
find all cities which has a " Taj Mahal " restaurant
SELECT t1.city FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "Taj Mahal" AND t2.category_name  =  "restaurant";
[{'Nenhum': 'Nenhum resultado encontrado'}]