Sie sind auf Seite 1von 1

use master

go
create database PrestamosG2
on
(name = Pres_dat,
filename= 'D:\Practica#3\Prestdat.mdf',
size = 3,
maxsize =10,
filegrowth= 1)

use PrestamosG2
go
create table Departamento(
CodigoD char(6) primary key,
NombreD Varchar (35),
Telefono char(8),
Jefe char(30))
go
create table Herramienta (
CodigoH char(6) primary key,
Descripcion varchar(35),
Tipo int,
Precio float,
check (Precio>0))
go
create table Seccion(
CodigoS char(6) primary key,
NombreS varchar(35),
Encargado char(30),
CodigoD char(6),
foreign key (CodigoD) references Departamento(CodigoD))
go
create table Prestamo(
CodigoS char(6) not null,
CodigoH char(6) not null,
Fecha datetime default getdate(),
Duracion int,
primary key (CodigoS,CodigoH),
foreign key (CodigoS) references Seccion(CodigoS),
foreign key (CodigoH) references Herramienta(CodigoH))

Das könnte Ihnen auch gefallen