Professional Documents
Culture Documents
GO
CREATE TABLE cliente(
claveCliente int NOT NULL PRIMARY KEY IDENTITY,
nombre varchar(100),
foto image
);
use AppLogin
GO
select*from Usuarios
use AppLogin
GO
GO
CREATE PROCEDURE MANTENIMIENTO
@NOMBRE VARCHAR (200),
@CLAVE VARCHAR (200),
@TIPO VARCHAR (200)
AS
BEGIN
INSERT INTO USUARIOS VALUES (@NOMBRE,@CLAVE,@TIPO)
END
GO
EXEC MANTENIMIENTO 'MICHELL','0X6hIdRXIMo=','ADMINISTRADOR'
--bd de autos
--/////////////////////TABLE DISTRITOS////////////////////////////--
--///////////////////////////TABLE CONTRATO///////////////////////////////////////
Create Table Tb_Contrato(
cod_con char(6) not null Primary Key,
fec_con datetime not null,
cod_emp varchar(6) not null references Tb_Empresa,
soli_con varchar(30) not null,
dni_soli char(8)not null,
fec_ini datetime not null,
fec_fin datetime not null,
tip_con varchar(10) not null
)
--//////////////////////////////////TABLE SERVICIO/////////////////////////--
CREATE Table Tb_Servicio(
cod_serv varchar(6)not null Primary Key,
tipo_serv varchar(10)not null,
dia_serv VARCHAR(15) not null,
hora_ini datetime not null,
hora_fin datetime not null,
obs_serv varchar(60) null,
cod_con char(6) references Tb_Contrato
)
go
--//////////////////////////////////TABLE
Tb_Detalle_Personal/////////////////////////--
Create Table Tb_Detalle_Personal(
cod_con char(6) not null references Tb_Contrato,
cod_per char(6) not null references Tb_Personal_Empresa,
Primary key(cod_con,cod_per)
)
go
--///////////////////////////////////////////////l/////////////////////////--
--//////////////////////////TABLE FACTURA//////////////////////////////////////////
--#########################################################################
-- INGRESO DE DATA PARA LAS TABLAS DE SEGURIDAD
--#########################################################################
--////////////////////////////////TABLE
DISTRITO/////////////////////////////////////--
go
--//////////////////////////////TABLE
EMPRESA///////////////////////////////////////--
insert into Tb_Empresa values
('EMP001','11876576186','Pepsi@hotmail.com','4259519','Av Venezuela 2222','Pepsi
Cola','Activa','DIS001')
insert into Tb_Empresa values
('EMP002','18986576186','CocaCola@hotmail.com','4522529','Av Zorritos 102','Coca
Cola','Inactiva','DIS002')
insert into Tb_Empresa values
('EMP003','16456576186','Metro@hotmail.com','4245585','Av la Marina
3020','Metro','Inactiva','DIS003')
insert into Tb_Empresa values
('EMP004','13436576186','Wong@hotmail.com','4248899','Av la MArina
2820','Wong','Activa','DIS004')
insert into Tb_Empresa values
('EMP005','16536576186','Saga@hotmail.com','4243568','Av la Marina
2820','Saga','Activa','DIS005')
insert into Tb_Empresa values
('EMP006','17636576186','Ripley@hotmail.com','4402585','Av Larco
310','Ripley','Activa','DIS006')
insert into Tb_Empresa values
('EMP007','16736576186','Ibm@hotmail.com','3651789','Av Jv Prado
4029','IBM','Activa','DIS007')
go
go
--//////////////////////////////TABLE PERSONAL
EMPRESA///////////////////////////////////--
INSERT INTO Tb_Personal_Empresa
VALUES('PER001','FREDDY','CASAS','HERRERA','Empleado','44992257','Av. San
German','DIS001','EMP001')
INSERT INTO Tb_Personal_Empresa
VALUES('PER002','ANTONIO','MAEDA','NAKAMATSU','Administrador','44992258','Av. San
German','DIS001','EMP002')
INSERT INTO Tb_Personal_Empresa
VALUES('PER003','GRIMALDO','CARRILLO','BENAVIDES','Gerente','44992259','Av. San
German','DIS003','EMP003')
INSERT INTO Tb_Personal_Empresa
VALUES('PER004','CARLOS','RODRIGUES','APOLINARIO','Administrador','44992260','Av.
San German','DIS002','EMP004')
INSERT INTO Tb_Personal_Empresa
VALUES('PER005','HUALTER','PASCUAL','ORTIZ','Gerente','44992261','Av. San
German','DIS002','EMP005')
INSERT INTO Tb_Personal_Empresa
VALUES('PER006','Walter','Diaz','Rojas','Gerente','15992261','Av. San
German','DIS003','EMP005')
go
--//////////////////////////////TABLE
AUTOS//////////////////////////////////////////--
--///////////////////////////////TABLA
SERVICIOS////////////////////////////////////////
--//////////////////////////////TABLE
FACTURA//////////////////////////////////////////////////--
--//////////////////////////////TABLE DETALLE
CONTRATO/////////////////////////////////////////--
--
###################################################################################
###########################
--/////////////////////////////VISUALIZANDO LAS
TABLAS//////////////////////////////////////////////////////
--
###################################################################################
###########################
--
###################################################################################
###########################
--/////////////////////////////STORE
PROCEDURES//////////////////////////////////////////////////////
--
###################################################################################
###########################
--EJERCICIOS EN CLASES
--Ejercicio 1
--Ejercccio2
--1.