Este proyecto es una aplicación para trabajar con un base de datos Postgresql por el ramo de base de datos. https://cromer.cl/sernatur
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1606 lines
39KB

  1. --
  2. -- PostgreSQL database dump
  3. --
  4. -- Dumped from database version 11.1 (Ubuntu 11.1-3.pgdg18.04+1)
  5. -- Dumped by pg_dump version 11.1 (Ubuntu 11.1-3.pgdg18.04+1)
  6. SET statement_timeout = 0;
  7. SET lock_timeout = 0;
  8. SET idle_in_transaction_session_timeout = 0;
  9. SET client_encoding = 'UTF8';
  10. SET standard_conforming_strings = on;
  11. SELECT pg_catalog.set_config('search_path', '', false);
  12. SET check_function_bodies = false;
  13. SET client_min_messages = warning;
  14. SET row_security = off;
  15. SET default_tablespace = '';
  16. SET default_with_oids = false;
  17. --
  18. -- Name: arrienda; Type: TABLE; Schema: public; Owner: cromer
  19. --
  20. CREATE TABLE public.arrienda (
  21. patente character varying(6) NOT NULL,
  22. rut_empresa character varying(9) NOT NULL,
  23. precio integer NOT NULL,
  24. fecha_devolucion date NOT NULL,
  25. CONSTRAINT arrienda_precio_check CHECK ((precio > 0))
  26. );
  27. ALTER TABLE public.arrienda OWNER TO cromer;
  28. --
  29. -- Name: asociado; Type: TABLE; Schema: public; Owner: cromer
  30. --
  31. CREATE TABLE public.asociado (
  32. id_tour integer NOT NULL,
  33. id_lugar smallint NOT NULL,
  34. fecha_llegada date,
  35. hora_llegada time without time zone,
  36. fecha_salida date,
  37. hora_salida time without time zone
  38. );
  39. ALTER TABLE public.asociado OWNER TO cromer;
  40. --
  41. -- Name: categoria; Type: TABLE; Schema: public; Owner: cromer
  42. --
  43. CREATE TABLE public.categoria (
  44. id_categoria smallint NOT NULL,
  45. descripcion_categoria text NOT NULL
  46. );
  47. ALTER TABLE public.categoria OWNER TO cromer;
  48. --
  49. -- Name: categoria_id_categoria_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  50. --
  51. CREATE SEQUENCE public.categoria_id_categoria_seq
  52. AS smallint
  53. START WITH 1
  54. INCREMENT BY 1
  55. NO MINVALUE
  56. NO MAXVALUE
  57. CACHE 1;
  58. ALTER TABLE public.categoria_id_categoria_seq OWNER TO cromer;
  59. --
  60. -- Name: categoria_id_categoria_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  61. --
  62. ALTER SEQUENCE public.categoria_id_categoria_seq OWNED BY public.categoria.id_categoria;
  63. --
  64. -- Name: ciudad; Type: TABLE; Schema: public; Owner: cromer
  65. --
  66. CREATE TABLE public.ciudad (
  67. id_ciudad smallint NOT NULL,
  68. nombre_ciudad character varying(20) NOT NULL,
  69. id_region smallint
  70. );
  71. ALTER TABLE public.ciudad OWNER TO cromer;
  72. --
  73. -- Name: ciudad_id_ciudad_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  74. --
  75. CREATE SEQUENCE public.ciudad_id_ciudad_seq
  76. AS smallint
  77. START WITH 1
  78. INCREMENT BY 1
  79. NO MINVALUE
  80. NO MAXVALUE
  81. CACHE 1;
  82. ALTER TABLE public.ciudad_id_ciudad_seq OWNER TO cromer;
  83. --
  84. -- Name: ciudad_id_ciudad_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  85. --
  86. ALTER SEQUENCE public.ciudad_id_ciudad_seq OWNED BY public.ciudad.id_ciudad;
  87. --
  88. -- Name: contacto_emergencia; Type: TABLE; Schema: public; Owner: cromer
  89. --
  90. CREATE TABLE public.contacto_emergencia (
  91. id_contacto integer NOT NULL,
  92. telefono_emergencia bigint NOT NULL,
  93. nombre_emergencia character varying(50) NOT NULL,
  94. CONSTRAINT contacto_emergencia_telefono_emergencia_check CHECK (((telefono_emergencia > 99999999) AND (telefono_emergencia < '100000000000'::bigint)))
  95. );
  96. ALTER TABLE public.contacto_emergencia OWNER TO cromer;
  97. --
  98. -- Name: contacto_emergencia_id_contacto_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  99. --
  100. CREATE SEQUENCE public.contacto_emergencia_id_contacto_seq
  101. AS integer
  102. START WITH 1
  103. INCREMENT BY 1
  104. NO MINVALUE
  105. NO MAXVALUE
  106. CACHE 1;
  107. ALTER TABLE public.contacto_emergencia_id_contacto_seq OWNER TO cromer;
  108. --
  109. -- Name: contacto_emergencia_id_contacto_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  110. --
  111. ALTER SEQUENCE public.contacto_emergencia_id_contacto_seq OWNED BY public.contacto_emergencia.id_contacto;
  112. --
  113. -- Name: descuento; Type: TABLE; Schema: public; Owner: cromer
  114. --
  115. CREATE TABLE public.descuento (
  116. id_descuento smallint NOT NULL,
  117. descripcion_descuento text NOT NULL,
  118. porcentaje numeric(3,2) NOT NULL,
  119. CONSTRAINT descuento_porcentaje_check CHECK (((porcentaje >= (0)::numeric) AND (porcentaje <= (1)::numeric)))
  120. );
  121. ALTER TABLE public.descuento OWNER TO cromer;
  122. --
  123. -- Name: descuento_id_descuento_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  124. --
  125. CREATE SEQUENCE public.descuento_id_descuento_seq
  126. AS smallint
  127. START WITH 1
  128. INCREMENT BY 1
  129. NO MINVALUE
  130. NO MAXVALUE
  131. CACHE 1;
  132. ALTER TABLE public.descuento_id_descuento_seq OWNER TO cromer;
  133. --
  134. -- Name: descuento_id_descuento_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  135. --
  136. ALTER SEQUENCE public.descuento_id_descuento_seq OWNED BY public.descuento.id_descuento;
  137. --
  138. -- Name: empresa; Type: TABLE; Schema: public; Owner: cromer
  139. --
  140. CREATE TABLE public.empresa (
  141. rut_empresa character varying(9) NOT NULL,
  142. nombre_empresa character varying(50) NOT NULL,
  143. contacto character varying(50) NOT NULL,
  144. telefono bigint NOT NULL,
  145. CONSTRAINT empresa_telefono_check CHECK (((telefono > 99999999) AND (telefono < '100000000000'::bigint)))
  146. );
  147. ALTER TABLE public.empresa OWNER TO cromer;
  148. --
  149. -- Name: enfermedad; Type: TABLE; Schema: public; Owner: cromer
  150. --
  151. CREATE TABLE public.enfermedad (
  152. id_enfermedad smallint NOT NULL,
  153. descripcion_enfermedad text NOT NULL
  154. );
  155. ALTER TABLE public.enfermedad OWNER TO cromer;
  156. --
  157. -- Name: enfermedad_id_enfermedad_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  158. --
  159. CREATE SEQUENCE public.enfermedad_id_enfermedad_seq
  160. AS smallint
  161. START WITH 1
  162. INCREMENT BY 1
  163. NO MINVALUE
  164. NO MAXVALUE
  165. CACHE 1;
  166. ALTER TABLE public.enfermedad_id_enfermedad_seq OWNER TO cromer;
  167. --
  168. -- Name: enfermedad_id_enfermedad_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  169. --
  170. ALTER SEQUENCE public.enfermedad_id_enfermedad_seq OWNED BY public.enfermedad.id_enfermedad;
  171. --
  172. -- Name: especialidad; Type: TABLE; Schema: public; Owner: cromer
  173. --
  174. CREATE TABLE public.especialidad (
  175. id_especialidad smallint NOT NULL,
  176. descripcion_especialidad text NOT NULL
  177. );
  178. ALTER TABLE public.especialidad OWNER TO cromer;
  179. --
  180. -- Name: especialidad_id_especialidad_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  181. --
  182. CREATE SEQUENCE public.especialidad_id_especialidad_seq
  183. AS smallint
  184. START WITH 1
  185. INCREMENT BY 1
  186. NO MINVALUE
  187. NO MAXVALUE
  188. CACHE 1;
  189. ALTER TABLE public.especialidad_id_especialidad_seq OWNER TO cromer;
  190. --
  191. -- Name: especialidad_id_especialidad_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  192. --
  193. ALTER SEQUENCE public.especialidad_id_especialidad_seq OWNED BY public.especialidad.id_especialidad;
  194. --
  195. -- Name: guia; Type: TABLE; Schema: public; Owner: cromer
  196. --
  197. CREATE TABLE public.guia (
  198. rut_guia character varying(9) NOT NULL,
  199. nombre_guia character varying(50) NOT NULL,
  200. calle character varying(20) NOT NULL,
  201. numero smallint NOT NULL,
  202. id_ciudad smallint
  203. );
  204. ALTER TABLE public.guia OWNER TO cromer;
  205. --
  206. -- Name: lugar; Type: TABLE; Schema: public; Owner: cromer
  207. --
  208. CREATE TABLE public.lugar (
  209. id_lugar smallint NOT NULL,
  210. nombre_lugar character varying(50) NOT NULL,
  211. valor_entrada integer NOT NULL,
  212. nivel smallint NOT NULL,
  213. id_ciudad smallint,
  214. CONSTRAINT lugar_nivel_check CHECK ((nivel >= 0)),
  215. CONSTRAINT lugar_valor_entrada_check CHECK ((valor_entrada >= 0))
  216. );
  217. ALTER TABLE public.lugar OWNER TO cromer;
  218. --
  219. -- Name: lugar_id_lugar_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  220. --
  221. CREATE SEQUENCE public.lugar_id_lugar_seq
  222. AS smallint
  223. START WITH 1
  224. INCREMENT BY 1
  225. NO MINVALUE
  226. NO MAXVALUE
  227. CACHE 1;
  228. ALTER TABLE public.lugar_id_lugar_seq OWNER TO cromer;
  229. --
  230. -- Name: lugar_id_lugar_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  231. --
  232. ALTER SEQUENCE public.lugar_id_lugar_seq OWNED BY public.lugar.id_lugar;
  233. --
  234. -- Name: participa; Type: TABLE; Schema: public; Owner: cromer
  235. --
  236. CREATE TABLE public.participa (
  237. id_tour integer NOT NULL,
  238. rut_guia character varying(9) NOT NULL,
  239. id_categoria smallint NOT NULL
  240. );
  241. ALTER TABLE public.participa OWNER TO cromer;
  242. --
  243. -- Name: posee; Type: TABLE; Schema: public; Owner: cromer
  244. --
  245. CREATE TABLE public.posee (
  246. rut_guia character varying(9) NOT NULL,
  247. id_especialidad smallint NOT NULL,
  248. nivel_especialidad smallint NOT NULL,
  249. CONSTRAINT posee_nivel_especialidad_check CHECK ((nivel_especialidad >= 0))
  250. );
  251. ALTER TABLE public.posee OWNER TO cromer;
  252. --
  253. -- Name: realiza; Type: TABLE; Schema: public; Owner: cromer
  254. --
  255. CREATE TABLE public.realiza (
  256. id_tour integer NOT NULL,
  257. rut_turista character varying(9) NOT NULL,
  258. id_descuento smallint
  259. );
  260. ALTER TABLE public.realiza OWNER TO cromer;
  261. --
  262. -- Name: region; Type: TABLE; Schema: public; Owner: cromer
  263. --
  264. CREATE TABLE public.region (
  265. id_region smallint NOT NULL,
  266. nombre_region character varying(20) NOT NULL
  267. );
  268. ALTER TABLE public.region OWNER TO cromer;
  269. --
  270. -- Name: region_id_region_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  271. --
  272. CREATE SEQUENCE public.region_id_region_seq
  273. AS smallint
  274. START WITH 1
  275. INCREMENT BY 1
  276. NO MINVALUE
  277. NO MAXVALUE
  278. CACHE 1;
  279. ALTER TABLE public.region_id_region_seq OWNER TO cromer;
  280. --
  281. -- Name: region_id_region_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  282. --
  283. ALTER SEQUENCE public.region_id_region_seq OWNED BY public.region.id_region;
  284. --
  285. -- Name: tour; Type: TABLE; Schema: public; Owner: cromer
  286. --
  287. CREATE TABLE public.tour (
  288. id_tour integer NOT NULL,
  289. nombre_tour character varying(50) NOT NULL,
  290. costo_indiv integer NOT NULL,
  291. costo_grupal integer NOT NULL,
  292. minima_personas integer NOT NULL,
  293. id_ciudad smallint,
  294. CONSTRAINT tour_check CHECK ((costo_indiv > costo_grupal)),
  295. CONSTRAINT tour_costo_grupal_check CHECK ((costo_grupal > 0)),
  296. CONSTRAINT tour_minima_personas_check CHECK ((minima_personas > 0))
  297. );
  298. ALTER TABLE public.tour OWNER TO cromer;
  299. --
  300. -- Name: regiones_sindescuento; Type: VIEW; Schema: public; Owner: cromer
  301. --
  302. CREATE VIEW public.regiones_sindescuento AS
  303. SELECT r.nombre_region AS nombreregion,
  304. count(r2.rut_turista) AS cantidad
  305. FROM (((public.region r
  306. JOIN public.ciudad c ON ((c.id_region = r.id_region)))
  307. JOIN public.tour t ON ((t.id_ciudad = c.id_ciudad)))
  308. JOIN public.realiza r2 ON ((r2.id_tour = t.id_tour)))
  309. WHERE ((EXISTS ( SELECT asociado.fecha_llegada
  310. FROM public.asociado
  311. WHERE ((asociado.id_tour = t.id_tour) AND ((asociado.fecha_llegada >= '2018-11-01'::date) AND (asociado.fecha_llegada <= '2018-11-30'::date))))) AND (r2.id_descuento = 2))
  312. GROUP BY r.nombre_region;
  313. ALTER TABLE public.regiones_sindescuento OWNER TO cromer;
  314. --
  315. -- Name: requerir_auto; Type: TABLE; Schema: public; Owner: cromer
  316. --
  317. CREATE TABLE public.requerir_auto (
  318. id_tour integer NOT NULL,
  319. patente character varying(6) NOT NULL,
  320. chofer character varying(50) NOT NULL
  321. );
  322. ALTER TABLE public.requerir_auto OWNER TO cromer;
  323. --
  324. -- Name: tiene_enfermedad; Type: TABLE; Schema: public; Owner: cromer
  325. --
  326. CREATE TABLE public.tiene_enfermedad (
  327. rut_turista character varying(9) NOT NULL,
  328. id_enfermedad smallint NOT NULL
  329. );
  330. ALTER TABLE public.tiene_enfermedad OWNER TO cromer;
  331. --
  332. -- Name: total_arriendos; Type: VIEW; Schema: public; Owner: cromer
  333. --
  334. CREATE VIEW public.total_arriendos AS
  335. SELECT count(a.patente) AS totalarriendo
  336. FROM (((public.arrienda a
  337. JOIN public.requerir_auto r ON (((r.patente)::text = (a.patente)::text)))
  338. JOIN public.tour t ON ((t.id_tour = r.id_tour)))
  339. JOIN public.asociado a2 ON ((t.id_tour = a2.id_tour)))
  340. WHERE ((a2.fecha_llegada >= '2018-01-01'::date) AND (a2.fecha_llegada <= '2018-02-28'::date));
  341. ALTER TABLE public.total_arriendos OWNER TO cromer;
  342. --
  343. -- Name: total_coordinadores; Type: VIEW; Schema: public; Owner: cromer
  344. --
  345. CREATE VIEW public.total_coordinadores AS
  346. SELECT
  347. NULL::integer AS idt,
  348. NULL::character varying(50) AS nombret,
  349. NULL::bigint AS totalcoordinadores;
  350. ALTER TABLE public.total_coordinadores OWNER TO cromer;
  351. --
  352. -- Name: total_turistas; Type: VIEW; Schema: public; Owner: cromer
  353. --
  354. CREATE VIEW public.total_turistas AS
  355. SELECT
  356. NULL::integer AS idt,
  357. NULL::character varying(50) AS nombret,
  358. NULL::bigint AS totalturistas;
  359. ALTER TABLE public.total_turistas OWNER TO cromer;
  360. --
  361. -- Name: vehiculo; Type: TABLE; Schema: public; Owner: cromer
  362. --
  363. CREATE TABLE public.vehiculo (
  364. patente character varying(6) NOT NULL,
  365. ano_vehiculo smallint NOT NULL,
  366. marca character varying(20) NOT NULL,
  367. capacidad smallint NOT NULL
  368. );
  369. ALTER TABLE public.vehiculo OWNER TO cromer;
  370. --
  371. -- Name: total_vehiculos; Type: VIEW; Schema: public; Owner: cromer
  372. --
  373. CREATE VIEW public.total_vehiculos AS
  374. SELECT count(v.patente) AS totalveh
  375. FROM (((public.vehiculo v
  376. JOIN public.requerir_auto r ON (((r.patente)::text = (v.patente)::text)))
  377. JOIN public.tour t ON ((t.id_tour = r.id_tour)))
  378. JOIN public.asociado a ON ((t.id_tour = a.id_tour)))
  379. WHERE ((a.fecha_llegada >= '2018-01-01'::date) AND (a.fecha_llegada <= '2018-02-28'::date));
  380. ALTER TABLE public.total_vehiculos OWNER TO cromer;
  381. --
  382. -- Name: tour_descuentos; Type: VIEW; Schema: public; Owner: cromer
  383. --
  384. CREATE VIEW public.tour_descuentos AS
  385. SELECT
  386. NULL::integer AS idt,
  387. NULL::character varying(50) AS nombret,
  388. NULL::numeric AS totaldescuentos;
  389. ALTER TABLE public.tour_descuentos OWNER TO cromer;
  390. --
  391. -- Name: tour_id_tour_seq; Type: SEQUENCE; Schema: public; Owner: cromer
  392. --
  393. CREATE SEQUENCE public.tour_id_tour_seq
  394. AS integer
  395. START WITH 1
  396. INCREMENT BY 1
  397. NO MINVALUE
  398. NO MAXVALUE
  399. CACHE 1;
  400. ALTER TABLE public.tour_id_tour_seq OWNER TO cromer;
  401. --
  402. -- Name: tour_id_tour_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cromer
  403. --
  404. ALTER SEQUENCE public.tour_id_tour_seq OWNED BY public.tour.id_tour;
  405. --
  406. -- Name: turista; Type: TABLE; Schema: public; Owner: cromer
  407. --
  408. CREATE TABLE public.turista (
  409. rut_turista character varying(9) NOT NULL,
  410. nombre_turista character varying(50) NOT NULL,
  411. fecha_nacimento date NOT NULL,
  412. id_contacto integer
  413. );
  414. ALTER TABLE public.turista OWNER TO cromer;
  415. --
  416. -- Name: valores_tours; Type: VIEW; Schema: public; Owner: cromer
  417. --
  418. CREATE VIEW public.valores_tours AS
  419. SELECT
  420. NULL::integer AS idt,
  421. NULL::character varying(50) AS nombret,
  422. NULL::bigint AS totalventas;
  423. ALTER TABLE public.valores_tours OWNER TO cromer;
  424. --
  425. -- Name: categoria id_categoria; Type: DEFAULT; Schema: public; Owner: cromer
  426. --
  427. ALTER TABLE ONLY public.categoria ALTER COLUMN id_categoria SET DEFAULT nextval('public.categoria_id_categoria_seq'::regclass);
  428. --
  429. -- Name: ciudad id_ciudad; Type: DEFAULT; Schema: public; Owner: cromer
  430. --
  431. ALTER TABLE ONLY public.ciudad ALTER COLUMN id_ciudad SET DEFAULT nextval('public.ciudad_id_ciudad_seq'::regclass);
  432. --
  433. -- Name: contacto_emergencia id_contacto; Type: DEFAULT; Schema: public; Owner: cromer
  434. --
  435. ALTER TABLE ONLY public.contacto_emergencia ALTER COLUMN id_contacto SET DEFAULT nextval('public.contacto_emergencia_id_contacto_seq'::regclass);
  436. --
  437. -- Name: descuento id_descuento; Type: DEFAULT; Schema: public; Owner: cromer
  438. --
  439. ALTER TABLE ONLY public.descuento ALTER COLUMN id_descuento SET DEFAULT nextval('public.descuento_id_descuento_seq'::regclass);
  440. --
  441. -- Name: enfermedad id_enfermedad; Type: DEFAULT; Schema: public; Owner: cromer
  442. --
  443. ALTER TABLE ONLY public.enfermedad ALTER COLUMN id_enfermedad SET DEFAULT nextval('public.enfermedad_id_enfermedad_seq'::regclass);
  444. --
  445. -- Name: especialidad id_especialidad; Type: DEFAULT; Schema: public; Owner: cromer
  446. --
  447. ALTER TABLE ONLY public.especialidad ALTER COLUMN id_especialidad SET DEFAULT nextval('public.especialidad_id_especialidad_seq'::regclass);
  448. --
  449. -- Name: lugar id_lugar; Type: DEFAULT; Schema: public; Owner: cromer
  450. --
  451. ALTER TABLE ONLY public.lugar ALTER COLUMN id_lugar SET DEFAULT nextval('public.lugar_id_lugar_seq'::regclass);
  452. --
  453. -- Name: region id_region; Type: DEFAULT; Schema: public; Owner: cromer
  454. --
  455. ALTER TABLE ONLY public.region ALTER COLUMN id_region SET DEFAULT nextval('public.region_id_region_seq'::regclass);
  456. --
  457. -- Name: tour id_tour; Type: DEFAULT; Schema: public; Owner: cromer
  458. --
  459. ALTER TABLE ONLY public.tour ALTER COLUMN id_tour SET DEFAULT nextval('public.tour_id_tour_seq'::regclass);
  460. --
  461. -- Data for Name: arrienda; Type: TABLE DATA; Schema: public; Owner: cromer
  462. --
  463. COPY public.arrienda (patente, rut_empresa, precio, fecha_devolucion) FROM stdin;
  464. LJ58BV 56404537k 100000 2018-11-29
  465. AS45FE 566034578 120000 2018-11-29
  466. 49FD38 566003458 150000 2018-11-29
  467. \.
  468. --
  469. -- Data for Name: asociado; Type: TABLE DATA; Schema: public; Owner: cromer
  470. --
  471. COPY public.asociado (id_tour, id_lugar, fecha_llegada, hora_llegada, fecha_salida, hora_salida) FROM stdin;
  472. 1 1 2018-01-10 04:15:00 2018-01-10 05:15:00
  473. 2 2 2018-02-22 09:35:00 2018-02-22 10:35:00
  474. 3 3 2018-03-30 16:40:00 2018-03-30 19:10:00
  475. 3 4 2018-10-15 12:40:00 2018-10-15 13:10:00
  476. 1 1 2018-10-15 12:40:00 2018-10-15 13:10:00
  477. 3 4 2018-11-21 09:22:44 2018-11-21 10:30:22
  478. 1 1 2018-11-19 12:45:33 2018-11-19 15:33:11
  479. 38 7 2019-01-01 12:30:00 2019-01-03 14:40:00
  480. \.
  481. --
  482. -- Data for Name: categoria; Type: TABLE DATA; Schema: public; Owner: cromer
  483. --
  484. COPY public.categoria (id_categoria, descripcion_categoria) FROM stdin;
  485. 1 Coordinador
  486. 2 Speaker
  487. 3 Expert
  488. \.
  489. --
  490. -- Data for Name: ciudad; Type: TABLE DATA; Schema: public; Owner: cromer
  491. --
  492. COPY public.ciudad (id_ciudad, nombre_ciudad, id_region) FROM stdin;
  493. 1 Pensacola 1
  494. 2 Montgomery 2
  495. 3 Pheonix 3
  496. 4 Destin 1
  497. 5 Los Angeles 4
  498. 10 Cairo 9
  499. \.
  500. --
  501. -- Data for Name: contacto_emergencia; Type: TABLE DATA; Schema: public; Owner: cromer
  502. --
  503. COPY public.contacto_emergencia (id_contacto, telefono_emergencia, nombre_emergencia) FROM stdin;
  504. 1 56912345678 Chris Cromer
  505. 2 56913334578 John Cromer
  506. 3 56913984347 Tammy Cromer
  507. \.
  508. --
  509. -- Data for Name: descuento; Type: TABLE DATA; Schema: public; Owner: cromer
  510. --
  511. COPY public.descuento (id_descuento, descripcion_descuento, porcentaje) FROM stdin;
  512. 1 0-15 años 0.20
  513. 2 16-50 años 0.00
  514. 3 51 0.10
  515. 4 66 en adelante 0.30
  516. \.
  517. --
  518. -- Data for Name: empresa; Type: TABLE DATA; Schema: public; Owner: cromer
  519. --
  520. COPY public.empresa (rut_empresa, nombre_empresa, contacto, telefono) FROM stdin;
  521. 566034578 Hurtz John Jacob 56948904446
  522. 56404537k Rent-a-Car Jim Smith 56948904446
  523. 566003458 Car Rentals Dot Com Tony Stark 56948904446
  524. \.
  525. --
  526. -- Data for Name: enfermedad; Type: TABLE DATA; Schema: public; Owner: cromer
  527. --
  528. COPY public.enfermedad (id_enfermedad, descripcion_enfermedad) FROM stdin;
  529. 1 Heart Disease
  530. 2 Diabetes
  531. 3 Lung Cancer
  532. \.
  533. --
  534. -- Data for Name: especialidad; Type: TABLE DATA; Schema: public; Owner: cromer
  535. --
  536. COPY public.especialidad (id_especialidad, descripcion_especialidad) FROM stdin;
  537. 1 Climbing
  538. 2 History
  539. 3 Astronomy
  540. 4 Public Speaking
  541. \.
  542. --
  543. -- Data for Name: guia; Type: TABLE DATA; Schema: public; Owner: cromer
  544. --
  545. COPY public.guia (rut_guia, nombre_guia, calle, numero, id_ciudad) FROM stdin;
  546. 266304579 John Smith Edison Dr. 214 1
  547. 266404573 Jack Offer Jackson Ave. 1023 2
  548. 266444575 Mike Toga Madison Way 342 3
  549. \.
  550. --
  551. -- Data for Name: lugar; Type: TABLE DATA; Schema: public; Owner: cromer
  552. --
  553. COPY public.lugar (id_lugar, nombre_lugar, valor_entrada, nivel, id_ciudad) FROM stdin;
  554. 1 El Bio Bio 0 3 1
  555. 2 Lago San Pedro 10000 3 2
  556. 3 Atacama 30000 0 3
  557. 4 Kilamanjaro 30000 5 3
  558. 5 Pensacola Beach 10000 0 1
  559. 7 Pyramids 20000 1 10
  560. \.
  561. --
  562. -- Data for Name: participa; Type: TABLE DATA; Schema: public; Owner: cromer
  563. --
  564. COPY public.participa (id_tour, rut_guia, id_categoria) FROM stdin;
  565. 2 266304579 1
  566. 1 266404573 1
  567. 2 266404573 1
  568. 3 266444575 1
  569. \.
  570. --
  571. -- Data for Name: posee; Type: TABLE DATA; Schema: public; Owner: cromer
  572. --
  573. COPY public.posee (rut_guia, id_especialidad, nivel_especialidad) FROM stdin;
  574. 266304579 1 0
  575. 266304579 2 5
  576. 266304579 3 5
  577. 266304579 4 5
  578. 266404573 2 3
  579. 266404573 1 5
  580. 266444575 3 5
  581. \.
  582. --
  583. -- Data for Name: realiza; Type: TABLE DATA; Schema: public; Owner: cromer
  584. --
  585. COPY public.realiza (id_tour, rut_turista, id_descuento) FROM stdin;
  586. 3 173983808 2
  587. 4 173983808 1
  588. 3 194333579 2
  589. 2 194333579 2
  590. 4 194333579 1
  591. 2 232322225 2
  592. 1 226634576 2
  593. 4 226634576 3
  594. \.
  595. --
  596. -- Data for Name: region; Type: TABLE DATA; Schema: public; Owner: cromer
  597. --
  598. COPY public.region (id_region, nombre_region) FROM stdin;
  599. 1 Florida
  600. 2 Alabama
  601. 3 Arizona
  602. 4 California
  603. 9 Egypt
  604. \.
  605. --
  606. -- Data for Name: requerir_auto; Type: TABLE DATA; Schema: public; Owner: cromer
  607. --
  608. COPY public.requerir_auto (id_tour, patente, chofer) FROM stdin;
  609. 1 LJ58BV Dominic Toretto
  610. 1 AS45FE Luke Hobbs
  611. 1 49FD38 Roman Pearce
  612. 4 AS45FE Dale Earnheart Jr.
  613. 38 LJ58BV Alejandra Chacano
  614. \.
  615. --
  616. -- Data for Name: tiene_enfermedad; Type: TABLE DATA; Schema: public; Owner: cromer
  617. --
  618. COPY public.tiene_enfermedad (rut_turista, id_enfermedad) FROM stdin;
  619. 173983808 3
  620. 194333579 2
  621. 226634576 1
  622. \.
  623. --
  624. -- Data for Name: tour; Type: TABLE DATA; Schema: public; Owner: cromer
  625. --
  626. COPY public.tour (id_tour, nombre_tour, costo_indiv, costo_grupal, minima_personas, id_ciudad) FROM stdin;
  627. 1 Los Rios 500000 350000 2 1
  628. 3 Peru 400000 110000 2 3
  629. 4 San Pedro 400000 110000 2 3
  630. 38 Egypt 500000 400000 10 10
  631. 2 Valle de la Luna 300000 120000 2 2
  632. \.
  633. --
  634. -- Data for Name: turista; Type: TABLE DATA; Schema: public; Owner: cromer
  635. --
  636. COPY public.turista (rut_turista, nombre_turista, fecha_nacimento, id_contacto) FROM stdin;
  637. 173983808 Jimmy Johnson 1955-01-01 3
  638. 194333579 Tommy Gunner 1990-06-02 2
  639. 232322225 Jimmy Olson 1985-04-03 1
  640. 226634576 Jack Asserton 1985-02-23 1
  641. \.
  642. --
  643. -- Data for Name: vehiculo; Type: TABLE DATA; Schema: public; Owner: cromer
  644. --
  645. COPY public.vehiculo (patente, ano_vehiculo, marca, capacidad) FROM stdin;
  646. TASDF8 2001 Toyota 10
  647. LJ58BV 2002 Mazda 20
  648. AS45FE 2017 Chevy 4
  649. 49FD38 2001 Subaru 10
  650. \.
  651. --
  652. -- Name: categoria_id_categoria_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  653. --
  654. SELECT pg_catalog.setval('public.categoria_id_categoria_seq', 3, true);
  655. --
  656. -- Name: ciudad_id_ciudad_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  657. --
  658. SELECT pg_catalog.setval('public.ciudad_id_ciudad_seq', 11, true);
  659. --
  660. -- Name: contacto_emergencia_id_contacto_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  661. --
  662. SELECT pg_catalog.setval('public.contacto_emergencia_id_contacto_seq', 3, true);
  663. --
  664. -- Name: descuento_id_descuento_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  665. --
  666. SELECT pg_catalog.setval('public.descuento_id_descuento_seq', 4, true);
  667. --
  668. -- Name: enfermedad_id_enfermedad_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  669. --
  670. SELECT pg_catalog.setval('public.enfermedad_id_enfermedad_seq', 3, true);
  671. --
  672. -- Name: especialidad_id_especialidad_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  673. --
  674. SELECT pg_catalog.setval('public.especialidad_id_especialidad_seq', 4, true);
  675. --
  676. -- Name: lugar_id_lugar_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  677. --
  678. SELECT pg_catalog.setval('public.lugar_id_lugar_seq', 7, true);
  679. --
  680. -- Name: region_id_region_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  681. --
  682. SELECT pg_catalog.setval('public.region_id_region_seq', 10, true);
  683. --
  684. -- Name: tour_id_tour_seq; Type: SEQUENCE SET; Schema: public; Owner: cromer
  685. --
  686. SELECT pg_catalog.setval('public.tour_id_tour_seq', 45, true);
  687. --
  688. -- Name: categoria categoria_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  689. --
  690. ALTER TABLE ONLY public.categoria
  691. ADD CONSTRAINT categoria_pkey PRIMARY KEY (id_categoria);
  692. --
  693. -- Name: ciudad ciudad_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  694. --
  695. ALTER TABLE ONLY public.ciudad
  696. ADD CONSTRAINT ciudad_pkey PRIMARY KEY (id_ciudad);
  697. --
  698. -- Name: contacto_emergencia contacto_emergencia_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  699. --
  700. ALTER TABLE ONLY public.contacto_emergencia
  701. ADD CONSTRAINT contacto_emergencia_pkey PRIMARY KEY (id_contacto);
  702. --
  703. -- Name: descuento descuento_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  704. --
  705. ALTER TABLE ONLY public.descuento
  706. ADD CONSTRAINT descuento_pkey PRIMARY KEY (id_descuento);
  707. --
  708. -- Name: empresa empresa_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  709. --
  710. ALTER TABLE ONLY public.empresa
  711. ADD CONSTRAINT empresa_pkey PRIMARY KEY (rut_empresa);
  712. --
  713. -- Name: enfermedad enfermedad_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  714. --
  715. ALTER TABLE ONLY public.enfermedad
  716. ADD CONSTRAINT enfermedad_pkey PRIMARY KEY (id_enfermedad);
  717. --
  718. -- Name: especialidad especialidad_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  719. --
  720. ALTER TABLE ONLY public.especialidad
  721. ADD CONSTRAINT especialidad_pkey PRIMARY KEY (id_especialidad);
  722. --
  723. -- Name: guia guia_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  724. --
  725. ALTER TABLE ONLY public.guia
  726. ADD CONSTRAINT guia_pkey PRIMARY KEY (rut_guia);
  727. --
  728. -- Name: lugar lugar_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  729. --
  730. ALTER TABLE ONLY public.lugar
  731. ADD CONSTRAINT lugar_pkey PRIMARY KEY (id_lugar);
  732. --
  733. -- Name: region region_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  734. --
  735. ALTER TABLE ONLY public.region
  736. ADD CONSTRAINT region_pkey PRIMARY KEY (id_region);
  737. --
  738. -- Name: tour tour_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  739. --
  740. ALTER TABLE ONLY public.tour
  741. ADD CONSTRAINT tour_pkey PRIMARY KEY (id_tour);
  742. --
  743. -- Name: turista turista_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  744. --
  745. ALTER TABLE ONLY public.turista
  746. ADD CONSTRAINT turista_pkey PRIMARY KEY (rut_turista);
  747. --
  748. -- Name: vehiculo vehiculo_pkey; Type: CONSTRAINT; Schema: public; Owner: cromer
  749. --
  750. ALTER TABLE ONLY public.vehiculo
  751. ADD CONSTRAINT vehiculo_pkey PRIMARY KEY (patente);
  752. --
  753. -- Name: total_coordinadores _RETURN; Type: RULE; Schema: public; Owner: cromer
  754. --
  755. CREATE OR REPLACE VIEW public.total_coordinadores AS
  756. SELECT t.id_tour AS idt,
  757. t.nombre_tour AS nombret,
  758. count(DISTINCT p.rut_guia) AS totalcoordinadores
  759. FROM ((((((public.participa p
  760. JOIN public.tour t ON ((t.id_tour = p.id_tour)))
  761. JOIN public.guia g ON (((g.rut_guia)::text = (p.rut_guia)::text)))
  762. JOIN public.categoria c ON ((c.id_categoria = p.id_categoria)))
  763. JOIN public.posee p2 ON (((g.rut_guia)::text = (p2.rut_guia)::text)))
  764. JOIN public.asociado a ON ((a.id_tour = t.id_tour)))
  765. JOIN public.lugar l ON ((l.id_lugar = a.id_lugar)))
  766. WHERE ((c.descripcion_categoria = 'Coordinador'::text) AND (EXISTS ( SELECT
  767. FROM public.lugar
  768. WHERE ((lugar.id_lugar = l.id_lugar) AND (l.nivel = 3)))) AND (( SELECT count(posee.rut_guia) AS count
  769. FROM public.posee
  770. WHERE ((posee.rut_guia)::text = (g.rut_guia)::text)) > 3))
  771. GROUP BY t.id_tour;
  772. --
  773. -- Name: total_turistas _RETURN; Type: RULE; Schema: public; Owner: cromer
  774. --
  775. CREATE OR REPLACE VIEW public.total_turistas AS
  776. SELECT t.id_tour AS idt,
  777. t.nombre_tour AS nombret,
  778. count(r.rut_turista) AS totalturistas
  779. FROM (((public.tour t
  780. JOIN public.realiza r ON ((t.id_tour = r.id_tour)))
  781. JOIN public.asociado a ON ((t.id_tour = a.id_tour)))
  782. JOIN public.lugar l ON ((a.id_lugar = l.id_lugar)))
  783. WHERE ((EXISTS ( SELECT lugar.id_lugar
  784. FROM public.lugar
  785. WHERE ((lugar.id_lugar = l.id_lugar) AND (lugar.nivel >= 5)))) AND ((a.fecha_llegada >= '2018-10-01'::date) AND (a.fecha_llegada <= '2018-10-31'::date)) AND (NOT (EXISTS ( SELECT tiene_enfermedad.id_enfermedad
  786. FROM public.tiene_enfermedad
  787. WHERE (((tiene_enfermedad.rut_turista)::text = (r.rut_turista)::text) AND ((tiene_enfermedad.id_enfermedad = 1) OR (tiene_enfermedad.id_enfermedad = 3)))))))
  788. GROUP BY t.id_tour;
  789. --
  790. -- Name: tour_descuentos _RETURN; Type: RULE; Schema: public; Owner: cromer
  791. --
  792. CREATE OR REPLACE VIEW public.tour_descuentos AS
  793. SELECT t.id_tour AS idt,
  794. t.nombre_tour AS nombret,
  795. sum(DISTINCT ((( SELECT descuento.porcentaje
  796. FROM public.descuento
  797. WHERE (descuento.id_descuento = r.id_descuento)) * (( SELECT count(realiza.rut_turista) AS count
  798. FROM public.realiza
  799. WHERE ((realiza.id_tour = r.id_tour) AND (realiza.id_descuento = r.id_descuento))))::numeric) * (
  800. CASE
  801. WHEN (t.minima_personas <= ( SELECT count(realiza.rut_turista) AS count
  802. FROM public.realiza
  803. WHERE (realiza.id_tour = t.id_tour))) THEN ( SELECT tour.costo_grupal
  804. FROM public.tour
  805. WHERE (tour.id_tour = t.id_tour))
  806. ELSE ( SELECT tour.costo_indiv
  807. FROM public.tour
  808. WHERE (tour.id_tour = t.id_tour))
  809. END)::numeric)) AS totaldescuentos
  810. FROM (public.tour t
  811. JOIN public.realiza r ON ((t.id_tour = r.id_tour)))
  812. WHERE (r.id_descuento <> 2)
  813. GROUP BY t.id_tour;
  814. --
  815. -- Name: valores_tours _RETURN; Type: RULE; Schema: public; Owner: cromer
  816. --
  817. CREATE OR REPLACE VIEW public.valores_tours AS
  818. SELECT t.id_tour AS idt,
  819. t.nombre_tour AS nombret,
  820. (
  821. CASE
  822. WHEN (t.minima_personas <= ( SELECT count(realiza.rut_turista) AS count
  823. FROM public.realiza
  824. WHERE (realiza.id_tour = t.id_tour))) THEN ( SELECT tour.costo_grupal
  825. FROM public.tour
  826. WHERE (tour.id_tour = t.id_tour))
  827. ELSE ( SELECT tour.costo_indiv
  828. FROM public.tour
  829. WHERE (tour.id_tour = t.id_tour))
  830. END * count(r.rut_turista)) AS totalventas
  831. FROM (public.tour t
  832. JOIN public.realiza r ON ((t.id_tour = r.id_tour)))
  833. GROUP BY t.id_tour;
  834. --
  835. -- Name: arrienda arrienda_patente_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  836. --
  837. ALTER TABLE ONLY public.arrienda
  838. ADD CONSTRAINT arrienda_patente_fkey FOREIGN KEY (patente) REFERENCES public.vehiculo(patente) ON UPDATE CASCADE ON DELETE RESTRICT;
  839. --
  840. -- Name: arrienda arrienda_rut_empresa_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  841. --
  842. ALTER TABLE ONLY public.arrienda
  843. ADD CONSTRAINT arrienda_rut_empresa_fkey FOREIGN KEY (rut_empresa) REFERENCES public.empresa(rut_empresa) ON DELETE RESTRICT;
  844. --
  845. -- Name: asociado asociado_id_lugar_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  846. --
  847. ALTER TABLE ONLY public.asociado
  848. ADD CONSTRAINT asociado_id_lugar_fkey FOREIGN KEY (id_lugar) REFERENCES public.lugar(id_lugar) ON DELETE RESTRICT;
  849. --
  850. -- Name: asociado asociado_id_tour_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  851. --
  852. ALTER TABLE ONLY public.asociado
  853. ADD CONSTRAINT asociado_id_tour_fkey FOREIGN KEY (id_tour) REFERENCES public.tour(id_tour) ON DELETE RESTRICT;
  854. --
  855. -- Name: ciudad ciudad_id_region_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  856. --
  857. ALTER TABLE ONLY public.ciudad
  858. ADD CONSTRAINT ciudad_id_region_fkey FOREIGN KEY (id_region) REFERENCES public.region(id_region) ON DELETE RESTRICT;
  859. --
  860. -- Name: guia guia_id_ciudad_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  861. --
  862. ALTER TABLE ONLY public.guia
  863. ADD CONSTRAINT guia_id_ciudad_fkey FOREIGN KEY (id_ciudad) REFERENCES public.ciudad(id_ciudad) ON DELETE RESTRICT;
  864. --
  865. -- Name: lugar lugar_id_ciudad_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  866. --
  867. ALTER TABLE ONLY public.lugar
  868. ADD CONSTRAINT lugar_id_ciudad_fkey FOREIGN KEY (id_ciudad) REFERENCES public.ciudad(id_ciudad) ON DELETE RESTRICT;
  869. --
  870. -- Name: participa participa_id_categoria_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  871. --
  872. ALTER TABLE ONLY public.participa
  873. ADD CONSTRAINT participa_id_categoria_fkey FOREIGN KEY (id_categoria) REFERENCES public.categoria(id_categoria) ON DELETE RESTRICT;
  874. --
  875. -- Name: participa participa_id_tour_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  876. --
  877. ALTER TABLE ONLY public.participa
  878. ADD CONSTRAINT participa_id_tour_fkey FOREIGN KEY (id_tour) REFERENCES public.tour(id_tour) ON DELETE RESTRICT;
  879. --
  880. -- Name: participa participa_rut_guia_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  881. --
  882. ALTER TABLE ONLY public.participa
  883. ADD CONSTRAINT participa_rut_guia_fkey FOREIGN KEY (rut_guia) REFERENCES public.guia(rut_guia) ON UPDATE CASCADE ON DELETE RESTRICT;
  884. --
  885. -- Name: posee posee_id_especialidad_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  886. --
  887. ALTER TABLE ONLY public.posee
  888. ADD CONSTRAINT posee_id_especialidad_fkey FOREIGN KEY (id_especialidad) REFERENCES public.especialidad(id_especialidad) ON DELETE RESTRICT;
  889. --
  890. -- Name: posee posee_rut_guia_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  891. --
  892. ALTER TABLE ONLY public.posee
  893. ADD CONSTRAINT posee_rut_guia_fkey FOREIGN KEY (rut_guia) REFERENCES public.guia(rut_guia) ON UPDATE CASCADE ON DELETE RESTRICT;
  894. --
  895. -- Name: realiza realiza_id_descuento_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  896. --
  897. ALTER TABLE ONLY public.realiza
  898. ADD CONSTRAINT realiza_id_descuento_fkey FOREIGN KEY (id_descuento) REFERENCES public.descuento(id_descuento) ON DELETE RESTRICT;
  899. --
  900. -- Name: realiza realiza_id_tour_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  901. --
  902. ALTER TABLE ONLY public.realiza
  903. ADD CONSTRAINT realiza_id_tour_fkey FOREIGN KEY (id_tour) REFERENCES public.tour(id_tour) ON DELETE RESTRICT;
  904. --
  905. -- Name: realiza realiza_rut_turista_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  906. --
  907. ALTER TABLE ONLY public.realiza
  908. ADD CONSTRAINT realiza_rut_turista_fkey FOREIGN KEY (rut_turista) REFERENCES public.turista(rut_turista) ON UPDATE CASCADE ON DELETE RESTRICT;
  909. --
  910. -- Name: requerir_auto requerir_auto_id_tour_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  911. --
  912. ALTER TABLE ONLY public.requerir_auto
  913. ADD CONSTRAINT requerir_auto_id_tour_fkey FOREIGN KEY (id_tour) REFERENCES public.tour(id_tour) ON DELETE RESTRICT;
  914. --
  915. -- Name: requerir_auto requerir_auto_patente_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  916. --
  917. ALTER TABLE ONLY public.requerir_auto
  918. ADD CONSTRAINT requerir_auto_patente_fkey FOREIGN KEY (patente) REFERENCES public.vehiculo(patente) ON UPDATE CASCADE ON DELETE RESTRICT;
  919. --
  920. -- Name: tiene_enfermedad tiene_enfermedad_id_enfermedad_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  921. --
  922. ALTER TABLE ONLY public.tiene_enfermedad
  923. ADD CONSTRAINT tiene_enfermedad_id_enfermedad_fkey FOREIGN KEY (id_enfermedad) REFERENCES public.enfermedad(id_enfermedad) ON DELETE RESTRICT;
  924. --
  925. -- Name: tiene_enfermedad tiene_enfermedad_rut_turista_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  926. --
  927. ALTER TABLE ONLY public.tiene_enfermedad
  928. ADD CONSTRAINT tiene_enfermedad_rut_turista_fkey FOREIGN KEY (rut_turista) REFERENCES public.turista(rut_turista) ON UPDATE CASCADE ON DELETE RESTRICT;
  929. --
  930. -- Name: tour tour_id_ciudad_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  931. --
  932. ALTER TABLE ONLY public.tour
  933. ADD CONSTRAINT tour_id_ciudad_fkey FOREIGN KEY (id_ciudad) REFERENCES public.ciudad(id_ciudad) ON DELETE RESTRICT;
  934. --
  935. -- Name: turista turista_id_contacto_fkey; Type: FK CONSTRAINT; Schema: public; Owner: cromer
  936. --
  937. ALTER TABLE ONLY public.turista
  938. ADD CONSTRAINT turista_id_contacto_fkey FOREIGN KEY (id_contacto) REFERENCES public.contacto_emergencia(id_contacto) ON DELETE RESTRICT;
  939. --
  940. -- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
  941. --
  942. GRANT USAGE ON SCHEMA public TO bdd;
  943. --
  944. -- Name: TABLE arrienda; Type: ACL; Schema: public; Owner: cromer
  945. --
  946. GRANT ALL ON TABLE public.arrienda TO bdd;
  947. --
  948. -- Name: TABLE asociado; Type: ACL; Schema: public; Owner: cromer
  949. --
  950. GRANT ALL ON TABLE public.asociado TO bdd;
  951. --
  952. -- Name: TABLE categoria; Type: ACL; Schema: public; Owner: cromer
  953. --
  954. GRANT ALL ON TABLE public.categoria TO bdd;
  955. --
  956. -- Name: SEQUENCE categoria_id_categoria_seq; Type: ACL; Schema: public; Owner: cromer
  957. --
  958. GRANT ALL ON SEQUENCE public.categoria_id_categoria_seq TO bdd;
  959. --
  960. -- Name: TABLE ciudad; Type: ACL; Schema: public; Owner: cromer
  961. --
  962. GRANT ALL ON TABLE public.ciudad TO bdd;
  963. --
  964. -- Name: SEQUENCE ciudad_id_ciudad_seq; Type: ACL; Schema: public; Owner: cromer
  965. --
  966. GRANT ALL ON SEQUENCE public.ciudad_id_ciudad_seq TO bdd;
  967. --
  968. -- Name: TABLE contacto_emergencia; Type: ACL; Schema: public; Owner: cromer
  969. --
  970. GRANT ALL ON TABLE public.contacto_emergencia TO bdd;
  971. --
  972. -- Name: SEQUENCE contacto_emergencia_id_contacto_seq; Type: ACL; Schema: public; Owner: cromer
  973. --
  974. GRANT ALL ON SEQUENCE public.contacto_emergencia_id_contacto_seq TO bdd;
  975. --
  976. -- Name: TABLE descuento; Type: ACL; Schema: public; Owner: cromer
  977. --
  978. GRANT ALL ON TABLE public.descuento TO bdd;
  979. --
  980. -- Name: SEQUENCE descuento_id_descuento_seq; Type: ACL; Schema: public; Owner: cromer
  981. --
  982. GRANT ALL ON SEQUENCE public.descuento_id_descuento_seq TO bdd;
  983. --
  984. -- Name: TABLE empresa; Type: ACL; Schema: public; Owner: cromer
  985. --
  986. GRANT ALL ON TABLE public.empresa TO bdd;
  987. --
  988. -- Name: TABLE enfermedad; Type: ACL; Schema: public; Owner: cromer
  989. --
  990. GRANT ALL ON TABLE public.enfermedad TO bdd;
  991. --
  992. -- Name: SEQUENCE enfermedad_id_enfermedad_seq; Type: ACL; Schema: public; Owner: cromer
  993. --
  994. GRANT ALL ON SEQUENCE public.enfermedad_id_enfermedad_seq TO bdd;
  995. --
  996. -- Name: TABLE especialidad; Type: ACL; Schema: public; Owner: cromer
  997. --
  998. GRANT ALL ON TABLE public.especialidad TO bdd;
  999. --
  1000. -- Name: SEQUENCE especialidad_id_especialidad_seq; Type: ACL; Schema: public; Owner: cromer
  1001. --
  1002. GRANT ALL ON SEQUENCE public.especialidad_id_especialidad_seq TO bdd;
  1003. --
  1004. -- Name: TABLE guia; Type: ACL; Schema: public; Owner: cromer
  1005. --
  1006. GRANT ALL ON TABLE public.guia TO bdd;
  1007. --
  1008. -- Name: TABLE lugar; Type: ACL; Schema: public; Owner: cromer
  1009. --
  1010. GRANT ALL ON TABLE public.lugar TO bdd;
  1011. --
  1012. -- Name: SEQUENCE lugar_id_lugar_seq; Type: ACL; Schema: public; Owner: cromer
  1013. --
  1014. GRANT ALL ON SEQUENCE public.lugar_id_lugar_seq TO bdd;
  1015. --
  1016. -- Name: TABLE participa; Type: ACL; Schema: public; Owner: cromer
  1017. --
  1018. GRANT ALL ON TABLE public.participa TO bdd;
  1019. --
  1020. -- Name: TABLE posee; Type: ACL; Schema: public; Owner: cromer
  1021. --
  1022. GRANT ALL ON TABLE public.posee TO bdd;
  1023. --
  1024. -- Name: TABLE realiza; Type: ACL; Schema: public; Owner: cromer
  1025. --
  1026. GRANT ALL ON TABLE public.realiza TO bdd;
  1027. --
  1028. -- Name: TABLE region; Type: ACL; Schema: public; Owner: cromer
  1029. --
  1030. GRANT ALL ON TABLE public.region TO bdd;
  1031. --
  1032. -- Name: SEQUENCE region_id_region_seq; Type: ACL; Schema: public; Owner: cromer
  1033. --
  1034. GRANT ALL ON SEQUENCE public.region_id_region_seq TO bdd;
  1035. --
  1036. -- Name: TABLE tour; Type: ACL; Schema: public; Owner: cromer
  1037. --
  1038. GRANT ALL ON TABLE public.tour TO bdd;
  1039. --
  1040. -- Name: TABLE regiones_sindescuento; Type: ACL; Schema: public; Owner: cromer
  1041. --
  1042. GRANT ALL ON TABLE public.regiones_sindescuento TO bdd;
  1043. --
  1044. -- Name: TABLE requerir_auto; Type: ACL; Schema: public; Owner: cromer
  1045. --
  1046. GRANT ALL ON TABLE public.requerir_auto TO bdd;
  1047. --
  1048. -- Name: TABLE tiene_enfermedad; Type: ACL; Schema: public; Owner: cromer
  1049. --
  1050. GRANT ALL ON TABLE public.tiene_enfermedad TO bdd;
  1051. --
  1052. -- Name: TABLE total_arriendos; Type: ACL; Schema: public; Owner: cromer
  1053. --
  1054. GRANT ALL ON TABLE public.total_arriendos TO bdd;
  1055. --
  1056. -- Name: TABLE total_coordinadores; Type: ACL; Schema: public; Owner: cromer
  1057. --
  1058. GRANT ALL ON TABLE public.total_coordinadores TO bdd;
  1059. --
  1060. -- Name: TABLE total_turistas; Type: ACL; Schema: public; Owner: cromer
  1061. --
  1062. GRANT ALL ON TABLE public.total_turistas TO bdd;
  1063. --
  1064. -- Name: TABLE vehiculo; Type: ACL; Schema: public; Owner: cromer
  1065. --
  1066. GRANT ALL ON TABLE public.vehiculo TO bdd;
  1067. --
  1068. -- Name: TABLE total_vehiculos; Type: ACL; Schema: public; Owner: cromer
  1069. --
  1070. GRANT ALL ON TABLE public.total_vehiculos TO bdd;
  1071. --
  1072. -- Name: TABLE tour_descuentos; Type: ACL; Schema: public; Owner: cromer
  1073. --
  1074. GRANT ALL ON TABLE public.tour_descuentos TO bdd;
  1075. --
  1076. -- Name: SEQUENCE tour_id_tour_seq; Type: ACL; Schema: public; Owner: cromer
  1077. --
  1078. GRANT ALL ON SEQUENCE public.tour_id_tour_seq TO bdd;
  1079. --
  1080. -- Name: TABLE turista; Type: ACL; Schema: public; Owner: cromer
  1081. --
  1082. GRANT ALL ON TABLE public.turista TO bdd;
  1083. --
  1084. -- Name: TABLE valores_tours; Type: ACL; Schema: public; Owner: cromer
  1085. --
  1086. GRANT ALL ON TABLE public.valores_tours TO bdd;
  1087. --
  1088. -- PostgreSQL database dump complete
  1089. --