{"action":"reopened","issue":{"url":"https://api.github.com/repos/DiegoMendozaVera/SQL-LAB/issues/2","repository_url":"https://api.github.com/repos/DiegoMendozaVera/SQL-LAB","labels_url":"https://api.github.com/repos/DiegoMendozaVera/SQL-LAB/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/DiegoMendozaVera/SQL-LAB/issues/2/comments","events_url":"https://api.github.com/repos/DiegoMendozaVera/SQL-LAB/issues/2/events","html_url":"https://github.com/DiegoMendozaVera/SQL-LAB/issues/2","id":332533704,"node_id":"MDU6SXNzdWUzMzI1MzM3MDQ=","number":2,"title":"LAB 5 INIT","user":{"login":"DiegoMendozaVera","id":38264312,"node_id":"MDQ6VXNlcjM4MjY0MzEy","avatar_url":"https://avatars0.githubusercontent.com/u/38264312?v=4","gravatar_id":"","url":"https://api.github.com/users/DiegoMendozaVera","html_url":"https://github.com/DiegoMendozaVera","followers_url":"https://api.github.com/users/DiegoMendozaVera/followers","following_url":"https://api.github.com/users/DiegoMendozaVera/following{/other_user}","gists_url":"https://api.github.com/users/DiegoMendozaVera/gists{/gist_id}","starred_url":"https://api.github.com/users/DiegoMendozaVera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DiegoMendozaVera/subscriptions","organizations_url":"https://api.github.com/users/DiegoMendozaVera/orgs","repos_url":"https://api.github.com/users/DiegoMendozaVera/repos","events_url":"https://api.github.com/users/DiegoMendozaVera/events{/privacy}","received_events_url":"https://api.github.com/users/DiegoMendozaVera/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-14T19:27:58Z","updated_at":"2018-06-14T19:41:12Z","closed_at":null,"author_association":"OWNER","body":"/creacion de tablas/\r\nDROP table socio;\r\n\r\nCREATE TABLE socio(\r\nrut_socio NUMBER(8),\r\nrut_socio_ppal NUMBER(8) NULL,\r\nnombre VARCHAR2(30),\r\ndireccion VARCHAR2(30),\r\nfono NUMBER(9),\r\nvalor_max_prest number(8),\r\ntipo char(1)\r\n);\r\n\r\nDROP TABLE pais;\r\n\r\nCREATE TABLE pais(\r\nid_pais NUMBER(8),\r\nnom_pais VARCHAR2(30)\r\n);\r\n\r\nDROP TABLE director;\r\n\r\nCREATE TABLE director(\r\nid_director NUMBER(8),\r\nnom_director varchar2(30)\r\n);\r\n\r\nDROP TABLE categoria;\r\n\r\nCREATE TABLE categoria(\r\nid_categoria NUMBER(8),\r\nnom_categoria VARCHAR2(30),\r\nprecio number(8),\r\ndias_prestamo number(2)\r\n);\r\n\r\n/* creacion de claves*/\r\nalter table socio\r\nadd constraint pk_rut_soc primary key (rut_socio);\r\n\r\nalter table pais\r\nadd constraint pk_pais primary key (id_pais);\r\n\r\nalter table director\r\nadd constraint pk_director primary key (id_director);\r\n\r\nalter table categoria\r\nadd constraint pk_categoria primary key (id_categoria);\r\n\r\nALTER TABLE SOCIO\r\nADD CONSTRAINT FK_SOC_SOCP FOREIGN KEY (RUT_SOCIO_PPAL)\r\nREFERENCES SOCIO(RUT_SOCIO);\r\n\r\n/restricciones/\r\nalter table prestamo\r\nadd check (estado in ('P','D','A'));\r\n\r\nalter table copia\r\nadd check (estado in ('P','D'));\r\n\r\nalter table titulo\r\nADD CHECK (genero BETWEEN 1 AND 5);\r\n\r\nALTER TABLE prestamo\r\nADD CHECK (FECHA_termino >= FECHA_inicio)\r\nADD CHECK (FECHA_devolucion >= FECHA_inicio);\r\n\r\nALTER TABLE SOCIO\r\nADD CHECK (TIPO IN ('P','A'));\r\n\r\nCREATE TABLE TITULO(\r\nCOD_TITULO NUMBER(3),\r\nNOM_TITULO VARCHAR2(30),\r\nID_DIRECTOR NUMBER(3),\r\nID_PAIS NUMBER(3),\r\nID_CATEGORIA NUMBER(3),\r\nGENERO CHAR(1),\r\nANNO NUMBER(4),\r\nDESCRIPCION VARCHAR2(50)\r\n);\r\n\r\nCREATE TABLE COPIA(\r\nCOD_COPIA NUMBER(3),\r\nCOD_TITULO NUMBER(3),\r\nESTADO CHAR(1)\r\n);\r\n\r\nCREATE TABLE PRESTAMO(\r\nRUT_SOCIO NUMBER(8),\r\nFECHA_INICIO DATE,\r\nCOD_COPIA NUMBER(3),\r\nFECHA_TERMINO DATE,\r\nFECHA_DEVOLUCION DATE,\r\nESTADO CHAR(1)\r\n);\r\n\r\nALTER TABLE COPIA\r\nADD PRIMARY KEY(COD_COPIA);\r\n\r\nALTER TABLE PRESTAMO\r\nADD PRIMARY KEY(RUT_SOCIO,FECHA_INICIO,COD_COPIA);\r\n\r\nALTER TABLE PRESTAMO\r\nADD FOREIGN KEY (RUT_SOCIO) REFERENCES SOCIO(RUT_SOCIO);\r\n\r\nALTER TABLE PRESTAMO\r\nADD FOREIGN KEY (COD_COPIA) REFERENCES COPIA(COD_COPIA);\r\n\r\nALTER TABLE TITULO\r\nADD PRIMARY KEY(COD_TITULO);\r\n\r\nALTER TABLE DIRECTOR\r\nADD FOREIGN KEY (ID_DIRECTOR) REFERENCES DIRECTOR(ID_DIRECTOR);\r\n\r\nALTER TABLE TITULO\r\nADD FOREIGN KEY (ID_DIRECTOR) REFERENCES DIRECTOR(ID_DIRECTOR);\r\n\r\nALTER TABLE TITULO\r\nADD FOREIGN KEY (ID_PAIS) REFERENCES PAIS(ID_PAIS);\r\n\r\nALTER TABLE TITULO\r\nADD FOREIGN KEY (ID_CATEGORIA) REFERENCES CATEGORIA(ID_CATEGORIA);\r\nLAB5.txt\r\n\r\n"}}
{"actor":{"display_login":"DiegoMendozaVera"}}