Está en la página 1de 8

UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA

FACULTAD DE INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL


ESCUELA PROFESIONAL DE INGENIERÍA DE SISTEMAS

“Modelo de Base de Datos del Negocio”

ASIGNATURA : COMERCIO ELECTRÓNICO


IS545

DOCENTE : Ing. ZAPATA CASAVERDE, Richard

INTEGRANTES : AYALA BELLIDO, Julio Martí

AYACUCHO – PERÚ
2020
MODELO DE LA BASE DE DATOS DEL NEGOCIO

I. Para implementar el modelo de base de datos del negocio utilizaremos el lenguaje Transact – SQL y el gestor de
base de datos de SQL Server – Microsoft SQL Server Management Studio.
Crearemos las siguientes tablas:
Agencia: Agencias de turismo.
Archivo_Pago: Cotizaciones o reservas confirmadas y pagadas.
Categoria_hotel: Categoría del hotel.
Ciudad: Ubicación ciudad.
Cotización: Cotización de los paquetes.
Guia: Personas responsables de los tours por agencia.
Habitación: Habitación de un hotel con sus características.
Paquete_tour: Paquete de turismo, ruta o destino con sus características.
Proveedor_hotel: Hotel o proveedor de habitaciones.
Reserva_habitación: Reserva o cotización de una habitación.
Reserva_paquete: Reserva o cotización de un paquete turístico.
Tipo_Habitación: Enumerador de tipo de habitación de hotel.
Tipo_Paquete: Enumerador de tipo de paquete turístico.
Usuario: Usuario registrado en la plataforma.

2
II. Modelo de la Base de Datos

3
III. Modelo de la Base de Datos en SQL Server

4
IV. Script de Creación
CREATE DATABASE AppTourDB

USE AppTourDB

CREATE TABLE [usuario] (


[id_usuario] int PRIMARY KEY IDENTITY(1, 1),
[id_documento] int,
[nro_documento] nvarchar(255),
[nombres] nvarchar(255),
[ap_paterno] nvarchar(255),
[ap_materno] nvarchar(255),
[email] nvarchar(255),
[telefono] nvarchar(255),
[fecha_nac] date,
[sexo] int,
[usuario] nvarchar(255),
[contrasena] nvarchar(255)
)
GO

CREATE TABLE [proveedor_hotel] (


[id_prov_hotel] int PRIMARY KEY IDENTITY(1, 1),
[id_ciudad] int,
[id_cat_hotel] int,
[nombres_comercial] nvarchar(255),
[razon_social] nvarchar(255),
[ruc] nvarchar(255),
[email] nvarchar(255),
[telefono] nvarchar(255),
[direccion] nvarchar(255)
)
GO

CREATE TABLE [ciudad] (


[id_ciudad] int PRIMARY KEY IDENTITY(1, 1),
[ciudad] nvarchar(255)
)
GO

CREATE TABLE [categoria_hotel] (


[id_cat_hotel] int PRIMARY KEY IDENTITY(1, 1),
[descripcion] nvarchar(255)
)
GO

CREATE TABLE [habitacion] (


[id_habitacion] int PRIMARY KEY IDENTITY(1, 1),
[id_prov_hotel] int,
[id_tipo_habitacion] int,
[info_habitacion] nvarchar(255),
[costo] float,
[estado] int
)
GO

CREATE TABLE [tipo_habitacion] (


[id_tipo_habitacion] int PRIMARY KEY IDENTITY(1, 1),
[tipo_habitacion] nvarchar(255),
[estado] int
)

5
GO

CREATE TABLE [guia] (


[id_guia] int PRIMARY KEY IDENTITY(1, 1),
[id_agencia] int,
[nombres] nvarchar(255),
[email] nvarchar(255),
[telefono] nvarchar(255),
[costo] float,
[inf_adicional] nvarchar(300),
[estado] int
)
GO

CREATE TABLE [agencia] (


[id_agencia] int PRIMARY KEY IDENTITY(1, 1),
[id_ciudad] int,
[nombres_comercial] nvarchar(255),
[razon_social] nvarchar(255),
[ruc] nvarchar(255),
[email] nvarchar(255),
[telefono] nvarchar(255),
[direccion] nvarchar(255),
[estado] int
)
GO

