Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
9Activity
0 of .
Results for:
No results containing your search query
P. 1
Respuestas Oracle PL-SQL Practica 15

Respuestas Oracle PL-SQL Practica 15

Ratings: (0)|Views: 367 |Likes:
Published by ehv80
Practice of Chapter 15
Introduction to Oracle: SQL and PL/SQL
Instructor Guide - Volume 1
41010GC13
Production 1.3
July 1999
ORACLE
Practice of Chapter 15
Introduction to Oracle: SQL and PL/SQL
Instructor Guide - Volume 1
41010GC13
Production 1.3
July 1999
ORACLE

More info:

Published by: ehv80 on Dec 29, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

03/07/2014

pdf

text

original

 
Introduction to Oracle: SQL and PL/SQL, Instructor Guide, Volumen 1Práctica 15: Taller de SQL--------------------------------------------------------------------Ejercicio 1:Cree las tablas basadas en los diagramas de instancia de tablas siguientes. Elija los tipos de datos apropiadosy asegúrese de agregar las restricciones de integridad.Ejercicio 1.aNombre de la tabla:MEMBERDiagrama de Instancia de la Tabla MEMBER----------------------------------------NOMBRE_COLUMNA:MEMBER_IDLAST_NAMEFIRST_NAMEADDRESSCITYPHONEJOIN_DATETIPO_DE_CLAVE:PKNULL/UNIQUE:NN, UNNNNVALOR_PREDEFINIDO:FECHA DEL SISTEMATIPO_DE_DATO:NUMBERVARCHAR2VARCHAR2VARCHAR2VARCHAR2VARCHAR2DATETAMAÑO:1025251003015SQL>CREATE TABLEMEMBER(MEMBER_IDNUMBER( 10 ),LAST_NAMEVARCHAR2( 25 )NOT NULL,FIRST_NAMEVARCHAR2( 25 )NOT NULL,ADDRESSVARCHAR2( 100 ),CITYVARCHAR2( 30 ),PHONEVARCHAR2( 15 ),JOIN_DATEDATE DEFAULT SYSDATENOT NULL,CONSTRAINTMEMBER_MEMBER_ID_PKPRIMARYKEY( MEMBER_ID ) );SQL>save p15_1_a.sqlNota: Al definir la Restricción de Clave Primaria sobre la columnaMEMBER_ID, no hace falta volver a definir la otrarestricción de clave única.Ejercicio 1.b:Nombre de la tabla:TITLEDiagrama de Instancia de la Tabla TITLE----------------------------------------NOMBRE_COLUMNA:TITLE_IDTITLEDESCRIPTIONRATINGCATEGORYRELEASE_DATETIPO_DE_CLAVE:PKNULL/UNIQUE:NN, UNNNN
 
CHECK:G, PG, R,DRAMA,NC17, NRCOMEDY,ACTION,CHILD,SCIFI,DOCUMENTARYTIPO_DE_DATO:NUMBERVARCHAR2VARCHAR2VARCHAR2VARCHAR2DATETAMAÑO:1060400420SQL>CREATE TABLETITLE(TITLE_IDNUMBER( 10 )NOT NULL,TITLEVARCHAR2( 60 )NOT NULL,DESCRIPTIONVARCHAR2( 400 )NOT NULL,RATINGVARCHAR2( 4 ),CATEGORYVARCHAR2( 20 ),RELEASE_DATEDATE,CONSTRAINTTITLE_TITLE_ID_PKPRIMARYKEY( TITLE_ID ),CONSTRAINTTITLE_RATING_CKCHECK( RATING IN ('G', 'PG', 'R', 'NC17', 'NR' ) ),CONSTRAINTTITLE_CATEGORY_CKCHECK( CATEGORYIN ('DRAMA', 'COMEDY', 'ACTION', 'CHILD', 'SCIFI', 'DOCUMENTARY') ) );SQL>save p15_1_b.sqlEjercicio 1.c:Nombre de la tabla:TITLE_COPYDiagrama de Instancia de la Tabla TITLE_COPY--------------------------------------------NOMBRE_COLUMNA:COPY_IDTITLE_IDSTATUSTIPO_DE_CLAVE:PKPK, FKNULL/UNIQUE:NN, UNN, UNNCHECK:AVAILABLE,DESTROYED,RENTED,RESERVEDFK_TABLA_REFERENCIADA:TITLEFK_COLUMNA_REFERENCIADA:TITLE_IDTIPO_DE_DATO:NUMBERNUMBERVARCHAR2
 
TAMAÑO:101015SQL>CREATE TABLETITLE_COPY(COPY_IDNUMBER( 10 )NOT NULL,TITLE_IDNUMBER( 10 )NOT NULLCONSTRAINTTITLE_COPY_TITLE_ID_FKREFERENCES TITLE( TITLE_ID ),STATUSVARCHAR2( 15 )NOT NULL,CONSTRAINTTITLE_COPY_COPY_ID_TITLE_ID_PKPRIMARY KEY ( COPY_ID, TITLE_ID ),CONSTRAINTTITLE_COPY_STATUS_CKCHECK( STATUS IN ('AVAILABLE', 'DESTROYED', 'RENTED', 'RESERVED') ));SQL>save p15_1_c.sqlEjercicio 1.d:Nombre de la tabla:RENTALDiagrama de Instancia de la Tabla RENTAL--------------------------------------------NOMBRE_COLUMNA:BOOK_DATEMEMBER_IDCOPY_IDACT_RET_DATEEXP_RET_DATETITLE_IDTIPO_DE_CLAVE:PKPK, FK1PK, FK2PK, FK2VALOR_PREDEFINIDO:Fecha de SistemaFecha de Sistema + 2 díasFK_TABLA_REFERENCIADA:MEMBERTITLE_COPYTITLE_COPYFK_COLUMNA_REFERENCIADA:MEMBER_IDCOPY_IDTITLE_IDTIPO_DE_DATO:DATENUMBERNUMBERDATEDATENUMBERTAMAÑO:101010SQL>CREATE TABLERENTAL(BOOK_DATEDATEDEFAULT SYSDATE,MEMBER_IDNUMBER( 10 ),COPY_IDNUMBER( 10 ),ACT_RET_DATEDATE,EXP_RET_DATEDATEDEFAULT (SYSDATE+ 2),TITLE_IDNUMBER( 10 ),CONSTRAINTRENTAL_BD_MI_CI_TI_PKPRIMARY KEY( BOOK_DATE, MEMBER_ID, COPY_ID, TITLE_ID ),CONSTRAINTRENTAL_MEMBER_ID_FK_1FOREIGN KEY( MEMBER_ID ) REFERENCES MEMBER ( MEMBER_ID ),CONSTRAINTRENTAL_COPY_ID_TITLE_ID_FK_2FOREIGN KEY( COPY_ID, TITLE_ID ) REFERENCES TITLE_COPY( COPY_ID, TITLE_ID ));SQL>savep15_1_d.sql________________________________ 

Activity (9)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
zilbeztre liked this
joubo liked this
Dante Llimpe liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->