12
CREACIÓN DE ÍNDICES Y CONSTRAINTS EN SQL SERVER

Creación de índices y constraints en sql server

Embed Size (px)

Citation preview

Page 1: Creación de índices y constraints en sql server

CREACIÓN DE ÍNDICES Y CONSTRAINTS EN SQL SERVER

Page 2: Creación de índices y constraints en sql server

1.-ELIMINAMOS LOS DATOS QUE ESTABAN EN LAS TABLAS CON EL CÓDIGO TRUNCATE

Page 3: Creación de índices y constraints en sql server

BORRADA LA INFORMACIÓN, CREAREMOS UN INDICE DENTRO DE LA TABLA USUARIOS DE TIPO AGRUPADO (CLÚSTER) EN EL CAMPO USUARIO, Y UN CONSTRAINT TIPO DEFAULT .

Page 4: Creación de índices y constraints en sql server

AHORA HAREMOS LO MISMO CON LA TABLA AUTORES EN DONDE AGREGAREMOS UN INDICE TIPO AGRUPADO (CLÚSTER) EN EL CAMPO CLAVEAUTOR, Y UNO TIPO NO AGRUPADO (NON CLÚSTER) EN EL CAMPO NACIONALIDAD.

Page 5: Creación de índices y constraints en sql server

PASAMOS A LA TABLA LIBROS, AQUÍ CREAREMOS UN INDICE TIPO AGRUPADO (CLÚSTER), EN EL CAMPO ISBN.

Page 6: Creación de índices y constraints en sql server

EN EL CAMPO EDITORIAL DE LA MISMA TABLA, CREAREMOS UN INDICE NO AGRUPADO (NON CLÚSTER).

Page 7: Creación de índices y constraints en sql server

AHORA EN EL CAMPO PAGINAS DE LA TABLA LIBROS AGREGAREMOS UN CONSTRAINT DE TIPO CHECK.

Page 8: Creación de índices y constraints en sql server

UNA VEZ HECHO ESTO, AHORA LLENAREMOS LAS TABLAS DE LOS DATOS QUE ELIMINAMOS

Page 9: Creación de índices y constraints en sql server

REGISTRO DE LA TABLA USUARIO

Page 10: Creación de índices y constraints en sql server

REGISTRO DE LA TABLA AUTORES

Page 11: Creación de índices y constraints en sql server

REGISTRO DE LA TABLA LIBROS

Page 12: Creación de índices y constraints en sql server

C E N T R O U N I V E R S I TA R I O S D E LO S VA L L E S

L I C E N C I AT U R A E N T E C N O LO G Í A S D E L A I N F O R M A C I Ó N

S I S T E M A S D E B A S E S D E D AT O S I I

E S T U D I A N T E : L U I S F E R N A N D O V E R A M E R I N O