CREATE TABLE [paquete_tour] (


[id_paquete_tour] int PRIMARY KEY IDENTITY(1, 1),
[id_agencia] int,
[tipo_paquete] int,
[titulo] nvarchar(255),
[descripcion] nvarchar(255),
[costo_infante] float,
[costo_adulto] float,
[estado] int
)
GO

CREATE TABLE [tipo_paquete] (


[id_tipo_paquete] int PRIMARY KEY IDENTITY(1, 1),
[tipo] nvarchar(255),
[dias] int,
[estado] int
)
GO

CREATE TABLE [reserva_paquete] (


[id_reserva_paquete] int PRIMARY KEY IDENTITY(1, 1),
[id_paquete_tour] int,
[nro_infante] int,
[nro_adulto] int,
[inf_adicional] nvarchar(255)
)
GO

CREATE TABLE [reserva_habitacion] (


[id_reserva_habitacion] int PRIMARY KEY IDENTITY(1, 1),
[id_habitacion] int,
[inf_adicional] nvarchar(255)
)
GO

6
CREATE TABLE [cotizacion] (
[id_cotizacion] int PRIMARY KEY IDENTITY(1, 1),
[id_usuario] int,
[id_reserva_paquete] int,
[id_reserva_habitacion] int,
[costo_total] float,
[fecha_registro] date,
[check_in] date,
[check_out] date,
[reservado] int,
[estado] int
)
GO

CREATE TABLE [archivo_pago] (


[id_archivo_pago] int,
[id_cotizacion] int,
[fecha_registro] date,
[nro_transaccion] nvarchar(255),
[serie] int,
[estado] int,
[anulado] int
)
GO

ALTER TABLE [habitacion] ADD FOREIGN KEY ([id_prov_hotel]) REFERENCES [proveedor_hotel]


([id_prov_hotel])
GO

ALTER TABLE [habitacion] ADD FOREIGN KEY ([id_tipo_habitacion]) REFERENCES


[tipo_habitacion] ([id_tipo_habitacion])
GO

ALTER TABLE [proveedor_hotel] ADD FOREIGN KEY ([id_cat_hotel]) REFERENCES


[categoria_hotel] ([id_cat_hotel])
GO

ALTER TABLE [proveedor_hotel] ADD FOREIGN KEY ([id_ciudad]) REFERENCES [ciudad]


([id_ciudad])
GO

ALTER TABLE [guia] ADD FOREIGN KEY ([id_agencia]) REFERENCES [agencia] ([id_agencia])
GO

ALTER TABLE [paquete_tour] ADD FOREIGN KEY ([tipo_paquete]) REFERENCES [tipo_paquete]


([id_tipo_paquete])
GO

ALTER TABLE [paquete_tour] ADD FOREIGN KEY ([id_agencia]) REFERENCES [agencia]


([id_agencia])
GO

ALTER TABLE [reserva_habitacion] ADD FOREIGN KEY ([id_habitacion]) REFERENCES [habitacion]


([id_habitacion])
GO

ALTER TABLE [reserva_paquete] ADD FOREIGN KEY ([id_paquete_tour]) REFERENCES


[paquete_tour] ([id_paquete_tour])
GO

7
ALTER TABLE [cotizacion] ADD FOREIGN KEY ([id_reserva_habitacion]) REFERENCES
[reserva_habitacion] ([id_reserva_habitacion])
GO

ALTER TABLE [cotizacion] ADD FOREIGN KEY ([id_reserva_paquete]) REFERENCES


[reserva_paquete] ([id_reserva_paquete])
GO

ALTER TABLE [archivo_pago] ADD FOREIGN KEY ([id_cotizacion]) REFERENCES [cotizacion]


([id_cotizacion])
GO

ALTER TABLE [cotizacion] ADD FOREIGN KEY ([id_usuario]) REFERENCES [usuario]


([id_usuario])
GO

También podría gustarte