Add 'universe.sql'
This commit is contained in:
parent
09c5c4f3e2
commit
af348487f3
518
universe.sql
Normal file
518
universe.sql
Normal file
@ -0,0 +1,518 @@
|
||||
--
|
||||
-- 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;
|
||||
|
||||
--
|
||||
-- Name: satelite_purpose; Type: TYPE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE TYPE public.satelite_purpose AS ENUM (
|
||||
'expedition',
|
||||
'communication',
|
||||
'navigation',
|
||||
'research',
|
||||
'weather',
|
||||
'telescope',
|
||||
'misc.'
|
||||
);
|
||||
|
||||
|
||||
ALTER TYPE public.satelite_purpose OWNER TO freecodecamp;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_table_access_method = heap;
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites; Type: TABLE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE TABLE public.artifical_satelites (
|
||||
artifical_satelites_id integer NOT NULL,
|
||||
name character varying(100) NOT NULL,
|
||||
launch_date date NOT NULL,
|
||||
orbital_period_in_minutes integer NOT NULL,
|
||||
has_been_lost boolean,
|
||||
use public.satelite_purpose NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.artifical_satelites OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites_artifical_satelites_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.artifical_satelites_artifical_satelites_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.artifical_satelites_artifical_satelites_id_seq OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites_artifical_satelites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.artifical_satelites_artifical_satelites_id_seq OWNED BY public.artifical_satelites.artifical_satelites_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: galaxy; Type: TABLE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE TABLE public.galaxy (
|
||||
galaxy_id integer NOT NULL,
|
||||
name character varying(100) NOT NULL,
|
||||
age_in_billion_years numeric(12,10),
|
||||
area_in_billion_sq_km numeric(15,10),
|
||||
part_of_observable_universe boolean NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.galaxy OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: galaxy_galaxy_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.galaxy_galaxy_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.galaxy_galaxy_id_seq OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: galaxy_galaxy_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.galaxy_galaxy_id_seq OWNED BY public.galaxy.galaxy_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: moon; Type: TABLE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE TABLE public.moon (
|
||||
moon_id integer NOT NULL,
|
||||
name character varying(100) NOT NULL,
|
||||
age_in_million_years integer,
|
||||
diameter_in_sq_km numeric(15,0),
|
||||
distance_from_earth_in_lightyear numeric(15,10) NOT NULL,
|
||||
description text,
|
||||
planet_id integer,
|
||||
has_life boolean
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.moon OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: moon_moon_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.moon_moon_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.moon_moon_id_seq OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: moon_moon_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.moon_moon_id_seq OWNED BY public.moon.moon_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: planet; Type: TABLE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE TABLE public.planet (
|
||||
planet_id integer NOT NULL,
|
||||
name character varying(100) NOT NULL,
|
||||
age_in_million_years integer,
|
||||
radius_in_sq_km numeric(15,0),
|
||||
distance_from_earth_in_lightyear numeric(15,10) NOT NULL,
|
||||
description text,
|
||||
star_id integer,
|
||||
has_life boolean
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.planet OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: planet_planet_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.planet_planet_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.planet_planet_id_seq OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: planet_planet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.planet_planet_id_seq OWNED BY public.planet.planet_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: star; Type: TABLE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE TABLE public.star (
|
||||
star_id integer NOT NULL,
|
||||
name character varying(100) NOT NULL,
|
||||
age_in_million_years integer,
|
||||
diameter_in_sq_km numeric(15,0),
|
||||
distance_from_earth_in_lightyear numeric(15,10) NOT NULL,
|
||||
description text,
|
||||
galaxy_id integer
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.star OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: star_star_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.star_star_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.star_star_id_seq OWNER TO freecodecamp;
|
||||
|
||||
--
|
||||
-- Name: star_star_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.star_star_id_seq OWNED BY public.star.star_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites artifical_satelites_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.artifical_satelites ALTER COLUMN artifical_satelites_id SET DEFAULT nextval('public.artifical_satelites_artifical_satelites_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: galaxy galaxy_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.galaxy ALTER COLUMN galaxy_id SET DEFAULT nextval('public.galaxy_galaxy_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: moon moon_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.moon ALTER COLUMN moon_id SET DEFAULT nextval('public.moon_moon_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: planet planet_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.planet ALTER COLUMN planet_id SET DEFAULT nextval('public.planet_planet_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: star star_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.star ALTER COLUMN star_id SET DEFAULT nextval('public.star_star_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Data for Name: artifical_satelites; Type: TABLE DATA; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
INSERT INTO public.artifical_satelites VALUES (1, 'Kalpana-1', '2003-01-01', 234, false, 'navigation');
|
||||
INSERT INTO public.artifical_satelites VALUES (2, 'GSAT-3', '2003-01-01', 234, false, 'navigation');
|
||||
INSERT INTO public.artifical_satelites VALUES (3, 'INSAT-3C', '2003-01-01', 234, false, 'navigation');
|
||||
|
||||
|
||||
--
|
||||
-- Data for Name: galaxy; Type: TABLE DATA; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
INSERT INTO public.galaxy VALUES (1, 'Milky Way', 5.1234450000, 146.2343430000, true);
|
||||
INSERT INTO public.galaxy VALUES (2, 'Andromeda', 2.1234500000, 126.2343430000, true);
|
||||
INSERT INTO public.galaxy VALUES (3, 'Black Eye', 11.1234500000, 526.2343430000, true);
|
||||
INSERT INTO public.galaxy VALUES (4, 'Butterfly', 7.1234500000, 56.2343430000, true);
|
||||
INSERT INTO public.galaxy VALUES (5, 'Comet', 3.9445000000, 156.2343430000, true);
|
||||
INSERT INTO public.galaxy VALUES (6, 'Fireworks', 2.2350000000, 236.2343430000, true);
|
||||
INSERT INTO public.galaxy VALUES (7, 'Sunflower', 7.2350000000, 86.2343430000, true);
|
||||
|
||||
|
||||
--
|
||||
-- Data for Name: moon; Type: TABLE DATA; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
INSERT INTO public.moon VALUES (1, 'Moon', 2342342, 12314, 0.0000000000, NULL, 1, false);
|
||||
INSERT INTO public.moon VALUES (2, 'Phobos', 2342342, 12314, 0.0000000000, NULL, 4, false);
|
||||
INSERT INTO public.moon VALUES (3, 'Deimos', 2342342, 12314, 0.0000000000, NULL, 4, false);
|
||||
INSERT INTO public.moon VALUES (4, 'lo', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (5, 'Europa', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (6, 'Ganymede', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (7, 'Callisto', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (8, 'Amalthea', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (9, 'Himalia', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (10, 'Elara', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (11, 'Pasiphae', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (12, 'Sinope', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (13, 'Lysithea', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (14, 'Carme', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (15, 'Ananke', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (16, 'Leda', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (17, 'Thebe', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (18, 'Adrastea', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (19, 'Metis', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (20, 'Callirrhoe', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (21, 'Themistro', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (22, 'Megaclite', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
INSERT INTO public.moon VALUES (23, 'Taygete', 2342342, 12314, 0.0000000000, NULL, 5, false);
|
||||
|
||||
|
||||
--
|
||||
-- Data for Name: planet; Type: TABLE DATA; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
INSERT INTO public.planet VALUES (1, 'Earth', 5000, 38000, 0.0000000000, 'I live here', 1, true);
|
||||
INSERT INTO public.planet VALUES (2, 'Mercury', 5000, 38000, 0.0000000000, 'Sun s favorite', 1, false);
|
||||
INSERT INTO public.planet VALUES (3, 'Venus', 5000, 38000, 0.0000000000, 'Earth s favorite', 1, false);
|
||||
INSERT INTO public.planet VALUES (4, 'Mars', 5000, 38000, 0.0000000000, 'Musk s favorite', 1, false);
|
||||
INSERT INTO public.planet VALUES (5, 'Jupiter', 5000, 38000, 0.0000000000, 'Biggest planet in solar system', 1, false);
|
||||
INSERT INTO public.planet VALUES (6, 'Saturn', 5000, 38000, 0.0000000000, 'has many satelites', 1, false);
|
||||
INSERT INTO public.planet VALUES (7, 'Uranus', 5000, 38000, 0.0000000000, 'funny name', 1, false);
|
||||
INSERT INTO public.planet VALUES (8, 'Neptune', 5000, 38000, 0.0000000000, 'Last non-controversial major planet in solar system', 1, false);
|
||||
INSERT INTO public.planet VALUES (9, 'Pluto', 5000, 38000, 0.0000000000, 'Mickey s friend', 1, false);
|
||||
INSERT INTO public.planet VALUES (10, 'Orcus', 5000, 38000, 0.0000000000, NULL, 1, false);
|
||||
INSERT INTO public.planet VALUES (11, 'Quaoar', 5000, 38000, 0.0000000000, NULL, 1, false);
|
||||
INSERT INTO public.planet VALUES (12, 'Gonggong', 5000, 38000, 0.0000000000, NULL, 1, false);
|
||||
INSERT INTO public.planet VALUES (13, 'Sedna', 5000, 38000, 0.0000000000, NULL, 1, false);
|
||||
|
||||
|
||||
--
|
||||
-- Data for Name: star; Type: TABLE DATA; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
INSERT INTO public.star VALUES (1, 'Sun', 5000, 123121311, 0.0000156538, 'causes northern lights', 1);
|
||||
INSERT INTO public.star VALUES (2, 'Betelgeuse', 7000, 1563121311, 1.0000156538, NULL, 1);
|
||||
INSERT INTO public.star VALUES (3, 'Antares', 7000, 1563121311, 1.0000156538, NULL, 1);
|
||||
INSERT INTO public.star VALUES (4, 'Deneb', 7000, 1563121311, 1.0000156538, NULL, 1);
|
||||
INSERT INTO public.star VALUES (5, 'Gj 3379', 7000, 1563121311, 16.9861000000, NULL, 1);
|
||||
INSERT INTO public.star VALUES (6, 'Sigma Draconis (Alsafi)', 7000, 1563121311, 18.7933000000, NULL, 1);
|
||||
INSERT INTO public.star VALUES (7, 'Rose 47', 7000, 1563121311, 18.8883000000, NULL, 1);
|
||||
INSERT INTO public.star VALUES (8, 'Delta Pavonis$', 7000, 1563121311, 19.8930000000, NULL, 1);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites_artifical_satelites_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
SELECT pg_catalog.setval('public.artifical_satelites_artifical_satelites_id_seq', 3, true);
|
||||
|
||||
|
||||
--
|
||||
-- Name: galaxy_galaxy_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
SELECT pg_catalog.setval('public.galaxy_galaxy_id_seq', 7, true);
|
||||
|
||||
|
||||
--
|
||||
-- Name: moon_moon_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
SELECT pg_catalog.setval('public.moon_moon_id_seq', 23, true);
|
||||
|
||||
|
||||
--
|
||||
-- Name: planet_planet_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
SELECT pg_catalog.setval('public.planet_planet_id_seq', 13, true);
|
||||
|
||||
|
||||
--
|
||||
-- Name: star_star_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
SELECT pg_catalog.setval('public.star_star_id_seq', 8, true);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites artifical_satelites_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.artifical_satelites
|
||||
ADD CONSTRAINT artifical_satelites_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: artifical_satelites artifical_satelites_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.artifical_satelites
|
||||
ADD CONSTRAINT artifical_satelites_pkey PRIMARY KEY (artifical_satelites_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: galaxy galaxy_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.galaxy
|
||||
ADD CONSTRAINT galaxy_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- 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_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.moon
|
||||
ADD CONSTRAINT moon_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- 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_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.planet
|
||||
ADD CONSTRAINT planet_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: planet planet_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.planet
|
||||
ADD CONSTRAINT planet_pkey PRIMARY KEY (planet_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: star star_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.star
|
||||
ADD CONSTRAINT star_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: star star_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.star
|
||||
ADD CONSTRAINT star_pkey PRIMARY KEY (star_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: moon moon_planet_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.moon
|
||||
ADD CONSTRAINT moon_planet_id_fkey FOREIGN KEY (planet_id) REFERENCES public.planet(planet_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: planet planet_star_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.planet
|
||||
ADD CONSTRAINT planet_star_id_fkey FOREIGN KEY (star_id) REFERENCES public.star(star_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: star star_galaxy_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.star
|
||||
ADD CONSTRAINT star_galaxy_id_fkey FOREIGN KEY (galaxy_id) REFERENCES public.galaxy(galaxy_id);
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user