Datos
Use Biblioteca
Create table Usuarios(
UsuCod varchar(4) not null primary key,
UsuNom char (60) not null,
UsuTel numeric (10) not null,
UsuDir varchar (30)notnull);
Create table Empleados(
EmpleCod varchar(4) not null primary key,
EmpleNom char (60) not null,
EmpleTel numeric (10)not null,
EmpleDir varchar (30)not null);
Create table Libros(
LibIDvarchar (4)not null primary key,
LibNom char (60)not null,
LibAut char (50)not null);
Create table TipoPrestamo(
TipCod numeric (2) not null primary key,
TipNom char (15)not null);
Createtable Factura(
FacNum numeric (3) not null primary key,
Fecha date not null,
UsuCod varchar(4)not null,
UsuNom char (60)not null,
UsuTel numeric (10)not null,
EmpleCod varchar(4)not null,
EmpleNomchar (60)not null,
TipCod numeric (2) not null,
TipNom char (15) not null
CONSTRAINT FK_Usuarios foreign key (UsuCod)
references Usuarios (UsuCod),
CONSTRAINT FK_Empleados foreign key(EmpleCod)
references Empleados (EmpleCod),
CONSTRAINT FK_TipoPrestamo foreign key (TipCod)
references TipoPrestamo(TipCod));
Create table Detalle(
FacNum numeric (3) not null,
LibID varchar (4)notnull primary key,
LibNom char (60)not null,
LibAut char (50)not null,
FecEnt date not null,
CONSTRAINT FK_Libros foreign key (LibID)
references Libros (LibID),
CONSTRAINT FK_Factura foreign key(FacNum)
references Factura (FacNum));
Insert into Usuarios
(UsuCod,UsuNom,UsuTel,UsuDir) Values
('A001','Andres Ceballos',3322545,'Cra 86 # 36 - 21'),
('A002','Laura Franco',3347254, 'Cra32 # 30 - 45'),
('A003','Guillermo Tovar',4315478,'Av 3N # 12 - 05'),
('A004','Alejandro Sanchez',5214536, 'Calle 25 # 10 - 12'),
('A005','Alejandra Godoy',6592545,'Cra 66 # 12 - 44'),('A006','Felipe Mosquera',3125478, 'Calle 8 # 32 - 14'),
('A007','Steven Quintero',4210212,'Cra 12 # 36 - 65'),
('A008','Camilo Lozano',4224705, 'Cra 66 # 5 - 12'),
('A009','Andra Salazar',3214587,'Cra 32c #...
Regístrate para leer el documento completo.