Está en la página 1de 1

create database Hotel_SuNombre

use Hotel_SuNombre

https://us04web.zoom.us/j/6610732321

--Tabla Hotel
create table hotel(
codigo_h int not null,
nombre_h varchar(50)not null,
addres_h varchar(200)not null,
website_h varchar(150),
constraint pk_ch primary key(codigo_h)
)

--Tabla Habitacion_pertenece_a_ hotel(Con una llave foranea)


create table Habitacion(
codigo_r int not null,
tipo_r varchar(27) not null,
precio_r int,
codigo_h1 int,
codigo_rese1 int,
constraint pk_cr primary key (codigo_r),
constraint fk_fh1 foreign key(codigo_h1) references hotel (codigo_h)
)

--Tabla_reserva_reservacion
create table Reservacion(
codigo_rese int,
firstfecha_rese date,
secondfecha_rese date,
codigo_h2 int,

constraint pk_crese primary key (codigo_rese),


constraint fk_fh2 foreign key(codigo_h2) references hotel(codigo_h)
)

--Tabla reservacion_realiza_huesped
create table Huesped(
codigo_ped int,
nombre_ped varchar(150),
email_ped varchar(60),
addres_ped varchar(200),
codigo_rese1 int,
codigo_r1 int,
constraint pk_cped primary key (codigo_ped),
constraint fk_frese1 foreign key(codigo_rese1) references reservacion(codigo_rese)
)

--Table_encuentra
create table encuentra(
codigo_r1 int,
constraint fk_fr1 foreign key(codigo_r1) references habitacion(codigo_r)
)

También podría gustarte