Base De Datos

Páginas: 2 (331 palabras) Publicado: 22 de junio de 2012
create DataBase video;
Name=video;
Filename='D:/trabajo/video.mdf',
Size=4MB,
Máximo=10MB
Filegroup=1
go
use video

Create table tipopelicula(
id INT NOT NULL,
titulo Varchar(20) Not Null,categoria Varchar(50) Not Null,
Constraint tipopeliculaPk1 Primary Key (id),
)
Go

Create table peliculaestreno(
id INT NOT NULL,
titulo Varchar(20) Not Null,
autor Varchar(50) Not Null,Constraint peliculaestenoPk1 Primary Key (id),
constraint peliculaestrenofk1 foreign key(id) references tipopelicula(id),

)
go

Create table alquiler(
id INT NOT NULL,
id_pelicula int not null,id_cliente int not null,
fechaalquiler int not null,
fechadevolucion int not null,
valoralquiler int not null,
cantida int not null,
devolucion int not null,
Constraint aluilerPk1 Primary Key(id),
constraint alquilerfk1 foreign key(id) references tipopelicula(id),

)
go

Create table pelicula(
id INT NOT NULL,
director Varchar(20) Not Null,
copias int not null,
cantidad int notnull,
Constraint peliculaPk1 Primary Key (id),
constraint peliculafk1 foreign key(id) references tipopelicula(id),

)
go
Create table autor(
id INT NOT NULL,
nombre Varchar(20) Not Null,fecha_nac int not null,
Constraint autorPk1 Primary Key (id),
constraint autorfk1 foreign key(id) references pelicula(id),

)
go

Create table cliente(
id INT NOT NULL,
num_cedula Varchar(20)Not Null,
nombre Varchar(50) Not Null,
direccion varchar(50)not null,
telefono int not null,
Constraint clientePk1 Primary Key (id),
constraint clientefk1 foreign key(id) references alquiler(id),)
go

Create table proveedor(
id INT NOT NULL,
nombre Varchar(20) Not Null,
direccion Varchar(50) Not Null,
telefono int not null,
pelicula_estreno varchar(50) not null,
ConstraintproveedorPk1 Primary Key (id),
constraint proveedorfk1 foreign key(id) references peliculaestreno(id),

)
go

Create table reservapelicula(
id INT NOT NULL,
fecha_reserva int not null,
Constraint...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Que es una base de datos y tipos de base de datos
  • Bases de datos y usuarios de bases de datos
  • Base De Datos
  • Base De Datos
  • Base de datos
  • Base De Datos
  • Base de datos
  • Bases de datos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS