superhero Database Schema

Database Description

Database containing superhero information including powers, attributes, and publishers.

Schema Structure
superhero
Column Name Description
id -
superhero_name -
full_name -
gender_id -
eye_colour_id -
hair_colour_id -
skin_colour_id -
race_id -
publisher_id -
alignment_id -
height_cm -
weight_kg -
gender
Column Name Description
id -
gender -
colour
Column Name Description
id -
colour -
race
Column Name Description
id -
race -
publisher
Column Name Description
id -
publisher_name -
alignment
Column Name Description
id -
alignment -
superpower
Column Name Description
id -
power_name -
attribute
Column Name Description
id -
attribute_name -
hero_power
Column Name Description
hero_id -
power_id -
hero_attribute
Column Name Description
hero_id -
attribute_id -
attribute_value -
Example Queries

SQL Query:
SELECT DISTINCT T3.colour FROM superhero AS T1 INNER JOIN race AS T2 ON T1.race_id = T2.id INNER JOIN colour AS T3 ON T1.hair_colour_id = T3.id WHERE T1.height_cm = 185 AND T2.race = 'Human'
Evidence:

185 cm tall refers to height_cm = 185; human superhero refers to race = 'human'; hair colour refers to colour where hair_colour_id = colour.id;

Difficulty: moderate

SQL Query:
SELECT T2.publisher_name FROM superhero AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.superhero_name = 'Blue Beetle II'
Evidence:

Blue Beetle II refers to superhero_name = 'Blue Beetle II'

Difficulty: simple

SQL Query:
SELECT COUNT(T1.id) FROM superhero AS T1 INNER JOIN alignment AS T2 ON T1.alignment_id = T2.id INNER JOIN gender AS T3 ON T1.gender_id = T3.id WHERE T2.alignment = 'Good' AND T3.gender = 'Female'
Evidence:

good refers to alignment.id = 1; female refers to gender.id = 2;

Difficulty: simple

SQL Query:
SELECT T3.power_name FROM superhero AS T1 INNER JOIN hero_power AS T2 ON T1.id = T2.hero_id INNER JOIN superpower AS T3 ON T2.power_id = T3.id WHERE T1.height_cm * 100 > ( SELECT AVG(height_cm) FROM superhero ) * 80
Evidence:

power of superheroes refers to power_name; height greater than 80% of the average height of all superheroes = height_cm > MULTIPLY(AVG(height_cm), 0.8);

Difficulty: moderate

SQL Query:
SELECT DISTINCT T2.power_name FROM hero_power AS T1 INNER JOIN superpower AS T2 ON T1.power_id = T2.id WHERE T1.hero_id = 1
Evidence:

superpowers refers to power_name; heroes with ID 1 refers to hero_id = 1;

Difficulty: simple
Back to Database Explorer