I have a problem in the project in Relational Dabase : Celestial Bodies Databases.
these are my problem which is not solved and table of “star”, why is the problem not solved…so sad please help me
I don’t know why the 3 problems are not passed, I think that each of them have a foreign key that references…
universe=> \d galaxy
Table "public.galaxy"
+--------------------------+-----------------------+-----------+----------+-------------------------------------------+
| Column | Type | Collation | Nullable | Default |
+--------------------------+-----------------------+-----------+----------+-------------------------------------------+
| galaxy_id | integer | | not null | nextval('galaxy_galaxy_id_seq'::regclass) |
| name | character varying(30) | | not null | |
| size | integer | | not null | |
| distance_from_earth | integer | | | |
| age_in_millions_of_years | numeric | | | |
| color | text | | | |
| has_life | boolean | | | |
| is_spherical | boolean | | | |
+--------------------------+-----------------------+-----------+----------+-------------------------------------------+
Indexes:
"galaxy_pkey" PRIMARY KEY, btree (galaxy_id)
"galaxy_distance_from_earth_key" UNIQUE CONSTRAINT, btree (distance_from_earth)
Referenced by:
TABLE "star" CONSTRAINT "star_galaxy_id_fkey" FOREIGN KEY (galaxy_id) REFERENCES galaxy(galaxy_id)
universe=> \d star
Table "public.star"
+--------------------------+-----------------------+-----------+----------+---------------------------------------+
| Column | Type | Collation | Nullable | Default |
+--------------------------+-----------------------+-----------+----------+---------------------------------------+
| star_id | integer | | not null | nextval('star_star_id_seq'::regclass) |
| name | character varying(30) | | not null | |
| size | integer | | not null | |
| distance_from_earth | integer | | | |
| age_in_millions_of_years | numeric | | | |
| color | text | | | |
| has_life | boolean | | | |
| is_spherical | boolean | | | |
| galaxy_id | integer | | | |
+--------------------------+-----------------------+-----------+----------+---------------------------------------+
Indexes:
"star_pkey" PRIMARY KEY, btree (star_id)
"star_distance_from_earth_key" UNIQUE CONSTRAINT, btree (distance_from_earth)
Foreign-key constraints:
"star_galaxy_id_fkey" FOREIGN KEY (galaxy_id) REFERENCES galaxy(galaxy_id)
Referenced by:
TABLE "planet" CONSTRAINT "planet_star_id_fkey" FOREIGN KEY (star_id) REFERENCES star(star_id)
universe=> \d planet
Table "public.planet"
+--------------------------+-----------------------+-----------+----------+-------------------------------------------+
| Column | Type | Collation | Nullable | Default |
+--------------------------+-----------------------+-----------+----------+-------------------------------------------+
| planet_id | integer | | not null | nextval('planet_planet_id_seq'::regclass) |
| name | character varying(30) | | not null | |
| size | integer | | not null | |
| distance_from_earth | integer | | | |
| age_in_millions_of_years | numeric | | | |
| color | text | | | |
| has_life | boolean | | | |
| is_spherical | boolean | | | |
| star_id | integer | | | |
+--------------------------+-----------------------+-----------+----------+-------------------------------------------+
Indexes:
"planet_pkey" PRIMARY KEY, btree (planet_id)
"planet_distance_from_earth_key" UNIQUE CONSTRAINT, btree (distance_from_earth)
Foreign-key constraints:
"planet_star_id_fkey" FOREIGN KEY (star_id) REFERENCES star(star_id)
Referenced by:
TABLE "moon" CONSTRAINT "moon_planet_id_fkey" FOREIGN KEY (planet_id) REFERENCES planet(planet_id)
universe=> \d moon
Table "public.moon"
+--------------------------+-----------------------+-----------+----------+---------------------------------------+
| Column | Type | Collation | Nullable | Default |
+--------------------------+-----------------------+-----------+----------+---------------------------------------+
| moon_id | integer | | not null | nextval('moon_moon_id_seq'::regclass) |
| name | character varying(30) | | not null | |
| size | integer | | not null | |
| distance_from_earth | integer | | | |
| age_in_millions_of_years | numeric | | | |
| color | text | | | |
| has_life | boolean | | | |
| is_spherical | boolean | | | |
| planet_id | integer | | | |
+--------------------------+-----------------------+-----------+----------+---------------------------------------+
Indexes:
"moon_pkey" PRIMARY KEY, btree (moon_id)
"moon_distance_from_earth_key" UNIQUE CONSTRAINT, btree (distance_from_earth)
Foreign-key constraints:
"moon_planet_id_fkey" FOREIGN KEY (planet_id) REFERENCES planet(planet_id)
Can you display the rows of the star table?