Consultas base de datos hotel - oracle

Páginas: 5 (1087 palabras) Publicado: 11 de febrero de 2012
PROYECTO BASES DE DATOS

LUISA FERNANDA PARRA MORENO
160002422

JUAN FAJARDO
ING.

UNIVERSIDAD DE LOS LLANOS
VILLAVICENCIO
2011

TABLAS
* Departamentos
CREATE TABLE hotel.departamentos
(
departamento character varying(10) NOT NULL,
nombre character varying(30) NOT NULL,
CONSTRAINT lp_departamento PRIMARY KEY (departamento)
)

* Municipios
CREATE TABLEhotel.municipios
(
municipio character varying(10) NOT NULL,
nombre character varying(30) NOT NULL,
departamento character varying(10),
CONSTRAINT lp_municipios PRIMARY KEY (municipio),
CONSTRAINT lf_dapartamentos_municipios FOREIGN KEY (departamento)
REFERENCES hotel.departamentos (departamento)
)

* Hoteles
CREATE TABLE hotel.hoteles
(
hotel character varying(10) NOTNULL,
nombre character varying(50) NOT NULL,
direccion character varying(45) NOT NULL,
municipio character varying(10) NOT NULL,
telefono character varying(10),
CONSTRAINT lp_hoteles PRIMARY KEY (hotel),
CONSTRAINT lf_municipios_hoteles FOREIGN KEY (municipio)
REFERENCES hotel.municipios (municipio)
)

* Huéspedes
CREATE TABLE hotel.huespedes
(
huesped charactervarying(10) NOT NULL,
nombre character varying(45) NOT NULL,
direccion character varying(45) NOT NULL,
identificacion character varying(20) NOT NULL,
email character varying(45) NOT NULL,
CONSTRAINT lp_huespedes PRIMARY KEY (huesped)
)
* Tipos de habitación
CREATE TABLE hotel.tipos_habitacion
(
tipo_habitacion character varying(10) NOT NULL,
descripcion charactervarying(100) NOT NULL,
CONSTRAINT lp_tipos_habitaciones PRIMARY KEY (tipo_habitacion)
)

* Habitaciones
CREATE TABLE hotel.habitaciones
(
habitacion character varying(10) NOT NULL,
piso_habitacion character varying(20) NOT NULL,
hotel character varying(10) NOT NULL,
tipo_habitacion character varying NOT NULL,
costo_temporada_alta character varying NOT NULL,costo_temporada_baja character varying NOT NULL,
CONSTRAINT lp_habitaciones PRIMARY KEY (habitacion),
CONSTRAINT lf_habitaciones_hoteles FOREIGN KEY (hotel)
REFERENCES hotel.hoteles (hotel)
CONSTRAINT lf_tiposhabitacion_habitaciones FOREIGN KEY (tipo_habitacion)
REFERENCES hotel.tipos_habitacion (tipo_habitacion)
)

* Reservaciones
CREATE TABLE hotel.reservaciones
(
reservacioncharacter varying NOT NULL,
inicio_reserva date NOT NULL,
fin_reserva date,
huesped character varying NOT NULL,
CONSTRAINT lp_reservaciones PRIMARY KEY (reservacion),
CONSTRAINT lf_huesped_reservaciones FOREIGN KEY (huesped)
REFERENCES hotel.huespedes (huesped)
)

* Reservaciones_habitaciones
CREATE TABLE hotel.reserva_habitaciones
(
reserva_habitacion charactervarying NOT NULL,
habitacion character varying NOT NULL,
reservacion character varying NOT NULL,
temporada character varying(10),
CONSTRAINT lp_reserva_habitaciones PRIMARY KEY (reserva_habitacion),
CONSTRAINT lf_reser_hab_habitaciones FOREIGN KEY (habitacion)
REFERENCES hotel.habitaciones (habitacion)
CONSTRAINT lf_reser_habi_reservaciones FOREIGN KEY (reservacion)REFERENCES hotel.reservaciones (reservacion)
)

INGRESO DE DATOS
* Departamentos
INSERT INTO departamentos (departamento, nombre) VALUES ('001', 'meta');
INSERT INTO departamentos (departamento, nombre) VALUES ('002', 'cundinamarca');
INSERT INTO departamentos (departamento, nombre) VALUES ('003', 'boyaca');
INSERT INTO departamentos (departamento, nombre) VALUES ('004', 'caldas');INSERT INTO departamentos (departamento, nombre) VALUES ('005', 'tolima');
INSERT INTO departamentos (departamento, nombre) VALUES ('006', 'san andres y
providencia');

* Municipios
INSERT INTO municipios (municipio, nombre, departamento) VALUES ('001', 'villavicencio', '001');
INSERT INTO municipios (municipio, nombre, departamento) VALUES ('002', 'bogota', '002');
INSERT INTO...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Consultas Base De Datos Oracle
  • Oracle Base De Datos
  • Mondrian con una base datos oracle
  • Base De Datos Oracle
  • Proyecto base de datos oracle
  • Base De Datos Oracle
  • bases de datos oracle
  • Base De Datos Oracle Resumen

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS