Skip to content

Instantly share code, notes, and snippets.

@celsowm
Created May 24, 2019 02:28
Show Gist options
  • Save celsowm/067fe51dfa612697895c8ec3b5cb436d to your computer and use it in GitHub Desktop.
Save celsowm/067fe51dfa612697895c8ec3b5cb436d to your computer and use it in GitHub Desktop.
livraria_postgresv0.2.sql
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.3
-- Dumped by pg_dump version 11.2
-- Started on 2019-05-23 23:23:19
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 client_min_messages = warning;
SET row_security = off;
DROP DATABASE livraria;
--
-- TOC entry 2943 (class 1262 OID 16485)
-- Name: livraria; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE livraria WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'Portuguese_Brazil.1252' LC_CTYPE = 'Portuguese_Brazil.1252';
ALTER DATABASE livraria OWNER TO postgres;
\connect livraria
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 client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 196 (class 1259 OID 16486)
-- Name: autor_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.autor_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.autor_seq OWNER TO postgres;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 197 (class 1259 OID 16488)
-- Name: autor; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.autor (
id integer DEFAULT nextval('public.autor_seq'::regclass) NOT NULL,
nome character varying(255) NOT NULL
);
ALTER TABLE public.autor OWNER TO postgres;
--
-- TOC entry 198 (class 1259 OID 16495)
-- Name: autor_livro_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.autor_livro_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.autor_livro_seq OWNER TO postgres;
--
-- TOC entry 199 (class 1259 OID 16497)
-- Name: autor_livro; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.autor_livro (
id integer DEFAULT nextval('public.autor_livro_seq'::regclass) NOT NULL,
autor_id integer NOT NULL,
livro_id integer NOT NULL
);
ALTER TABLE public.autor_livro OWNER TO postgres;
--
-- TOC entry 200 (class 1259 OID 16508)
-- Name: cliente_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.cliente_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.cliente_seq OWNER TO postgres;
--
-- TOC entry 201 (class 1259 OID 16510)
-- Name: cliente; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.cliente (
id integer DEFAULT nextval('public.cliente_seq'::regclass) NOT NULL,
nome character varying(255) NOT NULL,
cpf character varying(11) NOT NULL,
telefone character varying(20) NOT NULL
);
ALTER TABLE public.cliente OWNER TO postgres;
--
-- TOC entry 202 (class 1259 OID 16517)
-- Name: editora_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.editora_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.editora_seq OWNER TO postgres;
--
-- TOC entry 203 (class 1259 OID 16519)
-- Name: editora; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.editora (
id integer DEFAULT nextval('public.editora_seq'::regclass) NOT NULL,
nome character varying(255) NOT NULL,
website character varying(255) NOT NULL,
cnpj character varying(14) NOT NULL,
endereco character varying(255) NOT NULL
);
ALTER TABLE public.editora OWNER TO postgres;
--
-- TOC entry 204 (class 1259 OID 16529)
-- Name: funcionario_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.funcionario_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.funcionario_seq OWNER TO postgres;
--
-- TOC entry 205 (class 1259 OID 16531)
-- Name: funcionario; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.funcionario (
id integer DEFAULT nextval('public.funcionario_seq'::regclass) NOT NULL,
nome character varying(255) NOT NULL,
cpf character varying(11) NOT NULL,
gerente_id integer
);
ALTER TABLE public.funcionario OWNER TO postgres;
--
-- TOC entry 206 (class 1259 OID 16539)
-- Name: genero_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.genero_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.genero_seq OWNER TO postgres;
--
-- TOC entry 207 (class 1259 OID 16541)
-- Name: genero; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.genero (
id integer DEFAULT nextval('public.genero_seq'::regclass) NOT NULL,
nome character varying(255) DEFAULT NULL::character varying,
parent_id integer,
lft integer NOT NULL,
rght integer NOT NULL
);
ALTER TABLE public.genero OWNER TO postgres;
--
-- TOC entry 208 (class 1259 OID 16550)
-- Name: habilitacao_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.habilitacao_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.habilitacao_seq OWNER TO postgres;
--
-- TOC entry 209 (class 1259 OID 16552)
-- Name: habilitacao; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.habilitacao (
id integer DEFAULT nextval('public.habilitacao_seq'::regclass) NOT NULL,
numero character varying(11) NOT NULL,
categoria character(2) NOT NULL,
funcionario_id integer NOT NULL
);
ALTER TABLE public.habilitacao OWNER TO postgres;
--
-- TOC entry 210 (class 1259 OID 16572)
-- Name: item_pedido_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.item_pedido_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.item_pedido_seq OWNER TO postgres;
--
-- TOC entry 211 (class 1259 OID 16574)
-- Name: item_pedido; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.item_pedido (
id integer DEFAULT nextval('public.item_pedido_seq'::regclass) NOT NULL,
pedido_id integer NOT NULL,
livro_id integer NOT NULL,
quantidade integer NOT NULL
);
ALTER TABLE public.item_pedido OWNER TO postgres;
--
-- TOC entry 212 (class 1259 OID 16583)
-- Name: livro_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.livro_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.livro_seq OWNER TO postgres;
--
-- TOC entry 213 (class 1259 OID 16585)
-- Name: livro; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.livro (
id integer DEFAULT nextval('public.livro_seq'::regclass) NOT NULL,
titulo character varying(255) NOT NULL,
preco numeric(18,2) NOT NULL,
isbn character varying(13) NOT NULL,
edicao integer NOT NULL,
ano_publicacao character(4) NOT NULL,
editora_id integer NOT NULL,
genero_id integer
);
ALTER TABLE public.livro OWNER TO postgres;
--
-- TOC entry 214 (class 1259 OID 16605)
-- Name: pedido_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.pedido_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.pedido_seq OWNER TO postgres;
--
-- TOC entry 215 (class 1259 OID 16607)
-- Name: pedido; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.pedido (
id integer DEFAULT nextval('public.pedido_seq'::regclass) NOT NULL,
data timestamp(0) without time zone NOT NULL,
cliente_id integer NOT NULL,
funcionario_id integer NOT NULL
);
ALTER TABLE public.pedido OWNER TO postgres;
--
-- TOC entry 2919 (class 0 OID 16488)
-- Dependencies: 197
-- Data for Name: autor; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.autor VALUES (1, 'Mosantos de Vilar dos Telles');
INSERT INTO public.autor VALUES (2, 'Jonas Guanabara da Silva');
INSERT INTO public.autor VALUES (3, 'Joselito de Cascatinha');
INSERT INTO public.autor VALUES (4, 'Luis Boça');
INSERT INTO public.autor VALUES (5, 'Charlinho Menino Guerreiro');
INSERT INTO public.autor VALUES (6, 'Dona Maxima');
INSERT INTO public.autor VALUES (7, 'Doutor Lincon');
INSERT INTO public.autor VALUES (8, 'Linhares');
INSERT INTO public.autor VALUES (9, 'Jonny Boganville');
INSERT INTO public.autor VALUES (10, ' Jimmy Leroy');
INSERT INTO public.autor VALUES (11, 'Professor Gilmar');
INSERT INTO public.autor VALUES (12, 'Padre Quemedo');
INSERT INTO public.autor VALUES (13, 'Lagreca');
INSERT INTO public.autor VALUES (14, 'Dedé Carvoeiro');
INSERT INTO public.autor VALUES (15, 'Carlos Carne');
INSERT INTO public.autor VALUES (16, 'Seu Madruga');
INSERT INTO public.autor VALUES (17, 'Teste 123');
--
-- TOC entry 2921 (class 0 OID 16497)
-- Dependencies: 199
-- Data for Name: autor_livro; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.autor_livro VALUES (1, 1, 2);
INSERT INTO public.autor_livro VALUES (8, 1, 4);
INSERT INTO public.autor_livro VALUES (9, 1, 5);
INSERT INTO public.autor_livro VALUES (10, 1, 6);
INSERT INTO public.autor_livro VALUES (2, 2, 1);
INSERT INTO public.autor_livro VALUES (24, 2, 10);
INSERT INTO public.autor_livro VALUES (3, 3, 1);
INSERT INTO public.autor_livro VALUES (16, 3, 3);
INSERT INTO public.autor_livro VALUES (11, 3, 6);
INSERT INTO public.autor_livro VALUES (25, 3, 10);
INSERT INTO public.autor_livro VALUES (17, 4, 3);
INSERT INTO public.autor_livro VALUES (18, 5, 3);
INSERT INTO public.autor_livro VALUES (12, 5, 6);
INSERT INTO public.autor_livro VALUES (13, 5, 7);
INSERT INTO public.autor_livro VALUES (20, 11, 8);
INSERT INTO public.autor_livro VALUES (21, 12, 8);
INSERT INTO public.autor_livro VALUES (22, 14, 8);
INSERT INTO public.autor_livro VALUES (23, 16, 8);
INSERT INTO public.autor_livro VALUES (15, 16, 9);
--
-- TOC entry 2923 (class 0 OID 16510)
-- Dependencies: 201
-- Data for Name: cliente; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.cliente VALUES (1, 'Steven Beagle', '33554488662', '219999999');
INSERT INTO public.cliente VALUES (2, 'Dudu Marchiori', '78945873215', '2155555555');
INSERT INTO public.cliente VALUES (3, 'Adilson Polloskki', '32145675395', '1166666666');
INSERT INTO public.cliente VALUES (4, 'Kiko', '12345678999', '2154355646');
--
-- TOC entry 2925 (class 0 OID 16519)
-- Dependencies: 203
-- Data for Name: editora; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.editora VALUES (1, 'Editora Organizações Tabajara', 'http://www.tabajara-livros.com.br', '66968328000104', '545345345');
INSERT INTO public.editora VALUES (2, 'Editora Mosantos LTDA', 'http://www.editora-mosantos.com.br', '80880262000127', '');
INSERT INTO public.editora VALUES (3, 'Editora Top das Galaxias', 'http://www.w3.org/Addressing/URL/url-spec.txt', '36215975395', '');
INSERT INTO public.editora VALUES (4, 'EDITORA VILA 8', 'www.vila8.org', '1654984546549', '');
INSERT INTO public.editora VALUES (5, 'tabajar', 'www.sdfsdf.com', '23423432', 'rua legal');
INSERT INTO public.editora VALUES (6, 'werwerwerwe', 'www.sdfsdf.com', '23423432', 'rua legal');
INSERT INTO public.editora VALUES (7, 'douglas', 'www.sdfsdf.com', '23423432', 'rua legal');
--
-- TOC entry 2927 (class 0 OID 16531)
-- Dependencies: 205
-- Data for Name: funcionario; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.funcionario VALUES (7, 'Lurdes Boça', '74832651489', NULL);
INSERT INTO public.funcionario VALUES (8, 'Wallace Guilhermino', '65478932145', 7);
INSERT INTO public.funcionario VALUES (9, 'Edson Wander', '54698715324', 8);
INSERT INTO public.funcionario VALUES (10, 'Cláudio Ricardo', '45667789442', 7);
INSERT INTO public.funcionario VALUES (11, 'Neo Labaque', '54789634128', 7);
INSERT INTO public.funcionario VALUES (13, 'Renato Noiadão', '56842365142', 10);
INSERT INTO public.funcionario VALUES (14, 'José Canjica Martins', '24862486248', 7);
INSERT INTO public.funcionario VALUES (15, 'Carlos Calhorda', '24321589654', 8);
INSERT INTO public.funcionario VALUES (16, 'Chaves', '57352187256', NULL);
INSERT INTO public.funcionario VALUES (17, 'Sou Hype', '23423422342', NULL);
--
-- TOC entry 2929 (class 0 OID 16541)
-- Dependencies: 207
-- Data for Name: genero; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.genero VALUES (1, 'Narrativo', NULL, 1, 82);
INSERT INTO public.genero VALUES (2, 'Lírico', NULL, 83, 98);
INSERT INTO public.genero VALUES (3, 'Dramático', NULL, 99, 106);
INSERT INTO public.genero VALUES (4, 'Poesia', 2, 84, 85);
INSERT INTO public.genero VALUES (5, 'Ode', 2, 86, 87);
INSERT INTO public.genero VALUES (6, 'Sátira', 2, 88, 89);
INSERT INTO public.genero VALUES (7, 'Hino', 2, 90, 91);
INSERT INTO public.genero VALUES (8, 'Soneto', 2, 92, 93);
INSERT INTO public.genero VALUES (9, 'Haicai', 2, 94, 95);
INSERT INTO public.genero VALUES (10, 'Acróstico', 2, 96, 97);
INSERT INTO public.genero VALUES (11, 'Romance', 1, 2, 11);
INSERT INTO public.genero VALUES (12, 'Romance de Aprendizagem', 11, 3, 4);
INSERT INTO public.genero VALUES (13, 'Romance Policial', 11, 5, 6);
INSERT INTO public.genero VALUES (14, 'Romance Psicológico', 11, 7, 8);
INSERT INTO public.genero VALUES (15, 'Romances Históricos', 11, 9, 10);
INSERT INTO public.genero VALUES (16, 'Fábula', 1, 12, 13);
INSERT INTO public.genero VALUES (17, 'Novela', 1, 14, 15);
INSERT INTO public.genero VALUES (18, 'Conto', 1, 16, 17);
INSERT INTO public.genero VALUES (19, 'Crônica', 1, 18, 19);
INSERT INTO public.genero VALUES (20, 'Poesia Épica ou Epopeia', 1, 20, 21);
INSERT INTO public.genero VALUES (21, 'Apocalipse Zumbi', 1, 22, 23);
INSERT INTO public.genero VALUES (22, 'Autobiografia', 1, 24, 25);
INSERT INTO public.genero VALUES (23, 'Biografia', 1, 26, 27);
INSERT INTO public.genero VALUES (24, 'Chick-Lit', 1, 28, 29);
INSERT INTO public.genero VALUES (25, 'Fantasia e Fantasia Científica', 1, 30, 31);
INSERT INTO public.genero VALUES (26, 'Ficção Científica: na Literatura e também nas Revistas e Gibis', 1, 32, 33);
INSERT INTO public.genero VALUES (27, 'Folhetim', 1, 34, 35);
INSERT INTO public.genero VALUES (28, 'Horror', 1, 36, 37);
INSERT INTO public.genero VALUES (29, 'Literatura Brutalista', 1, 38, 39);
INSERT INTO public.genero VALUES (30, 'Literatura Fantástica', 1, 40, 41);
INSERT INTO public.genero VALUES (31, 'Literatura Infanto-Juvenil', 1, 42, 43);
INSERT INTO public.genero VALUES (32, 'Literatura YA – Young Adult – Jovem Adulto', 1, 44, 45);
INSERT INTO public.genero VALUES (33, 'Metaficção', 1, 46, 47);
INSERT INTO public.genero VALUES (34, 'Neocrítica', 1, 48, 49);
INSERT INTO public.genero VALUES (35, 'Novelas de Cavalaria', 1, 50, 51);
INSERT INTO public.genero VALUES (36, 'Paródia', 1, 52, 53);
INSERT INTO public.genero VALUES (37, 'Sick-Lit', 1, 54, 55);
INSERT INTO public.genero VALUES (38, 'Space Opera', 1, 56, 57);
INSERT INTO public.genero VALUES (39, 'Suspense', 1, 58, 59);
INSERT INTO public.genero VALUES (40, 'Vampirismo', 1, 60, 61);
INSERT INTO public.genero VALUES (41, 'Literatura Gótica', 1, 62, 63);
INSERT INTO public.genero VALUES (42, 'Literatura Esotérica', 1, 64, 65);
INSERT INTO public.genero VALUES (43, 'Romances Espíritas', 1, 66, 67);
INSERT INTO public.genero VALUES (44, 'Literatura de Auto-Ajuda', 1, 68, 69);
INSERT INTO public.genero VALUES (45, 'Literatura de Negócios', 1, 70, 71);
INSERT INTO public.genero VALUES (46, 'Literatura Steampunk', 1, 72, 73);
INSERT INTO public.genero VALUES (47, 'Literatura Cyberpunk', 1, 74, 75);
INSERT INTO public.genero VALUES (48, 'Literatura Espiritualista', 1, 76, 77);
INSERT INTO public.genero VALUES (49, 'Literatura de Aventura', 1, 78, 79);
INSERT INTO public.genero VALUES (50, 'Literatura de Guerra', 1, 80, 81);
INSERT INTO public.genero VALUES (51, 'Farsa', 3, 100, 101);
INSERT INTO public.genero VALUES (52, 'Tragédia', 3, 102, 103);
INSERT INTO public.genero VALUES (53, 'Elegia', 3, 104, 105);
INSERT INTO public.genero VALUES (54, 'Poesia de Elfo', 4, 107, 108);
--
-- TOC entry 2931 (class 0 OID 16552)
-- Dependencies: 209
-- Data for Name: habilitacao; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.habilitacao VALUES (1, '78495162354', 'B ', 7);
INSERT INTO public.habilitacao VALUES (2, '99885523654', 'AD', 10);
INSERT INTO public.habilitacao VALUES (3, '45687512598', 'C ', 13);
INSERT INTO public.habilitacao VALUES (5, '12396348525', 'A ', 11);
INSERT INTO public.habilitacao VALUES (6, '21575698423', 'AB', 14);
INSERT INTO public.habilitacao VALUES (7, '14785236548', 'C ', 15);
INSERT INTO public.habilitacao VALUES (8, '23484562848', 'AB', 16);
INSERT INTO public.habilitacao VALUES (9, '44334345345', 'C ', 17);
--
-- TOC entry 2933 (class 0 OID 16574)
-- Dependencies: 211
-- Data for Name: item_pedido; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.item_pedido VALUES (1, 1, 1, 1);
INSERT INTO public.item_pedido VALUES (2, 1, 3, 1);
INSERT INTO public.item_pedido VALUES (3, 2, 5, 3);
INSERT INTO public.item_pedido VALUES (4, 3, 3, 1);
INSERT INTO public.item_pedido VALUES (5, 2, 4, 2);
INSERT INTO public.item_pedido VALUES (6, 5, 1, 2);
INSERT INTO public.item_pedido VALUES (7, 5, 2, 3);
INSERT INTO public.item_pedido VALUES (8, 5, 5, 4);
INSERT INTO public.item_pedido VALUES (9, 6, 1, 3);
INSERT INTO public.item_pedido VALUES (10, 6, 2, 2);
INSERT INTO public.item_pedido VALUES (11, 6, 6, 4);
INSERT INTO public.item_pedido VALUES (12, 7, 8, 2);
INSERT INTO public.item_pedido VALUES (13, 11, 9, 6);
INSERT INTO public.item_pedido VALUES (14, 12, 1, 8);
INSERT INTO public.item_pedido VALUES (16, 16, 1, 10);
INSERT INTO public.item_pedido VALUES (17, 17, 1, 5);
INSERT INTO public.item_pedido VALUES (18, 17, 4, 10);
INSERT INTO public.item_pedido VALUES (19, 17, 6, 15);
INSERT INTO public.item_pedido VALUES (20, 20, 4, 4);
INSERT INTO public.item_pedido VALUES (21, 26, 2, 5);
INSERT INTO public.item_pedido VALUES (22, 27, 2, 5);
INSERT INTO public.item_pedido VALUES (23, 28, 4, 10);
INSERT INTO public.item_pedido VALUES (24, 29, 2, 8);
INSERT INTO public.item_pedido VALUES (25, 30, 3, 42);
INSERT INTO public.item_pedido VALUES (28, 32, 2, 1);
INSERT INTO public.item_pedido VALUES (29, 33, 7, 20);
INSERT INTO public.item_pedido VALUES (30, 33, 3, 5);
INSERT INTO public.item_pedido VALUES (31, 33, 1, 2);
INSERT INTO public.item_pedido VALUES (32, 34, 6, 5);
INSERT INTO public.item_pedido VALUES (33, 34, 8, 10);
INSERT INTO public.item_pedido VALUES (34, 34, 5, 5);
INSERT INTO public.item_pedido VALUES (35, 35, 1, 24);
INSERT INTO public.item_pedido VALUES (36, 35, 3, 34);
INSERT INTO public.item_pedido VALUES (37, 35, 6, 88);
INSERT INTO public.item_pedido VALUES (38, 36, 1, 24);
INSERT INTO public.item_pedido VALUES (39, 36, 3, 34);
INSERT INTO public.item_pedido VALUES (40, 36, 6, 88);
INSERT INTO public.item_pedido VALUES (41, 38, 1, 3);
INSERT INTO public.item_pedido VALUES (42, 38, 3, 5);
INSERT INTO public.item_pedido VALUES (43, 38, 4, 44);
INSERT INTO public.item_pedido VALUES (44, 38, 9, 66);
--
-- TOC entry 2935 (class 0 OID 16585)
-- Dependencies: 213
-- Data for Name: livro; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.livro VALUES (1, 'Sucesso na Vida', 39.99, '123456789112', 15, '2012', 1, 45);
INSERT INTO public.livro VALUES (2, 'Brincadeira em Excesso Virou Bobeira', 44.01, '9876543211112', 2, '2015', 2, 22);
INSERT INTO public.livro VALUES (3, 'Fazendo Bolos com CakePHP', 89.95, '3216547894561', 3, '2017', 1, 47);
INSERT INTO public.livro VALUES (4, 'Vamos Investigar?', 63.22, '7849516236295', 2, '2014', 2, 28);
INSERT INTO public.livro VALUES (5, 'Portabilidade Manual: Um Tutorial Prático', 100.99, '4568521597534', 2, '1997', 2, 18);
INSERT INTO public.livro VALUES (6, 'Brazil Mulambo', 9.99, '1236547562111', 1, '2014', 1, 11);
INSERT INTO public.livro VALUES (7, 'Tudo pelo estudo', 1.99, '12345678965', 1, '2002', 3, 23);
INSERT INTO public.livro VALUES (8, 'Quem Cedo Madruga Deus Ajuda', 55.99, '9157357561', 5, '1997', 1, 13);
INSERT INTO public.livro VALUES (9, 'Madrugando', 18.89, '5485315675165', 10, '1991', 4, 8);
INSERT INTO public.livro VALUES (10, 'Eu entendo seu conceito mas não concordo', 1.13, '4534535325245', 1, '2017', 1, 21);
--
-- TOC entry 2937 (class 0 OID 16607)
-- Dependencies: 215
-- Data for Name: pedido; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.pedido VALUES (1, '2016-03-01 00:00:00', 1, 10);
INSERT INTO public.pedido VALUES (2, '2014-12-11 13:00:00', 2, 9);
INSERT INTO public.pedido VALUES (3, '2017-03-30 06:30:37', 1, 7);
INSERT INTO public.pedido VALUES (5, '2017-03-26 04:34:00', 1, 7);
INSERT INTO public.pedido VALUES (6, '2038-03-27 16:47:00', 1, 7);
INSERT INTO public.pedido VALUES (7, '2017-05-22 12:55:00', 1, 16);
INSERT INTO public.pedido VALUES (11, '2017-05-25 15:07:00', 4, 16);
INSERT INTO public.pedido VALUES (12, '2017-05-26 14:09:00', 4, 11);
INSERT INTO public.pedido VALUES (16, '2017-05-26 14:26:00', 1, 7);
INSERT INTO public.pedido VALUES (17, '2017-05-26 14:28:00', 2, 10);
INSERT INTO public.pedido VALUES (20, '2017-05-26 15:14:00', 1, 10);
INSERT INTO public.pedido VALUES (26, '2017-05-29 13:04:00', 4, 14);
INSERT INTO public.pedido VALUES (27, '2017-05-29 13:04:00', 4, 14);
INSERT INTO public.pedido VALUES (28, '2017-05-29 13:05:00', 3, 10);
INSERT INTO public.pedido VALUES (29, '2017-05-30 14:49:00', 3, 9);
INSERT INTO public.pedido VALUES (30, '2017-05-31 12:44:00', 2, 14);
INSERT INTO public.pedido VALUES (32, '2017-05-31 12:49:00', 3, 13);
INSERT INTO public.pedido VALUES (33, '2017-05-31 12:53:00', 4, 8);
INSERT INTO public.pedido VALUES (34, '2017-05-31 12:53:00', 3, 15);
INSERT INTO public.pedido VALUES (35, '2017-06-19 19:00:00', 1, 7);
INSERT INTO public.pedido VALUES (36, '2017-04-19 04:07:00', 1, 7);
INSERT INTO public.pedido VALUES (37, '2019-03-24 00:00:00', 1, 7);
INSERT INTO public.pedido VALUES (38, '2019-03-24 00:00:00', 1, 7);
--
-- TOC entry 2944 (class 0 OID 0)
-- Dependencies: 198
-- Name: autor_livro_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.autor_livro_seq', 26, false);
--
-- TOC entry 2945 (class 0 OID 0)
-- Dependencies: 196
-- Name: autor_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.autor_seq', 18, false);
--
-- TOC entry 2946 (class 0 OID 0)
-- Dependencies: 200
-- Name: cliente_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.cliente_seq', 5, false);
--
-- TOC entry 2947 (class 0 OID 0)
-- Dependencies: 202
-- Name: editora_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.editora_seq', 8, false);
--
-- TOC entry 2948 (class 0 OID 0)
-- Dependencies: 204
-- Name: funcionario_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.funcionario_seq', 18, false);
--
-- TOC entry 2949 (class 0 OID 0)
-- Dependencies: 206
-- Name: genero_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.genero_seq', 55, false);
--
-- TOC entry 2950 (class 0 OID 0)
-- Dependencies: 208
-- Name: habilitacao_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.habilitacao_seq', 10, false);
--
-- TOC entry 2951 (class 0 OID 0)
-- Dependencies: 210
-- Name: item_pedido_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.item_pedido_seq', 45, false);
--
-- TOC entry 2952 (class 0 OID 0)
-- Dependencies: 212
-- Name: livro_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.livro_seq', 11, false);
--
-- TOC entry 2953 (class 0 OID 0)
-- Dependencies: 214
-- Name: pedido_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.pedido_seq', 39, false);
--
-- TOC entry 2754 (class 2606 OID 16504)
-- Name: autor_livro autor_id; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.autor_livro
ADD CONSTRAINT autor_id UNIQUE (autor_id, livro_id);
--
-- TOC entry 2757 (class 2606 OID 16502)
-- Name: autor_livro autor_livro_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.autor_livro
ADD CONSTRAINT autor_livro_pkey PRIMARY KEY (id);
--
-- TOC entry 2752 (class 2606 OID 16493)
-- Name: autor autor_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.autor
ADD CONSTRAINT autor_pkey PRIMARY KEY (id);
--
-- TOC entry 2760 (class 2606 OID 16515)
-- Name: cliente cliente_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.cliente
ADD CONSTRAINT cliente_pkey PRIMARY KEY (id);
--
-- TOC entry 2762 (class 2606 OID 16527)
-- Name: editora editora_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.editora
ADD CONSTRAINT editora_pkey PRIMARY KEY (id);
--
-- TOC entry 2770 (class 2606 OID 16559)
-- Name: habilitacao funcionario_id; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.habilitacao
ADD CONSTRAINT funcionario_id UNIQUE (funcionario_id);
--
-- TOC entry 2764 (class 2606 OID 16536)
-- Name: funcionario funcionario_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.funcionario
ADD CONSTRAINT funcionario_pkey PRIMARY KEY (id);
--
-- TOC entry 2767 (class 2606 OID 16547)
-- Name: genero genero_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.genero
ADD CONSTRAINT genero_pkey PRIMARY KEY (id);
--
-- TOC entry 2772 (class 2606 OID 16557)
-- Name: habilitacao habilitacao_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.habilitacao
ADD CONSTRAINT habilitacao_pkey PRIMARY KEY (id);
--
-- TOC entry 2779 (class 2606 OID 16592)
-- Name: livro isbn; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.livro
ADD CONSTRAINT isbn UNIQUE (isbn);
--
-- TOC entry 2774 (class 2606 OID 16579)
-- Name: item_pedido item_pedido_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.item_pedido
ADD CONSTRAINT item_pedido_pkey PRIMARY KEY (id);
--
-- TOC entry 2782 (class 2606 OID 16590)
-- Name: livro livro_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.livro
ADD CONSTRAINT livro_pkey PRIMARY KEY (id);
--
-- TOC entry 2776 (class 2606 OID 16581)
-- Name: item_pedido pedido_id; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.item_pedido
ADD CONSTRAINT pedido_id UNIQUE (pedido_id, livro_id);
--
-- TOC entry 2785 (class 2606 OID 16612)
-- Name: pedido pedido_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.pedido
ADD CONSTRAINT pedido_pkey PRIMARY KEY (id);
--
-- TOC entry 2755 (class 1259 OID 16506)
-- Name: autor_id_2; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX autor_id_2 ON public.autor_livro USING btree (autor_id);
--
-- TOC entry 2783 (class 1259 OID 16614)
-- Name: cliente_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX cliente_id ON public.pedido USING btree (cliente_id);
--
-- TOC entry 2777 (class 1259 OID 16594)
-- Name: editora_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX editora_id ON public.livro USING btree (editora_id);
--
-- TOC entry 2768 (class 1259 OID 16549)
-- Name: genero_tree_parent_fk; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX genero_tree_parent_fk ON public.genero USING btree (parent_id);
--
-- TOC entry 2765 (class 1259 OID 16538)
-- Name: gerente_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX gerente_id ON public.funcionario USING btree (gerente_id);
--
-- TOC entry 2780 (class 1259 OID 16595)
-- Name: livro_genero_fk; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX livro_genero_fk ON public.livro USING btree (genero_id);
--
-- TOC entry 2758 (class 1259 OID 16507)
-- Name: livro_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX livro_id ON public.autor_livro USING btree (livro_id);
--
-- TOC entry 2786 (class 2606 OID 16615)
-- Name: autor_livro autor_livro_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.autor_livro
ADD CONSTRAINT autor_livro_ibfk_1 FOREIGN KEY (autor_id) REFERENCES public.autor(id);
--
-- TOC entry 2787 (class 2606 OID 16620)
-- Name: autor_livro autor_livro_ibfk_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.autor_livro
ADD CONSTRAINT autor_livro_ibfk_2 FOREIGN KEY (livro_id) REFERENCES public.livro(id);
--
-- TOC entry 2788 (class 2606 OID 16625)
-- Name: funcionario funcionario_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.funcionario
ADD CONSTRAINT funcionario_ibfk_1 FOREIGN KEY (gerente_id) REFERENCES public.funcionario(id);
--
-- TOC entry 2789 (class 2606 OID 16630)
-- Name: genero genero_tree_parent_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.genero
ADD CONSTRAINT genero_tree_parent_fk FOREIGN KEY (parent_id) REFERENCES public.genero(id);
--
-- TOC entry 2790 (class 2606 OID 16635)
-- Name: habilitacao habilitacao_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.habilitacao
ADD CONSTRAINT habilitacao_ibfk_1 FOREIGN KEY (funcionario_id) REFERENCES public.funcionario(id);
--
-- TOC entry 2791 (class 2606 OID 16640)
-- Name: item_pedido item_pedido_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.item_pedido
ADD CONSTRAINT item_pedido_ibfk_1 FOREIGN KEY (pedido_id) REFERENCES public.pedido(id);
--
-- TOC entry 2792 (class 2606 OID 16645)
-- Name: item_pedido item_pedido_ibfk_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.item_pedido
ADD CONSTRAINT item_pedido_ibfk_2 FOREIGN KEY (livro_id) REFERENCES public.livro(id);
--
-- TOC entry 2793 (class 2606 OID 16650)
-- Name: livro livro_genero_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.livro
ADD CONSTRAINT livro_genero_fk FOREIGN KEY (genero_id) REFERENCES public.genero(id);
--
-- TOC entry 2794 (class 2606 OID 16655)
-- Name: livro livro_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.livro
ADD CONSTRAINT livro_ibfk_1 FOREIGN KEY (editora_id) REFERENCES public.editora(id);
--
-- TOC entry 2795 (class 2606 OID 16660)
-- Name: pedido pedido_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.pedido
ADD CONSTRAINT pedido_ibfk_1 FOREIGN KEY (funcionario_id) REFERENCES public.funcionario(id);
--
-- TOC entry 2796 (class 2606 OID 16665)
-- Name: pedido pedido_ibfk_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.pedido
ADD CONSTRAINT pedido_ibfk_2 FOREIGN KEY (cliente_id) REFERENCES public.cliente(id);
-- Completed on 2019-05-23 23:23:19
--
-- PostgreSQL database dump complete
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment