Database schema:

CREATE TABLE "Attributes" (
	attribute_id INTEGER -- example: ['2', '1'],
	attribute_name TEXT -- example: ['Alcohol', 'Waiter Service'],
	PRIMARY KEY (attribute_id)
)


CREATE TABLE "Business" (
	business_id INTEGER -- example: ['2', '1'],
	active TEXT -- example: ['false', 'true'],
	city TEXT -- example: ['Scottsdale', 'Phoenix'],
	state TEXT -- example: ['SC', 'AZ'],
	stars REAL -- example: ['4.5', '3.0'],
	review_count TEXT -- example: ['Low', 'Medium'],
	PRIMARY KEY (business_id)
)


CREATE TABLE "Business_Attributes" (
	attribute_id INTEGER -- example: ['2', '1'],
	business_id INTEGER -- example: ['2', '3'],
	attribute_value TEXT -- example: ['full_bar', 'none'],
	PRIMARY KEY (attribute_id, business_id), 
	CONSTRAINT fk_business_attributes_business FOREIGN KEY(business_id) REFERENCES "Business" (business_id),
	CONSTRAINT fk_business_attributes_attributes FOREIGN KEY(attribute_id) REFERENCES "Attributes" (attribute_id)
)


CREATE TABLE "Business_Categories" (
	business_id INTEGER -- example: ['2', '1'],
	category_id INTEGER -- example: ['8', '143'],
	PRIMARY KEY (business_id, category_id), 
	CONSTRAINT fk_business_categories_categories FOREIGN KEY(category_id) REFERENCES "Categories" (category_id),
	CONSTRAINT fk_business_categories_business FOREIGN KEY(business_id) REFERENCES "Business" (business_id)
)


CREATE TABLE "Business_Hours" (
	business_id INTEGER -- example: ['2', '3'],
	day_id INTEGER -- example: ['2', '3'],
	opening_time TEXT -- example: ['12PM', '11AM'],
	closing_time TEXT -- example: ['9PM', '8PM'],
	PRIMARY KEY (business_id, day_id), 
	CONSTRAINT fk_business_hours_days FOREIGN KEY(day_id) REFERENCES "Days" (day_id),
	CONSTRAINT fk_business_hours_business FOREIGN KEY(business_id) REFERENCES "Business" (business_id)
)


CREATE TABLE "Categories" (
	category_id INTEGER -- example: ['2', '1'],
	category_name TEXT -- example: ['Active Life', 'Arts & Entertainment'],
	PRIMARY KEY (category_id)
)


CREATE TABLE "Checkins" (
	business_id INTEGER -- example: ['2', '1'],
	day_id INTEGER -- example: ['2', '1'],
	label_time_0 TEXT -- example: ['Low', 'None'],
	label_time_1 TEXT -- example: ['Low', 'None'],
	label_time_2 TEXT -- example: ['Low', 'None'],
	label_time_3 TEXT -- example: ['Low', 'None'],
	label_time_4 TEXT -- example: ['Low', 'None'],
	label_time_5 TEXT -- example: ['Low', 'None'],
	label_time_6 TEXT -- example: ['Low', 'None'],
	label_time_7 TEXT -- example: ['Low', 'None'],
	label_time_8 TEXT -- example: ['Low', 'None'],
	label_time_9 TEXT -- example: ['Low', 'None'],
	label_time_10 TEXT -- example: ['Low', 'None'],
	label_time_11 TEXT -- example: ['Low', 'None'],
	label_time_12 TEXT -- example: ['Low', 'None'],
	label_time_13 TEXT -- example: ['Low', 'None'],
	label_time_14 TEXT -- example: ['Low', 'None'],
	label_time_15 TEXT -- example: ['Low', 'None'],
	label_time_16 TEXT -- example: ['Low', 'None'],
	label_time_17 TEXT -- example: ['Low', 'None'],
	label_time_18 TEXT -- example: ['Low', 'None'],
	label_time_19 TEXT -- example: ['Low', 'None'],
	label_time_20 TEXT -- example: ['Low', 'None'],
	label_time_21 TEXT -- example: ['Low', 'None'],
	label_time_22 TEXT -- example: ['Low', 'None'],
	label_time_23 TEXT -- example: ['Low', 'None'],
	PRIMARY KEY (business_id, day_id), 
	CONSTRAINT fk_checkins_days FOREIGN KEY(day_id) REFERENCES "Days" (day_id),
	CONSTRAINT fk_checkins_business FOREIGN KEY(business_id) REFERENCES "Business" (business_id)
)


