There are 2 tables, a table named species
and another table named planet
.
I want to display the name, average_height, hair_color, skin_color, homeworld
and population
. All of the above is in the species
table except for population
which is in planet
table.
What is the query do I have to do to display all of these columns
I am using SQL Developer
Species Table
ID
homeworld
name
average_height
skin_color
hair_color
eye_color
language
average_lifespan
classification
Planet Table
ID
diameter
climate
surface_water
name
rotation_period
terrain
gravity
orbital_period
population
The basic query would be
SELECT s.NAME,
s.AVERAGE_HEIGHT,
s.HAIR_COLOR,
s.SKIN_COLOR,
s.HOMEWORLD,
p.POPULATION
FROM PLANET p
INNER JOIN SPECIES s
ON s.HOMEWORLD = p.ID
if SPECIES.HOMEWORLD
is in fact a foreign key to PLANET.ID
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.