Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
164 lines (112 sloc) 3.14 KB
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: course; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE course (
id integer NOT NULL,
name character varying(50)
);
ALTER TABLE public.course OWNER TO postgres;
--
-- Name: enrollment; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE enrollment (
student_id integer NOT NULL,
course_id integer NOT NULL,
registration_date date,
enroll_date date
);
ALTER TABLE public.enrollment OWNER TO postgres;
--
-- Name: student; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE student (
name character varying(50),
birthday date,
id integer NOT NULL
);
ALTER TABLE public.student OWNER TO postgres;
--
-- Data for Name: course; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY course (id, name) FROM stdin;
1 math
2 physics
3 literature
5 cosmo
4 history
\.
--
-- Data for Name: enrollment; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY enrollment (student_id, course_id, registration_date, enroll_date) FROM stdin;
1 1 2016-01-24 \N
1 2 2016-01-24 \N
2 1 2016-01-24 \N
2 2 2016-01-24 \N
1 3 2016-01-24 \N
1 4 2016-01-24 \N
1 5 2016-01-24 \N
\.
--
-- Data for Name: student; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY student (name, birthday, id) FROM stdin;
long 1988-11-20 1
lu 1988-11-20 2
xi 1988-11-20 3
\.
--
-- Name: course_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY course
ADD CONSTRAINT course_pkey PRIMARY KEY (id);
--
-- Name: enrollment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY enrollment
ADD CONSTRAINT enrollment_pkey PRIMARY KEY (student_id, course_id);
--
-- Name: student_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY student
ADD CONSTRAINT student_pkey PRIMARY KEY (id);
--
-- Name: enrollment_course_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY enrollment
ADD CONSTRAINT enrollment_course_id_fkey FOREIGN KEY (course_id) REFERENCES course(id);
--
-- Name: enrollment_student_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY enrollment
ADD CONSTRAINT enrollment_student_id_fkey FOREIGN KEY (student_id) REFERENCES student(id);
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--