--------------------------------------------------------
-- Archivo creado  - jueves-diciembre-03-2020   
--------------------------------------------------------
--------------------------------------------------------
--  DDL for Table ACTOR
--------------------------------------------------------

  CREATE TABLE "ACTOR" 
   (	"ID_ACTOR" NUMBER(*,0), 
	"NOMBRE" VARCHAR2(45 BYTE), 
	"APELLIDOS" VARCHAR2(45 BYTE), 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table ACTOR_PELICULA
--------------------------------------------------------

  CREATE TABLE "ACTOR_PELICULA" 
   (	"ID_ACTOR" NUMBER(*,0), 
	"ID_PELICULA" NUMBER(*,0), 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table ALQUILER
--------------------------------------------------------

  CREATE TABLE "ALQUILER" 
   (	"ID_ALQUILER" NUMBER(*,0), 
	"FECHA_ALQUILER" DATE, 
	"ID_INVENTARIO" NUMBER(*,0), 
	"ID_CLIENTE" NUMBER(*,0), 
	"FECHA_DEVOL" DATE DEFAULT NULL, 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table CATEGORIA
--------------------------------------------------------

  CREATE TABLE "CATEGORIA" 
   (	"ID_CATEGORIA" NUMBER(*,0), 
	"NOMBRE" VARCHAR2(25 BYTE), 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table CATEGORIA_PELICULA
--------------------------------------------------------

  CREATE TABLE "CATEGORIA_PELICULA" 
   (	"ID_PELICULA" NUMBER(*,0), 
	"ID_CATEGORIA" NUMBER(*,0), 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table CLIENTE
--------------------------------------------------------

  CREATE TABLE "CLIENTE" 
   (	"ID_CLIENTE" NUMBER(*,0), 
	"ID_TIENDA" NUMBER(*,0), 
	"NOMBRE" VARCHAR2(45 BYTE), 
	"APELLIDOS" VARCHAR2(45 BYTE), 
	"EMAIL" VARCHAR2(50 BYTE) DEFAULT NULL, 
	"ID_DIRECCION" NUMBER(*,0), 
	"ACTIVO" CHAR(1 BYTE) DEFAULT 'Y', 
	"FECHA_CREACION" DATE, 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table IDIOMA
--------------------------------------------------------

  CREATE TABLE "IDIOMA" 
   (	"ID_IDIOMA" NUMBER(*,0), 
	"NOMBRE" CHAR(20 BYTE), 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table INVENTARIO
--------------------------------------------------------

  CREATE TABLE "INVENTARIO" 
   (	"ID_INVENTARIO" NUMBER(*,0), 
	"ID_PELICULA" NUMBER(*,0), 
	"ID_TIENDA" NUMBER(*,0), 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  DDL for Table PELICULA
--------------------------------------------------------

  CREATE TABLE "PELICULA" 
   (	"ID_PELICULA" NUMBER(*,0), 
	"TITULO" VARCHAR2(255 BYTE), 
	"DESCRIPCION" CLOB DEFAULT NULL, 
	"ANO" VARCHAR2(4 BYTE) DEFAULT NULL, 
	"ID_IDIOMA" NUMBER(*,0), 
	"ID_IDIOMA_ORIGINAL" NUMBER(*,0) DEFAULT NULL, 
	"DURACION_ALQUILER" NUMBER(*,0) DEFAULT 3, 
	"TARIFA_ALQUILER" NUMBER(4,2) DEFAULT 4.99, 
	"DURACION" NUMBER(*,0) DEFAULT NULL, 
	"COSTO_REPOSICION" NUMBER(5,2) DEFAULT 19.99, 
	"CLASIFICACION" VARCHAR2(10 BYTE) DEFAULT 'G', 
	"CARACTERICITCAS_ESPECIALES" VARCHAR2(100 BYTE) DEFAULT NULL, 
	"MODIFICACION" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" 
 LOB ("DESCRIPCION") STORE AS SECUREFILE (
  TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192
  NOCACHE LOGGING  NOCOMPRESS  KEEP_DUPLICATES 
  STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) ;
--------------------------------------------------------
--  Constraints for Table INVENTARIO
--------------------------------------------------------

  ALTER TABLE "INVENTARIO" MODIFY ("ID_INVENTARIO" NOT NULL ENABLE);
  ALTER TABLE "INVENTARIO" ADD CONSTRAINT "INVENTARIO_PK" PRIMARY KEY ("ID_INVENTARIO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CATEGORIA_PELICULA
--------------------------------------------------------

  ALTER TABLE "CATEGORIA_PELICULA" MODIFY ("ID_PELICULA" NOT NULL ENABLE);
  ALTER TABLE "CATEGORIA_PELICULA" MODIFY ("ID_CATEGORIA" NOT NULL ENABLE);
  ALTER TABLE "CATEGORIA_PELICULA" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "CATEGORIA_PELICULA" ADD CONSTRAINT "PK_FILM_CATEGORY" PRIMARY KEY ("ID_PELICULA", "ID_CATEGORIA")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ACTOR
--------------------------------------------------------

  ALTER TABLE "ACTOR" MODIFY ("ID_ACTOR" NOT NULL ENABLE);
  ALTER TABLE "ACTOR" MODIFY ("NOMBRE" NOT NULL ENABLE);
  ALTER TABLE "ACTOR" MODIFY ("APELLIDOS" NOT NULL ENABLE);
  ALTER TABLE "ACTOR" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "ACTOR" ADD CONSTRAINT "PK_ACTOR" PRIMARY KEY ("ID_ACTOR")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ALQUILER
--------------------------------------------------------

  ALTER TABLE "ALQUILER" MODIFY ("ID_ALQUILER" NOT NULL ENABLE);
  ALTER TABLE "ALQUILER" MODIFY ("FECHA_ALQUILER" NOT NULL ENABLE);
  ALTER TABLE "ALQUILER" MODIFY ("ID_INVENTARIO" NOT NULL ENABLE);
  ALTER TABLE "ALQUILER" MODIFY ("ID_CLIENTE" NOT NULL ENABLE);
  ALTER TABLE "ALQUILER" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "ALQUILER" ADD CONSTRAINT "PK_RENTAL" PRIMARY KEY ("ID_ALQUILER")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table IDIOMA
--------------------------------------------------------

  ALTER TABLE "IDIOMA" MODIFY ("ID_IDIOMA" NOT NULL ENABLE);
  ALTER TABLE "IDIOMA" MODIFY ("NOMBRE" NOT NULL ENABLE);
  ALTER TABLE "IDIOMA" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "IDIOMA" ADD CONSTRAINT "PK_LANGUAGE" PRIMARY KEY ("ID_IDIOMA")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CLIENTE
--------------------------------------------------------

  ALTER TABLE "CLIENTE" MODIFY ("ID_CLIENTE" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("ID_TIENDA" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("NOMBRE" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("APELLIDOS" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("ID_DIRECCION" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("ACTIVO" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("FECHA_CREACION" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "CLIENTE" ADD CONSTRAINT "PK_CUSTOMER" PRIMARY KEY ("ID_CLIENTE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PELICULA
--------------------------------------------------------

  ALTER TABLE "PELICULA" MODIFY ("ID_PELICULA" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" MODIFY ("TITULO" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" MODIFY ("ID_IDIOMA" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" MODIFY ("DURACION_ALQUILER" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" MODIFY ("COSTO_REPOSICION" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" ADD CONSTRAINT "PK_FILM" PRIMARY KEY ("ID_PELICULA")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
  ALTER TABLE "PELICULA" ADD CONSTRAINT "CHECK_SPECIAL_FEATURES" CHECK ("CARACTERICITCAS_ESPECIALES" IS NULL OR "CARACTERICITCAS_ESPECIALES" LIKE '%Trailers%' OR "CARACTERICITCAS_ESPECIALES" LIKE '%Commentaries%' OR "CARACTERICITCAS_ESPECIALES" LIKE '%Deleted Scenes%' OR "CARACTERICITCAS_ESPECIALES" LIKE '%Behind the Scenes%') ENABLE;
  ALTER TABLE "PELICULA" MODIFY ("TARIFA_ALQUILER" NOT NULL ENABLE);
  ALTER TABLE "PELICULA" ADD CONSTRAINT "CHECK_SPECIAL_RATING" CHECK ("CLASIFICACION"='G' OR "CLASIFICACION"='PG' OR "CLASIFICACION"='PG-13' OR "CLASIFICACION"='R' OR "CLASIFICACION"='NC-17') ENABLE;
--------------------------------------------------------
--  Constraints for Table CATEGORIA
--------------------------------------------------------

  ALTER TABLE "CATEGORIA" MODIFY ("ID_CATEGORIA" NOT NULL ENABLE);
  ALTER TABLE "CATEGORIA" MODIFY ("NOMBRE" NOT NULL ENABLE);
  ALTER TABLE "CATEGORIA" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "CATEGORIA" ADD CONSTRAINT "PK_CATEGORY" PRIMARY KEY ("ID_CATEGORIA")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ACTOR_PELICULA
--------------------------------------------------------

  ALTER TABLE "ACTOR_PELICULA" MODIFY ("ID_ACTOR" NOT NULL ENABLE);
  ALTER TABLE "ACTOR_PELICULA" MODIFY ("ID_PELICULA" NOT NULL ENABLE);
  ALTER TABLE "ACTOR_PELICULA" MODIFY ("MODIFICACION" NOT NULL ENABLE);
  ALTER TABLE "ACTOR_PELICULA" ADD CONSTRAINT "PK_FILM_ACTOR" PRIMARY KEY ("ID_ACTOR", "ID_PELICULA")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table ACTOR_PELICULA
--------------------------------------------------------

  ALTER TABLE "ACTOR_PELICULA" ADD CONSTRAINT "FK_FILM_ACTOR_ACTOR" FOREIGN KEY ("ID_ACTOR")
	  REFERENCES "ACTOR" ("ID_ACTOR") ENABLE;
  ALTER TABLE "ACTOR_PELICULA" ADD CONSTRAINT "FK_FILM_ACTOR_FILM" FOREIGN KEY ("ID_PELICULA")
	  REFERENCES "PELICULA" ("ID_PELICULA") ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table ALQUILER
--------------------------------------------------------

  ALTER TABLE "ALQUILER" ADD CONSTRAINT "ALQUILER_FK1" FOREIGN KEY ("ID_INVENTARIO")
	  REFERENCES "INVENTARIO" ("ID_INVENTARIO") ENABLE;
  ALTER TABLE "ALQUILER" ADD CONSTRAINT "FK_RENTAL_CUSTOMER" FOREIGN KEY ("ID_CLIENTE")
	  REFERENCES "CLIENTE" ("ID_CLIENTE") ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table CATEGORIA_PELICULA
--------------------------------------------------------

  ALTER TABLE "CATEGORIA_PELICULA" ADD CONSTRAINT "FK_FILM_CATEGORY_FILM" FOREIGN KEY ("ID_PELICULA")
	  REFERENCES "PELICULA" ("ID_PELICULA") ENABLE;
  ALTER TABLE "CATEGORIA_PELICULA" ADD CONSTRAINT "FK_FILM_CATEGORY_CATEGORY" FOREIGN KEY ("ID_CATEGORIA")
	  REFERENCES "CATEGORIA" ("ID_CATEGORIA") ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table INVENTARIO
--------------------------------------------------------

  ALTER TABLE "INVENTARIO" ADD CONSTRAINT "INVENTARIO_FK1" FOREIGN KEY ("ID_PELICULA")
	  REFERENCES "PELICULA" ("ID_PELICULA") ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table PELICULA
--------------------------------------------------------

  ALTER TABLE "PELICULA" ADD CONSTRAINT "FK_FILM_LANGUAGE" FOREIGN KEY ("ID_IDIOMA")
	  REFERENCES "IDIOMA" ("ID_IDIOMA") ENABLE;
  ALTER TABLE "PELICULA" ADD CONSTRAINT "FK_FILM_LANGUAGE_ORIGINAL" FOREIGN KEY ("ID_IDIOMA_ORIGINAL")
	  REFERENCES "IDIOMA" ("ID_IDIOMA") ENABLE;
