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



