--
--


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





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

CREATE TABLE acheter (
    nofour integer NOT NULL,
    noart integer NOT NULL,
    prixachat real NOT NULL,
    delai integer NOT NULL,
    CONSTRAINT acheter_delai_check CHECK ((delai >= 0))
);


ALTER TABLE public.acheter OWNER TO postgres;

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

CREATE TABLE articles (
    noart integer NOT NULL,
    libelle character varying(32) NOT NULL,
    stock integer DEFAULT 0 NOT NULL,
    prixinvent real NOT NULL,
    CONSTRAINT articles_stock_check CHECK ((stock >= 0))
);


ALTER TABLE public.articles OWNER TO postgres;

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

CREATE TABLE fournisseurs (
    nofour integer NOT NULL,
    nomfour character varying(16) NOT NULL,
    adrfour character varying(32),
    villefour character varying(16)
);


ALTER TABLE public.fournisseurs OWNER TO postgres;

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

COPY acheter (nofour, noart, prixachat, delai) FROM stdin;
10	104	76.2600021	14
11	105	2199	2
11	108	11.5	5
12	100	185.199997	40
12	106	8.38000011	20
13	103	835	23
14	102	260.5	3
14	108	12	4
15	100	180	23
15	107	45.4700012	2
16	101	150.199997	17
15	106	9	20
11	101	140	30
\.


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

COPY articles (noart, libelle, stock, prixinvent) FROM stdin;
100	HP Deskjet 930C	10	181.410004
101	Scanner Epson Perfection	12	150.919998
102	Zip 250Mo USB	8	272.880005
103	App Photo Numerique	5	836.950012
104	Fax Modem V92	20	75
105	Cam Sony DCR	4	2230.65991
106	Cable USB	80	8.38000011
107	Hub 4 ports USB	35	48.7799988
108	Papier couche 100 A4	110	12
\.


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

COPY fournisseurs (nofour, nomfour, adrfour, villefour) FROM stdin;
10	STE LIGER	13 RUE DES ALLIES	PARIS
11	ORKIS	22 BLD DES BELGES	RENNES
12	STE IMPEC	3 BIS IMPASSE DES CLERCS	MARSEILLE
13	STE LE DUC	101 AVENUE MARECHAL FOCH	BORDEAUX
14	BUROTIC	\N	\N
15	KBSS	42 COURS VITTON	LYON
16	COOP ACHAT	54 RUE DE LA PAIX	NIORT
17	PRINT42	32 AVENUE DES PLATANES	VALENCE
18	STE PROTEC	92 RUE DE LA REPUBLIQUE	TOULOUSE
19	PIMS	50 BLD DES ALOUETTES	GRENOBLE
\.


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

ALTER TABLE ONLY acheter
    ADD CONSTRAINT acheter_pkey PRIMARY KEY (nofour, noart);


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

ALTER TABLE ONLY articles
    ADD CONSTRAINT articles_pkey PRIMARY KEY (noart);


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

ALTER TABLE ONLY fournisseurs
    ADD CONSTRAINT fournisseurs_pkey PRIMARY KEY (nofour);


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

ALTER TABLE ONLY acheter
    ADD CONSTRAINT acheter_noart_fkey FOREIGN KEY (noart) REFERENCES articles(noart);


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

ALTER TABLE ONLY acheter
    ADD CONSTRAINT acheter_nofour_fkey FOREIGN KEY (nofour) REFERENCES fournisseurs(nofour);


--
-- 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 USAGE ON SCHEMA public TO PUBLIC;


--
-- Name: acheter; Type: ACL; Schema: public; Owner: postgres
--

REVOKE ALL ON TABLE acheter FROM PUBLIC;
REVOKE ALL ON TABLE acheter FROM postgres;
GRANT ALL ON TABLE acheter TO postgres;
GRANT SELECT ON TABLE acheter TO PUBLIC;


--
-- Name: articles; Type: ACL; Schema: public; Owner: postgres
--

REVOKE ALL ON TABLE articles FROM PUBLIC;
REVOKE ALL ON TABLE articles FROM postgres;
GRANT ALL ON TABLE articles TO postgres;
GRANT SELECT ON TABLE articles TO PUBLIC;


--
-- Name: fournisseurs; Type: ACL; Schema: public; Owner: postgres
--

REVOKE ALL ON TABLE fournisseurs FROM PUBLIC;
REVOKE ALL ON TABLE fournisseurs FROM postgres;
GRANT ALL ON TABLE fournisseurs TO postgres;
GRANT SELECT ON TABLE fournisseurs TO PUBLIC;


--
--

