actividad 0001 - uiii

Upload: yesse-rocio-garcia-villa

Post on 07-Jul-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/18/2019 Actividad 0001 - UIII

    1/5

     

    FACULTAD DE:

    Ingeniería

    ESCUELA PROFESIONAL DE: 

    Ingeniería de Sistemas

    CENTRO ULADECH-HUARAZ

    ASIGNATURA:

    PROYECTO DE BASE DE DATOS

    ACTIVIDAD Nº 01 - UIII:

    Implementación de BD. De los requerimientos del proyecto

    CICLO:

    V

    DOCENTE TUTOR:

    Ing. Mendoza Corpus Carlos

    ALUMNA

    García Villa Yessica Roció

    HUARAZ-2015

  • 8/18/2019 Actividad 0001 - UIII

    2/5

    Actividad 01 - UIII

    Mis saludos, deberá implementar la BD con la información que se presenta en el

    archivo llamado "Requerimientos del Proyecto".

    create database AGENCIA; -- crear la base de datos "GARCIA VILLA ROCIO"--use AGENCIA;

    create table Agencias (

    id_agencia char(5) not null primary key,

    nombre varchar (45) not null

    )

    ;

    describe Agencias

    ;

    INSERT INTO Agencias VALUES ('A001','Sysitem');

    INSERT INTO Agencias VALUES ('A002','Microsistema');

    create table Asignacion(

    id_userio char(5) not null primary key,

    serie varchar(45) not null,

    fecha date not null,

    nombre_pc varchar(45) not null,

    direccion_ip varchar(45) not null

    )

    ;

    describe Asignacion

    ;

    INSERT INTO Asignacion VALUES ('R001','MCR03',2015-07-

    17,'TOSHIBA_PC','192.168.1.2');

    INSERT INTO Asignacion VALUES ('R002','MCR04',2015-07-

    17,'HP_PC','192.168.1.4');

    create table Cargo(

    id_Cargo char(5) not null primary key,

    nombre_Cargo varchar(45) not null)

    ;

    describe Cargo;

    INSERT INTO Cargo VALUES ('C001','Administrador');

    INSERT INTO Cargo VALUES ('C002','Consultor');

    create table Equipo(

    id_Equipo char(5) not null primary key,

    tipo_Equipo varchar(45) not null,

    serie_contenedor varchar (45) not null,

    id_dep_tipo char(5) not null,

    id_provee varchar(45) not null,

    id_estado varchar(45) not null)

  • 8/18/2019 Actividad 0001 - UIII

    3/5

    ;

    describe Equipo

    ;

    INSERT INTO Equipo VALUES

    ('IDE01','SistemasCentrales','SC003','DEP01','PR01','ES01');

    INSERT INTO Equipo VALUES('IDE02','EquipoPeronales','SC004','DEP02','PR02','ES02');

    create table Deta_Tipo_Equipo(

    id_dep_tipo Char(5) not null primary key,

    id_Equipo char(5) not null,

    tipo_Equipo varchar(45) not null

    )

    ;

    describe Deta_Tipo_Equipo

    ;

    INSERT INTO Deta_Tipo_Equipo VALUES ('Dte01','IDE01','SistemasCentrales');INSERT INTO Deta_Tipo_Equipo VALUES ('Dte02','IDE02','EquipoPersonales');

    create table Estado(

    id_Estado Char(5) not null primary key,

    nombre_Estado char(5) not null

    )

    ;

    describe Estado

    ;

    INSERT INTO Estado VALUES ('ES01','Disponible');

    INSERT INTO Estado VALUES ('ES02','Asignado');

    create table Oficina(

    id_Oficina Char(5) not null primary key,

    nombre_Oficina char(5) not null,

    id_agencia char (5) not null

    )

    ;describe Oficina

    ;

    INSERT INTO Oficina VALUES ('OF01','Gerencial','A001');INSERT INTO Oficina VALUES ('OF02','Informatica','A001');

    create table Proveedor(

    id_provee char (5) not null primary key,

    nombre_provee varchar (45) not null,

    Direccion varchar(45) not null

    )

    ;

    describe Proveedor

    ;INSERT INTO Proveedor VALUES ('PR01','efe','Lima');

  • 8/18/2019 Actividad 0001 - UIII

    4/5

    INSERT INTO Proveedor VALUES ('PR02','yataco','Huaraz');

    create table Tipo_Equipo(

    id_tipo char (5) not null primary key,

    descripcion_tipo varchar(45) not null

    );

    describe Tipo_Equipo

    ;

    INSERT INTO Tipo_Equipo VALUES ('IT01','windows10');

    INSERT INTO Tipo_Equipo VALUES ('IT02','linux');

    Create table USUARIO(

    id_user char(5) not null primary key,

    nombre_usuario varchar(45) not null,

    apellidos_usuario varchar(45) not null,

    id_Oficina char(5) not null)

    ;

    describe USUARIO

    ;

    INSERT INTO USUARIO VALUES ('USI01','Daniel','Campos','OF01');

    INSERT INTO USUARIO VALUES ('USI02','Meliza','Mendoza','OF02');

    create table Usu_system(

    id_usystem char(5) not null primary key,

    clave char(5) not null,

    id_user char(5) not null

    )

    ;

    describe Usu_system

    ;

    INSERT INTO Usu_system VALUES ('USY01','CL01','USI01');

    INSERT INTO Usu_system VALUES ('USY02','CL02','USI02');

    alter table Oficina add foreign key (id_Oficina) references Agencias(id_Oficina);

    alter table Proveedor add foreign key (id_provee) references Equipo (id_provee);alter table Usu_system add foreign key (id_user) references USUARIO(id_user);

    -- consultas--

    select *from Usu_system;

  • 8/18/2019 Actividad 0001 - UIII

    5/5