Build a Celestial Bodies Database Help - Stuck on INT requirement

Hello! I am nearly finished the celestial bodies database but am stuck on the task:

" You should use the INT data type for at least two columns that are not a primary or foreign key"

This was previously passing and the only requirement I had left was:

“Each foreign key column should have the same name as the column it is referencing”

To get the foreign key requirement to pass I edited the foreign key constraint names so that they had unique names as instructed on a few other forum posts. However as soon as the foreign key requirement passed the “INT” requirement stopped passing. I tried changing more columns to the INT data type but have not had any success.

I tried Chrome and Firefox just to see if it would make a difference and it hasn’t.

Any help would be greatly appreciated. If more info is needed I can happily provide screen shots of the tables or anything else.

Thanks in advance!

Your code so far

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

--
-- PostgreSQL database dump
--

-- Dumped from database version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)
-- Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE universe;
--
-- Name: universe; Type: DATABASE; Schema: -; Owner: freecodecamp
--

CREATE DATABASE universe WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';


ALTER DATABASE universe OWNER TO freecodecamp;

\connect universe

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: galaxy; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.galaxy (
    galaxy_id character varying(50) NOT NULL,
    name character varying(50) NOT NULL,
    col3 integer,
    col4 integer,
    col5 character varying(50),
    col6 character varying(50)
);


ALTER TABLE public.galaxy OWNER TO freecodecamp;

--
-- Name: moon; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.moon (
    moon_id character varying(50) NOT NULL,
    name character varying(50) NOT NULL,
    col3_id integer,
    col4_id character varying(50),
    col5_id character varying(50),
    col6_id character varying(50)
);


ALTER TABLE public.moon OWNER TO freecodecamp;

--
-- Name: planet; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.planet (
    planet_id character varying(50) NOT NULL,
    name character varying(50) NOT NULL,
    col3_id integer,
    col4_id character varying(50),
    col5_id character varying(50),
    col6_id character varying(50)
);


ALTER TABLE public.planet OWNER TO freecodecamp;

--
-- Name: star; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.star (
    star_id character varying(50) NOT NULL,
    name character varying(50) NOT NULL,
    col3_id integer,
    col4_id integer,
    col5_id character varying(50),
    col6_id character varying(50)
);


ALTER TABLE public.star OWNER TO freecodecamp;

--
-- Name: tarot; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.tarot (
    tarot_id numeric NOT NULL,
    name character varying(50) NOT NULL,
    col3_id integer,
    col4_id text,
    col5_id boolean,
    col6_id boolean
);


ALTER TABLE public.tarot OWNER TO freecodecamp;

--
-- Data for Name: galaxy; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.galaxy VALUES ('1', 'apple', 8, 12, 'sand', 'water');
INSERT INTO public.galaxy VALUES ('2', 'apple', 8, 12, 'sand', 'water');
INSERT INTO public.galaxy VALUES ('3', 'apple', 8, 12, 'sand', 'sand');
INSERT INTO public.galaxy VALUES ('4', 'apple', 8, 12, 'sand', 'alone');
INSERT INTO public.galaxy VALUES ('5', 'apple', 8, 12, 'sand', 'earth');
INSERT INTO public.galaxy VALUES ('6', 'apple', 8, 12, 'sand', 'horse');


