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 was the name of the Olympic game that John Aalberg took part in when he was 31?
Evidence: when he was 31 refers to age = 31; name of the Olympic games refers to games_name;

SQL:
SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T2.age = 31