Database schema:

CREATE TABLE city (
	id INTEGER NOT NULL -- example: ['2', '1'],
	city_name TEXT DEFAULT NULL -- example: ['Barcelona', 'London'],
	PRIMARY KEY (id)
)


CREATE TABLE competitor_event (
	event_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	competitor_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	medal_id INTEGER DEFAULT NULL -- example: ['1', '4'],
	CONSTRAINT fk_competitor_event_games_competitor FOREIGN KEY(competitor_id) REFERENCES games_competitor (id),
	CONSTRAINT fk_competitor_event_event FOREIGN KEY(event_id) REFERENCES event (id),
	CONSTRAINT fk_competitor_event_medal FOREIGN KEY(medal_id) REFERENCES medal (id)
)


CREATE TABLE event (
	id INTEGER NOT NULL -- example: ['2', '1'],
	sport_id INTEGER DEFAULT NULL -- example: ['9', '33'],
	event_name TEXT DEFAULT NULL -- example: ["Judo Men's Extra-Lightweight", "Basketball Men's Basketball"],
	PRIMARY KEY (id), 
	CONSTRAINT fk_event_sport FOREIGN KEY(sport_id) REFERENCES sport (id)
)


CREATE TABLE games (
	id INTEGER NOT NULL -- example: ['2', '1'],
	games_year INTEGER DEFAULT NULL -- example: ['2012', '1992'],
	games_name TEXT DEFAULT NULL -- example: ['1992 Summer', '2012 Summer'],
	season TEXT DEFAULT NULL -- example: ['Winter', 'Summer'],
	PRIMARY KEY (id)
)


CREATE TABLE games_city (
	games_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	city_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	CONSTRAINT fk_games_city_city FOREIGN KEY(city_id) REFERENCES city (id),
	CONSTRAINT fk_games_city_games FOREIGN KEY(games_id) REFERENCES games (id)
)


CREATE TABLE games_competitor (
	id INTEGER NOT NULL -- example: ['2', '1'],
	games_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	person_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	age INTEGER DEFAULT NULL -- example: ['23', '24'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_games_competitor_games FOREIGN KEY(games_id) REFERENCES games (id),
	CONSTRAINT fk_games_competitor_person FOREIGN KEY(person_id) REFERENCES person (id)
)


CREATE TABLE medal (
	id INTEGER NOT NULL -- example: ['2', '1'],
	medal_name TEXT DEFAULT NULL -- example: ['Gold', 'Silver'],
	PRIMARY KEY (id)
)


CREATE TABLE noc_region (
	id INTEGER NOT NULL -- example: ['2', '1'],
	noc TEXT DEFAULT NULL -- example: ['AFG', 'AHO'],
	region_name TEXT DEFAULT NULL -- example: ['Afghanistan', 'Netherlands Antilles'],
	PRIMARY KEY (id)
)


CREATE TABLE person (
	id INTEGER NOT NULL -- example: ['2', '1'],
	full_name TEXT DEFAULT NULL -- example: ['A Dijiang', 'A Lamusi'],
	gender TEXT DEFAULT NULL -- example: ['M', 'F'],
	height INTEGER DEFAULT NULL -- example: ['180', '170'],
	weight INTEGER DEFAULT NULL -- example: ['60', '80'],
	PRIMARY KEY (id)
)


CREATE TABLE person_region (
	person_id INTEGER DEFAULT NULL -- example: ['2', '1'],
	region_id INTEGER DEFAULT NULL -- example: ['42', '56'],
	CONSTRAINT fk_person_region_person FOREIGN KEY(person_id) REFERENCES person (id),
	CONSTRAINT fk_person_region_noc_region FOREIGN KEY(region_id) REFERENCES noc_region (id)
)


CREATE TABLE sport (
	id INTEGER NOT NULL -- example: ['2', '1'],
	sport_name TEXT DEFAULT NULL -- example: ['Aeronautics', 'Alpine Skiing'],
	PRIMARY KEY (id)
)

Question: What is the average height of male athletes playing basketball sport?
Evidence: AVG(height) where sport_name = 'Basketball' and event_name = 'Basketball Men''s';

SQL:
SELECT AVG(T5.height) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id INNER JOIN competitor_event AS T3 ON T2.id = T3.event_id INNER JOIN games_competitor AS T4 ON T3.competitor_id = T4.id INNER JOIN person AS T5 ON T4.person_id = T5.id WHERE T1.sport_name = 'Basketball' AND T5.gender = 'M'