--
-- PostgreSQL database dump
--

SET client_encoding = 'UTF8';
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: ACME; Type: DATABASE; Schema: -; Owner: postgres
--

CREATE DATABASE "ACME" WITH TEMPLATE = template0 ENCODING = 'UTF8';


\connect "ACME"

SET client_encoding = 'UTF8';
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'Standard public schema';


SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: customer; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE customer (
    id_customer serial NOT NULL,
    firstname character varying(50) NOT NULL,
    lastname character varying(50) NOT NULL,
    company character varying(100),
    street character varying(100) NOT NULL,
    town character varying(100) NOT NULL,
    postcode character varying(10) NOT NULL,
    country character varying(50) NOT NULL
);


--
-- Name: customer_event; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE customer_event (
    id_customer integer NOT NULL,
    id_event integer NOT NULL
);


--
-- Name: customer_id_customer_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('customer', 'id_customer'), 6, true);


--
-- Name: event; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE event (
    id_event serial NOT NULL,
    id_seminar integer NOT NULL,
    event_date date NOT NULL
);


--
-- Name: event_id_event_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('event', 'id_event'), 4, true);


--
-- Name: seminar; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE seminar (
    title character varying(100) NOT NULL,
    id_seminar serial NOT NULL,
    long text NOT NULL
);


--
-- Name: seminar_id_seminar_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('seminar', 'id_seminar'), 4, true);


--
-- Data for Name: customer; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO customer (id_customer, firstname, lastname, company, street, town, postcode, country) VALUES (2, 'Charlie', 'Clark', 'eGenix', 'Helmholtzstr. 20 ', 'Düsseldorf', '40215', 'D');
INSERT INTO customer (id_customer, firstname, lastname, company, street, town, postcode, country) VALUES (3, 'John', 'Cleese', 'Monty Python', '20 Escher Street', 'Hemel Hempstead', 'NW4 5KE', 'UK');
INSERT INTO customer (id_customer, firstname, lastname, company, street, town, postcode, country) VALUES (1, 'Frank', 'Gallagher', 'Shameless', '15 Merton Drive', 'Manchester', 'M14 5KL', 'UK');
INSERT INTO customer (id_customer, firstname, lastname, company, street, town, postcode, country) VALUES (4, 'Arnold', 'Aardvark', 'Aardvark Consulting', '103 Prinsengracht', 'Amsterdam', '1993 HC', 'NL');
INSERT INTO customer (id_customer, firstname, lastname, company, street, town, postcode, country) VALUES (5, 'Bugs', 'Bunny', 'Carrots, Inc.', '1352 Mockinbrid Lane', 'Wiseville', '53567', 'USA');
INSERT INTO customer (id_customer, firstname, lastname, company, street, town, postcode, country) VALUES (6, 'Elmar', 'Fudd', 'Fudd', '3556 Loserdriver', 'Huntingdon', '43666', 'USA');


--
-- Data for Name: customer_event; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO customer_event (id_customer, id_event) VALUES (1, 1);
INSERT INTO customer_event (id_customer, id_event) VALUES (2, 1);
INSERT INTO customer_event (id_customer, id_event) VALUES (3, 2);
INSERT INTO customer_event (id_customer, id_event) VALUES (5, 4);
INSERT INTO customer_event (id_customer, id_event) VALUES (6, 3);


--
-- Data for Name: event; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO event (id_event, id_seminar, event_date) VALUES (1, 1, '2007-07-31');
INSERT INTO event (id_event, id_seminar, event_date) VALUES (2, 2, '2007-08-07');
INSERT INTO event (id_event, id_seminar, event_date) VALUES (3, 3, '2007-08-14');
INSERT INTO event (id_event, id_seminar, event_date) VALUES (4, 4, '2007-08-21');


--
-- Data for Name: seminar; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO seminar (title, id_seminar, long) VALUES ('Beginner', 1, 'Introductory course to the RoadRunner range');
INSERT INTO seminar (title, id_seminar, long) VALUES ('Intermediate', 2, 'For those who have master the basics');
INSERT INTO seminar (title, id_seminar, long) VALUES ('Advanced', 3, 'Learn how to set traps');
INSERT INTO seminar (title, id_seminar, long) VALUES ('Evil Genius', 4, 'RoadRunners are clever, learn hoe to be clvereer');


--
-- Name: customer_event_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY customer_event
    ADD CONSTRAINT customer_event_pkey PRIMARY KEY (id_customer, id_event);


--
-- Name: customer_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY customer
    ADD CONSTRAINT customer_pkey PRIMARY KEY (id_customer);


--
-- Name: event_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY event
    ADD CONSTRAINT event_pkey PRIMARY KEY (id_event);


--
-- Name: seminar_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY seminar
    ADD CONSTRAINT seminar_pkey PRIMARY KEY (id_seminar);


--
-- Name: customer_event_id_customer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY customer_event
    ADD CONSTRAINT customer_event_id_customer_fkey FOREIGN KEY (id_customer) REFERENCES customer(id_customer);


--
-- Name: customer_event_id_event_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY customer_event
    ADD CONSTRAINT customer_event_id_event_fkey FOREIGN KEY (id_event) REFERENCES event(id_event);


--
-- Name: event_id_seminar_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY event
    ADD CONSTRAINT event_id_seminar_fkey FOREIGN KEY (id_seminar) REFERENCES seminar(id_seminar);


--
-- 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
--