CREATE TABLE "Compliments" (
	compliment_id INTEGER -- example: ['2', '1'],
	compliment_type TEXT -- example: ['photos', 'cool'],
	PRIMARY KEY (compliment_id)
)


CREATE TABLE "Days" (
	day_id INTEGER -- example: ['2', '1'],
	day_of_week TEXT -- example: ['Monday', 'Sunday'],
	PRIMARY KEY (day_id)
)


CREATE TABLE "Elite" (
	user_id INTEGER -- example: ['19', '3'],
	year_id INTEGER -- example: ['2010', '2011'],
	PRIMARY KEY (user_id, year_id), 
	CONSTRAINT fk_elite_years FOREIGN KEY(year_id) REFERENCES "Years" (year_id),
	CONSTRAINT fk_elite_users FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)


CREATE TABLE "Reviews" (
	business_id INTEGER -- example: ['2', '1'],
	user_id INTEGER -- example: ['36129', '40299'],
	review_stars INTEGER -- example: ['2', '1'],
	review_votes_funny TEXT -- example: ['Low', 'None'],
	review_votes_useful TEXT -- example: ['Low', 'None'],
	review_votes_cool TEXT -- example: ['Low', 'None'],
	review_length TEXT -- example: ['Short', 'Medium'],
	PRIMARY KEY (business_id, user_id), 
	CONSTRAINT fk_reviews_users FOREIGN KEY(user_id) REFERENCES "Users" (user_id),
	CONSTRAINT fk_reviews_business FOREIGN KEY(business_id) REFERENCES "Business" (business_id)
)


CREATE TABLE "Tips" (
	business_id INTEGER -- example: ['2', '3'],
	user_id INTEGER -- example: ['16328', '12490'],
	likes INTEGER -- example: ['0', '1'],
	tip_length TEXT -- example: ['Short', 'Medium'],
	PRIMARY KEY (business_id, user_id), 
	CONSTRAINT fk_tips_users FOREIGN KEY(user_id) REFERENCES "Users" (user_id),
	CONSTRAINT fk_tips_business FOREIGN KEY(business_id) REFERENCES "Business" (business_id)
)


CREATE TABLE "Users" (
	user_id INTEGER -- example: ['2', '1'],
	user_yelping_since_year INTEGER -- example: ['2012', '2010'],
	user_average_stars TEXT -- example: ['4.0', '2.5'],
	user_votes_funny TEXT -- example: ['Low', 'None'],
	user_votes_useful TEXT -- example: ['Low', 'Medium'],
	user_votes_cool TEXT -- example: ['Low', 'Uber'],
	user_review_count TEXT -- example: ['High', 'Medium'],
	user_fans TEXT -- example: ['Low', 'None'],
	PRIMARY KEY (user_id)
)


CREATE TABLE "Users_Compliments" (
	compliment_id INTEGER -- example: ['2', '1'],
	user_id INTEGER -- example: ['19', '3'],
	number_of_compliments TEXT -- example: ['Low', 'Medium'],
	PRIMARY KEY (compliment_id, user_id), 
	CONSTRAINT fk_users_compliments_users FOREIGN KEY(user_id) REFERENCES "Users" (user_id),
	CONSTRAINT fk_users_compliments_compliments FOREIGN KEY(compliment_id) REFERENCES "Compliments" (compliment_id)
)


CREATE TABLE "Years" (
	year_id INTEGER -- example: ['2005', '2006'],
	actual_year INTEGER -- example: ['2005', '2006'],
	PRIMARY KEY (year_id)
)

Question: For all the Yelp businesses that allow customers bring their own beer, what percentage of them are in "Phoenix"?
Evidence: bring their own beer refers to attribute_name = 'BYOB' AND attribute_value = 'TRUE'; Phoenix refers to city = 'Phoenix'; percentage = MULTIPLY(DIVIDE(SUM(city = 'Phoenix'), COUNT(business_id)), 1.0)

SQL:
SELECT CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) AS "percentage" FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'BYOB' AND T2.attribute_value LIKE 'TRUE'