Está en la página 1de 1

drop database sucursal_uno;

create database sucursal_uno;


use sucursal_uno;

create table sucursal(


codigo int not null,
Direccion varchar(45) not null,
telefono int not null,
primary key(codigo));

create table vehiculo(


Matricula int not null primary key,
Marca varchar(45) not null,
Sucursal_codigo int not null,
foreign key (sucursal_codigo) references sucursal(codigo));

create table AutoMovil(


Cod_Automovil int not null primary key,
Num_pasajeros int not null,
Num_velocidad int not null,
vehiculo_Matricula int not null,
foreign key (vehiculo_Matricula) references vehiculo(Matricula));

create table Camion(


Cod_Camion int not null primary key,
peso double not null,
num_ejes int not null,
vehiculo_Matricula int not null,
foreign key (vehiculo_Matricula) references vehiculo(Matricula));

Create table Alquiler(


idAlquiler int not null primary key,
Fecha_Inicio date not null,
Fecha_Final date not null,
precio int not null,
vehiculo_Matricula int not null,
Asesor_cedula int not null,
foreign key (vehiculo_Matricula) references vehiculo(Matricula),
foreign key(Asesor_Cedula)references Asesor(Cedula));

Create table Asesor(


Cedula int not null primary key,
nombre varchar(45) not null,
correo varchar(45) not null);

También podría gustarte