Renta de vehiculos (codigo en sql server2005)

Solo disponible en BuenasTareas
  • Páginas : 3 (699 palabras )
  • Descarga(s) : 0
  • Publicado : 10 de septiembre de 2010
Leer documento completo
Vista previa del texto
Create DataBase RENTAVEHICULO

Use RENTAVEHICULO

Create table Manufacturers
(
Manufacturer_Code int not null primary key,
Manufacturer_Name char(30),
Manufacturer_Details char(30)
)
droptable Manufacturers /*BORRAR TABLA Manufacturers*/

Insert into manufacturers values
(1,'Mazda','Proveedor')
insert into Manufacturers values
(2,'Sedan','Proveedor')
insertinto Manufacturers values
(3,'Nissan','Proveerdor')
insert into Manufacturers values
(4,'Toyota','Proveedor')
insert into Manufacturers Values
(5,'Nissan','Proveedor')
SELECT*FROM Manufacturers/*CONSULTA*/

drop table Model /*BORRAR*/

Create table Model
(
Model_Code int not null,
Manufacturer_Code int,
Daily_Hire_Rate int,/*Pago Diario de la Renta*/
Model_name char(30),
Primary key (Model_Code,Manufacturer_Code)
)
insert into Model Values
(1,1,100,'Mazda MX3')
insert into Model Values(2,2,101,'Explorer')
insert into Model Values
(3,3,102,'Corolla')
insert into Model Values
(4,4,103,'Focus')
insert into Model Values
(5,5,104,'Civic')
SELECT*FROM Model

drop table Vehicles/*BORRAR*/

Create table Vehicles
(
Reg_Number int not null,
Model_Code int,
Locations_Id int,
Vehicle_Type_Code int,
Vehicle_Rentals int,
Current_mileage int,
Date_Mot_Duechar(20),
Engine_Size char(20),
Primary key(Reg_Number,Model_Code,Locations_Id,Vehicle_Type_Code,Vehicle_Rentals)
)
insert into Vehicles values
(1,1,1,1,1,12349,'01/01/2010',4)
insert intoVehicles values
(2,2,2,2,2,5567,'12/03/2010',5)
insert into Vehicles values
(3,3,3,3,3,891011,'03/01/2010',6)
insert into Vehicles Values
(4,4,4,4,4,345352,'03/03/2010',7)
insert into Vehicles Values(5,5,5,5,5,34536,'04/04/2010',8)
SELECT*FROM Vehicles

Drop table Locations /*BORRAR*/
Create table Locations
(
Location_Id int not null primary key,
Location_Code...
tracking img