--
-- Data for Name: moon; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.moon VALUES ('1', 'apple', 8, 'black', 'sand', 'sm');
INSERT INTO public.moon VALUES ('2', 'apple', 8, 'black', 'sand', 'sam');
INSERT INTO public.moon VALUES ('3', 'apple', 8, 'black', 'sand', 'plan');
INSERT INTO public.moon VALUES ('4', 'apple', 8, 'black', 'sand', 'okay');
INSERT INTO public.moon VALUES ('5', 'apple', 8, 'black', 'sand', 'sal');
INSERT INTO public.moon VALUES ('6', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('7', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('8', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('9', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('10', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('11', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('12', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('13', 'apple', 8, 'black', 'sand', 'sm');
INSERT INTO public.moon VALUES ('14', 'apple', 8, 'black', 'sand', 'sam');
INSERT INTO public.moon VALUES ('15', 'apple', 8, 'black', 'sand', 'plan');
INSERT INTO public.moon VALUES ('16', 'apple', 8, 'black', 'sand', 'okay');
INSERT INTO public.moon VALUES ('17', 'apple', 8, 'black', 'sand', 'sal');
INSERT INTO public.moon VALUES ('18', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('19', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.moon VALUES ('20', 'apple', 8, 'black', 'sand', 'pain');


--
-- Data for Name: planet; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.planet VALUES ('1', 'apple', 8, 'black', 'sand', 'sm');
INSERT INTO public.planet VALUES ('2', 'apple', 8, 'black', 'sand', 'sam');
INSERT INTO public.planet VALUES ('3', 'apple', 8, 'black', 'sand', 'plan');
INSERT INTO public.planet VALUES ('4', 'apple', 8, 'black', 'sand', 'okay');
INSERT INTO public.planet VALUES ('5', 'apple', 8, 'black', 'sand', 'sal');
INSERT INTO public.planet VALUES ('6', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.planet VALUES ('7', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.planet VALUES ('8', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.planet VALUES ('9', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.planet VALUES ('10', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.planet VALUES ('11', 'apple', 8, 'black', 'sand', 'pain');
INSERT INTO public.planet VALUES ('12', 'apple', 8, 'black', 'sand', 'pain');


--
-- Data for Name: star; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.star VALUES ('1', 'apple', 8, 10, 'sand', 'sm');
INSERT INTO public.star VALUES ('2', 'apple', 8, 10, 'sand', 'sam');
INSERT INTO public.star VALUES ('3', 'apple', 8, 10, 'sand', 'plan');
INSERT INTO public.star VALUES ('4', 'apple', 8, 10, 'sand', 'okay');
INSERT INTO public.star VALUES ('5', 'apple', 8, 10, 'sand', 'sal');
INSERT INTO public.star VALUES ('6', 'apple', 8, 10, 'sand', 'pain');


--
-- Data for Name: tarot; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.tarot VALUES (1, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (3, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (4, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (5, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (6, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (7, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (8, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (9, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (10, '4', 8, 'black', false, true);
INSERT INTO public.tarot VALUES (2, '4', 8, 'black', false, true);


--
-- Name: galaxy galaxy_galaxy_id_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.galaxy
    ADD CONSTRAINT galaxy_galaxy_id_key UNIQUE (galaxy_id);


--
-- Name: galaxy galaxy_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.galaxy
    ADD CONSTRAINT galaxy_pkey PRIMARY KEY (galaxy_id);


--
-- Name: moon moon_moon_id_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.moon
    ADD CONSTRAINT moon_moon_id_key UNIQUE (moon_id);


--
-- Name: moon moon_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.moon
    ADD CONSTRAINT moon_pkey PRIMARY KEY (moon_id);


--
-- Name: planet planet_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.planet
    ADD CONSTRAINT planet_pkey PRIMARY KEY (planet_id);


--
-- Name: planet planet_planet_id_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.planet
    ADD CONSTRAINT planet_planet_id_key UNIQUE (planet_id);


--
-- Name: star star_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.star
    ADD CONSTRAINT star_pkey PRIMARY KEY (star_id);


--
-- Name: star star_star_id_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.star
    ADD CONSTRAINT star_star_id_key UNIQUE (star_id);


--
-- Name: tarot tarot_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.tarot
    ADD CONSTRAINT tarot_pkey PRIMARY KEY (tarot_id);


--
-- Name: tarot tarot_tarot_id_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.tarot
    ADD CONSTRAINT tarot_tarot_id_key UNIQUE (tarot_id);


--
-- Name: galaxy fk_galaxy; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.galaxy
    ADD CONSTRAINT fk_galaxy FOREIGN KEY (galaxy_id) REFERENCES public.galaxy(galaxy_id);


--
-- Name: moon fk_moon; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.moon
    ADD CONSTRAINT fk_moon FOREIGN KEY (moon_id) REFERENCES public.moon(moon_id);


--
-- Name: planet fk_planet; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.planet
    ADD CONSTRAINT fk_planet FOREIGN KEY (planet_id) REFERENCES public.planet(planet_id);


--
-- Name: star fk_star; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.star
    ADD CONSTRAINT fk_star FOREIGN KEY (star_id) REFERENCES public.star(star_id);


--
-- Name: tarot fk_tarot; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.tarot
    ADD CONSTRAINT fk_tarot FOREIGN KEY (tarot_id) REFERENCES public.tarot(tarot_id);


--
-- PostgreSQL database dump complete
--



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Does the error indicate which table it wants this for?

Edit: if you can list the details of the table(a) it would be easier to look at in the forum. The dump has a lot of changes inside so hard to parse.

Thank you for your help! Below I have attached an image of the error string that pops up as well as the details of my 5 tables.




Any help is very appreciated, thanks again

look at the output of your \d moon table
It shows that you do not have a foreign key that references a row of table planet.
(at least that is how I read that).
If you can copy the actual text to the post then I can point that out better. (can’t copy and paste from an image)

here is a general explanation of foreign keys that may help you fix that
SQL FOREIGN KEY Constraint.

1 Like

I believe I have made some steps in the right direction in terms of foreign keys, however I am still getting the same error.

" You should use the INT data type for at least two columns that are not a primary or foreign key"

The last requirement is also not passing.

“Each foreign key column should have the same name as the column it is referencing”

universe=> 
universe=> \d galaxy
                        Table "public.galaxy"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| galaxy_id | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3      | integer               |           |          |         |
| col4      | integer               |           |          |         |
| col5      | character varying(50) |           |          |         |
| col6      | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "galaxy_pkey" PRIMARY KEY, btree (galaxy_id)
    "galaxy_galaxy_id_key" UNIQUE CONSTRAINT, btree (galaxy_id)
Referenced by:
    TABLE "star" CONSTRAINT "fk_star" FOREIGN KEY (star_id) REFERENCES galaxy(galaxy_id)

universe=> \d star
                        Table "public.star"
+---------+-----------------------+-----------+----------+---------+
| Column  |         Type          | Collation | Nullable | Default |
+---------+-----------------------+-----------+----------+---------+
| star_id | character varying(50) |           | not null |         |
| name    | character varying(50) |           | not null |         |
| col3_id | integer               |           |          |         |
| col4_id | integer               |           |          |         |
| col5_id | character varying(50) |           |          |         |
| col6_id | character varying(50) |           |          |         |
+---------+-----------------------+-----------+----------+---------+
Indexes:
    "star_pkey" PRIMARY KEY, btree (star_id)
    "star_star_id_key" UNIQUE CONSTRAINT, btree (star_id)
Foreign-key constraints:
    "fk_star" FOREIGN KEY (star_id) REFERENCES galaxy(galaxy_id)
Referenced by:
    TABLE "planet" CONSTRAINT "fk_planet" FOREIGN KEY (star_id) REFERENCES star(star_id)

universe=> \d planet
                        Table "public.planet"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| planet_id | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3_id   | integer               |           |          |         |
| star_id   | character varying(50) |           |          |         |
| col5_id   | character varying(50) |           |          |         |
| col6_id   | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "planet_pkey" PRIMARY KEY, btree (planet_id)
    "planet_planet_id_key" UNIQUE CONSTRAINT, btree (planet_id)
Foreign-key constraints:
    "fk_planet" FOREIGN KEY (star_id) REFERENCES star(star_id)
Referenced by:
    TABLE "moon" CONSTRAINT "fk_moon" FOREIGN KEY (planet_id) REFERENCES planet(planet_id)

universe=> \d moon
                         Table "public.moon"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| moon_id   | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3_id   | integer               |           |          |         |
| planet_id | character varying(50) |           |          |         |
| col5_id   | character varying(50) |           |          |         |
| col6_id   | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "moon_pkey" PRIMARY KEY, btree (moon_id)
    "moon_moon_id_key" UNIQUE CONSTRAINT, btree (moon_id)
Foreign-key constraints:
    "fk_moon" FOREIGN KEY (planet_id) REFERENCES planet(planet_id)

universe=> 
universe=> \d tarot
                        Table "public.tarot"
+----------+-----------------------+-----------+----------+---------+
|  Column  |         Type          | Collation | Nullable | Default |
+----------+-----------------------+-----------+----------+---------+
| tarot_id | numeric               |           | not null |         |
| name     | character varying(50) |           | not null |         |
| col3_id  | integer               |           |          |         |
| col4_id  | text                  |           |          |         |
| col5_id  | boolean               |           |          |         |
| col6_id  | boolean               |           |          |         |
+----------+-----------------------+-----------+----------+---------+
Indexes:
    "tarot_pkey" PRIMARY KEY, btree (tarot_id)
    "tarot_tarot_id_key" UNIQUE CONSTRAINT, btree (tarot_id)

Thank you again!

okay let’s tackle that last one first

What do you think this one is complaining about?

I realized that my star table was the problem, with the key not matching the column name. I’ve been able to fix that and now that requirement is passing. However the INT requirement still will not pass. I have tried changing a few things and changing more columns to INT with no success on this one so far.

Any guidance would be super appreciated, thanks!

universe=> \d galaxy
                        Table "public.galaxy"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| galaxy_id | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3      | integer               |           |          |         |
| col4      | integer               |           |          |         |
| col5      | integer               |           |          |         |
| col6      | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "galaxy_pkey" PRIMARY KEY, btree (galaxy_id)
    "galaxy_galaxy_id_key" UNIQUE CONSTRAINT, btree (galaxy_id)
Referenced by:
    TABLE "star" CONSTRAINT "fk_star" FOREIGN KEY (galaxy_id) REFERENCES galaxy(galaxy_id)

universe=> \d star
                         Table "public.star"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| star_id   | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3_id   | integer               |           |          |         |
| galaxy_id | character varying(50) |           |          |         |
| col5_id   | character varying(50) |           |          |         |
| col6_id   | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "star_pkey" PRIMARY KEY, btree (star_id)
    "star_star_id_key" UNIQUE CONSTRAINT, btree (star_id)
Foreign-key constraints:
    "fk_star" FOREIGN KEY (galaxy_id) REFERENCES galaxy(galaxy_id)
Referenced by:
    TABLE "planet" CONSTRAINT "fk_planet" FOREIGN KEY (star_id) REFERENCES star(star_id)

universe=> \d planet
                        Table "public.planet"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| planet_id | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3_id   | integer               |           |          |         |
| star_id   | character varying(50) |           |          |         |
| col5_id   | character varying(50) |           |          |         |
| col6_id   | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "planet_pkey" PRIMARY KEY, btree (planet_id)
    "planet_planet_id_key" UNIQUE CONSTRAINT, btree (planet_id)
Foreign-key constraints:
    "fk_planet" FOREIGN KEY (star_id) REFERENCES star(star_id)
Referenced by:
    TABLE "moon" CONSTRAINT "fk_moon" FOREIGN KEY (planet_id) REFERENCES planet(planet_id)

universe=> /d moon
universe-> \d moon
                         Table "public.moon"
+-----------+-----------------------+-----------+----------+---------+
|  Column   |         Type          | Collation | Nullable | Default |
+-----------+-----------------------+-----------+----------+---------+
| moon_id   | character varying(50) |           | not null |         |
| name      | character varying(50) |           | not null |         |
| col3_id   | integer               |           |          |         |
| planet_id | character varying(50) |           |          |         |
| col5_id   | character varying(50) |           |          |         |
| col6_id   | character varying(50) |           |          |         |
+-----------+-----------------------+-----------+----------+---------+
Indexes:
    "moon_pkey" PRIMARY KEY, btree (moon_id)
    "moon_moon_id_key" UNIQUE CONSTRAINT, btree (moon_id)
Foreign-key constraints:
    "fk_moon" FOREIGN KEY (planet_id) REFERENCES planet(planet_id)

universe-> \d tarot
                        Table "public.tarot"
+----------+-----------------------+-----------+----------+---------+
|  Column  |         Type          | Collation | Nullable | Default |
+----------+-----------------------+-----------+----------+---------+
| tarot_id | numeric               |           | not null |         |
| name     | character varying(50) |           | not null |         |
| col3_id  | integer               |           |          |         |
| col4_id  | text                  |           |          |         |
| col5_id  | boolean               |           |          |         |
| col6_id  | boolean               |           |          |         |
+----------+-----------------------+-----------+----------+---------+
Indexes:
    "tarot_pkey" PRIMARY KEY, btree (tarot_id)
    "tarot_tarot_id_key" UNIQUE CONSTRAINT, btree (tarot_id)

universe->  SELECT tc.table_schema, tc.constraint_name, tc.table_name, kcu.column_name, ccu.table_name AS foreign_table_name, ccu.column_name AS foreign_column_name FROM information_schema.table_constraints tc JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.constraint_column_usage ccu ON ccu.constraint_name = tc.constraint_name WHERE constraint_type = 'FOREIGN KEY';
ERROR:  syntax error at or near "/"
LINE 1: /d moon
        ^
universe=>  SELECT tc.table_schema, tc.constraint_name, tc.table_name, kcu.column_name, ccu.table_name AS foreign_table_name, ccu.column_name AS foreign_column_name FROM information_schema.table_constraints tc JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.constraint_column_usage ccu ON ccu.constraint_name = tc.constraint_name WHERE constraint_type = 'FOREIGN KEY';
+--------------+-----------------+------------+-------------+--------------------+---------------------+
| table_schema | constraint_name | table_name | column_name | foreign_table_name | foreign_column_name |
+--------------+-----------------+------------+-------------+--------------------+---------------------+
| public       | fk_moon         | moon       | planet_id   | planet             | planet_id           |
| public       | fk_planet       | planet     | star_id     | star               | star_id             |
| public       | fk_star         | star       | galaxy_id   | galaxy             | galaxy_id           |
+--------------+-----------------+------------+-------------+--------------------+---------------------+
(3 rows)

your galaxy table has 3 ints, so that seems fine
your planet table has only 1 int ?
your moon table has only 1 int?
same for tarot…(only 1)

So 3 tables only have 1 int.
I haven’t done this exercise, but the error message you shared seems to want more than that.

1 Like

Ohh i see. I understood the instruction as having 2 INT total, but i will give that a try thank you

It is entirely possible I am misunderstanding it too. But definitely worth a try.

1 Like

Altering my tables to include 2 INT columns PER TABLE as you suggested was the missing piece I needed. Just submitted the project. Thanks so much for your help, couldn’t have done it without you