You are on page 1of 5

-- Ponemos en uso la base de datos creada (Proyecto)

USE BD_Proyectos
-- Creacin de la tabla EMPLEADO
-- Crear la tabla EMPLEADO
Create Table EMPLEADO (
Cedula Char (10) not null unique,
CURP Char (18) not null unique,
RFC Char (13) not null unique,
Nombre Char (45) not null,
ApellidoP Char (45) not null,
ApellidoM Char (45) not null,
Iniciales Char (6) not null,
Sexo Char (1) not null,
FechaNac DateTime not null,
Salario Money,
Supervisor char (10) not null ,
Primary key (Cedula) )
-- Creacin de la tabla Municipio
Create table MUNICIPIO (
idMpio Char (10) not null unique,
NombreMpio Char (60) not null,
Primary Key (idMpio)
)
-- Creacin de la tabla ESTADO
Create table ESTADO (
idEdo Char (10) not null unique,
NombreEdo Char (60) not null,
Primary Key (idEdo)
)
-- Creacin de la tabla DIRECCIN
Create table Direccion (
Cedula Char (10) not null unique references EMPLEADO (Cedula),
Calle Char (60) not null,
Colonia char (40) not null,
Localidad Char (60) not null,
idMpio Char (10) not null references MUNICIPIO (idMpio),
idEdo Char (10) not null references ESTADO (idEdo),
CP char (6) not null )
-- Creacin de la tabla FAMILIAR
Create table FAMILIAR (
Cedula char (10) not null references EMPLEADO (Cedula),
CURP char (18) not null unique,
Nombre char (45) not null,
ApellidoP char (45) not null,
ApellidoM char (45) not null,
Sexo Char (1) not null,
FechaNac DateTime not null,
Parentesco Char (20) not null,
Primary Key (CURP),
)

--Creacin de la tabla DEPARTAMENTO


Create Table DEPTO (
idDepto Char (10) not null unique,
NombreDepto Char (60) not null,
Primary Key (idDepto)
)
-- Creacin de la tabla Asignado
Create table Asignado (
Cedula char (10) not null unique references EMPLEADO(Cedula),
idDepto Char (10) not null references DEPTO (idDepto),
FechaAds DateTime not null,
Primary Key (Cedula, idDepto)
)
--Creacin de la tabla Jefe
Create table Jefe (
Cedula char (10) not null unique references EMPLEADO (Cedula),
idDepto Char (10) not null unique references DEPTO (IdDepto),
FechaAds DateTime not null,
Primary Key (Cedula, idDepto)
)
-- Creacin de la tabla Proyecto
Create table PROYECTO (
idProyecto Char (40) not null unique,
NombreP char (100) not null,
Descripcion char (240),
idDepto char (10) not null references DEPTO (idDepto),
primary key (idProyecto)
)
-- Creacin de la tabla TrabajaEn
Create table TrabajaEn (
Cedula char (10) not null references EMPLEADO (Cedula),
idProyecto char (40) not null references PROYECTO (idProyecto),
HorasA int not null,
primary key (Cedula, idProyecto)
)
-- Creacin de la tabla Maquinaria
Create table MAQUINARIA (
idParte char (20) not null unique,
Descripcion char (80) not null,
Estatus Char (20) not null,
Primary key (idParte)
)
-- Creacin de la tabla mAsignada
Create table mAsignada (
idProyecto char (40) not null references PROYECTO (IdProyecto),
idParte char (20) not null references MAQUINARIA (idParte),
FechaA DateTime not null,
FechaE DateTime not null,
Estatus Char (20) not null,

primary key (idProyecto, IdParte)


)
select *from EMPLEADO
insert into EMPLEADO values ( '999901','DIGP93','DIGPA23','Pablo','Diaz','Gonzal
ez','PDG','M',23/02/90,6000.00,'Supervisor')
insert into EMPLEADO values ( '999902','CAMP93','CAMPE93','Pedro','Camacho','Mar
tnez','PCM','M','19/05/93',10000.00,'Empleado')
insert into EMPLEADO values ( '999903','ORLA','ORLAL91','Alberto','Ordz','Lozano'
,'AOL','M','21/02/91',30000.00,'Supervisor')
insert into EMPLEADO values ( '999904','RELG','RELGO91','Gonzalo','Reyes','Libra
do','GRL','M','01/02/91',10000.00,'Empleado')
insert into EMPLEADO values ( '999905','VEAP87','VEAPE87','Pedro','Vega','Arcini
ega','PVA','M','08/05/87',30000.00,'Supervisor')
insert into EMPLEADO values ( '999906','MAVA','MAVAR90','Aaro','Martnez','Villa',
'AMV','M','01/05/90',10000.00,'Empleado')
insert into EMPLEADO values ( '999907','ESLJ85','ESLJE85','Jesus ','Espsito','Lpez
','JEL','M','19/02/85',30000.00,'Supervisor')
insert into EMPLEADO values ( '999908','SUFJ84','SUFJU84','Juan','Surez','Fernndez
','JSF','M','10/05/84',30000.00,'Supervisor')
select *from TrabajaEn
insert
insert
insert
insert
insert
insert
insert
insert

into
into
into
into
into
into
into
into

TrabajaEn
TrabajaEn
TrabajaEn
TrabajaEn
TrabajaEn
TrabajaEn
TrabajaEn
TrabajaEn

values
values
values
values
values
values
values
values

(
(
(
(
(
(
(
(

'999901',
'999902',
'999903',
'999904',
'999905',
'999906',
'999907',
'999908',

'0001',8)
'0002',6)
'0003',8)
'0004',6)
'0005',8)
'0002',8)
'0004',6)
'0003',8)

select *from Asignado


insert
insert
insert
insert
insert

into
into
into
into
into

Asignado
Asignado
Asignado
Asignado
Asignado

values
values
values
values
values

('999901','0102','02/07/10')
('999902','0102','02/07/10')
('999904','0101','02/07/10')
('999903','0101','02/07/10')
('999906','0103','02/07/10')

select *from JEFE


insert
insert
insert
insert
insert

into
into
into
into
into

Jefe
Jefe
Jefe
Jefe
Jefe

values
values
values
values
values

('999901','0101','02/07/10')
('999903','0102','02/07/10')
('999905','0103','02/07/10')
('999907','0104','02/07/10')
('999908','0105','04/08/10')

select *from FAMILIAR


insert into FAMILIAR values( '999901', 'DILP70','Pablo','Daz','Linares','M','02/0
3/70','Padre')
insert into FAMILIAR values( '999902', 'CAGM69','Mario','Camacho','Gonzlez','M','

01/02/69','Padre')
insert into FAMILIAR
01/72','Madre')
insert into FAMILIAR
03/70','Madre')
insert into FAMILIAR
'01/08/72','To')
insert into FAMILIAR
10/70','Padre')
insert into FAMILIAR
,'01/08/62','Madre')
insert into FAMILIAR
/80','Hermano')

values( '999903', 'LOZR72','Roco','Lozano','Zamora','F','01/


values( '999904', 'LIOM70','Mara','Librado','Ojeda','F','12/
values( '999905', 'MAAL72','Luis','Martnez','Arciniega','M',
values( '999906', 'MARA70','ngel','Martnz','Rodrguez','M','11/
values( '999907', 'LOVG72','Guadalupe','Lpez','Vallarta','F'
values( '999908', 'SUFI80','Ivn','Surez','Fernndez','M','01/02

select *from ESTADO


insert
insert
insert
insert
insert
insert
insert
insert

into
into
into
into
into
into
into
into

ESTADO
ESTADO
ESTADO
ESTADO
ESTADO
ESTADO
ESTADO
ESTADO

values
values
values
values
values
values
values
values

('01001','Guerrero')
('01002','Jalisco')
('01003','Sonora')
('01008','Chihuahua')
('01004','Aguascalientes')
('01005','Puebla')
('01006','Colima')
('01007','Durango')

select
insert
insert
insert
insert
insert
insert
insert
insert

*from MUNICIPIO
into MUNICIPIO values
into MUNICIPIO values
into MUNICIPIO values
into MUNICIPIO values
into MUNICIPIO values
into MUNICIPIO values
into MUNICIPIO values
into MUNICIPIO values

('11001','Acapulco de Jurez')
('11002','Guadalajara')
('11003','Tamazula')
('11004','Rosario')
('11005','Ajalpan')
('11006','La Cruz')
('11007','Coso')
('11008','Armera')

select *from Direccion


insert into Direccion values
,'01001','39350')
insert into Direccion values
,'11002','01002','73940')
insert into Direccion values
'01003','65748')
insert into Direccion values
,'01004','13942')
insert into Direccion values
5','01005','67481')
insert into Direccion values
1006','34732')
insert into Direccion values
1007','01007','29366')
insert into Direccion values
'01008','33874')

( '999901','Calle 23','Progreso','Acapulco','11001'
( '999902','Plan de Iguala','Morelos','Guadalajara'
( '999903','Calle 12','Mozimba','Tamazula','11003',
( '999904','Calle 8','El mirador','Rosario','11004'
( '999905','Alta Miramar','Vaquero','Ajalpan','1100
( '999906','Calle 7','Andador','La Cruz','11006','0
( '999907','Andador Marcos','Libertadores','Coso','1
( '999908','Las torres','E.Zapata','Armera','11008',

select *from MAQUINARIA


insert into MAQUINARIA values ('1000','Tractor John Deere','Disponible')
insert into MAQUINARIA values ('1001','Exacavadora CASE','Disponible')

insert
insert
insert
insert
insert
ible')

into
into
into
into
into

MAQUINARIA
MAQUINARIA
MAQUINARIA
MAQUINARIA
MAQUINARIA

update
update
update
update
'1003'
update
update
update

MAQUINARIA
MAQUINARIA
MAQUINARIA
MAQUINARIA

select
insert
insert
insert
insert
insert

*from DEPTO
into DEPTO
into DEPTO
into DEPTO
into DEPTO
into DEPTO

set
set
set
set

values
values
values
values
values

('1002','Demoledora CAT ','No Disponible')


('1003','Tractor Caterpillas','Disponible')
('1004','Exacavadora John Deere','Disponible')
('1005','Mquina hidrulica VOLVO','Disponible')
('1006','Martillo Neumtico New Holland','No Dispon

Descripcion=
Descripcion=
Descripcion=
Descripcion=

'Modem CISCO' where idParte = '1000'


'Mobiliario ' where idParte = '1001'
'Equipo de cmputo' where idParte = '1002'
'Sistemas Operativos FEDORA' where idParte =

MAQUINARIA set Descripcion= 'Papelera y tiles' where idParte = '1004'


MAQUINARIA set Descripcion= 'Circuitos Integrados' where idParte = '1005'
MAQUINARIA set Descripcion= 'SWITCH CISCO' where idParte = '1006'

values
values
values
values
values

(
(
(
(
(

'0102','Recursos humanos')
'0101','Recursos financieros')
'0103','Sistemas')
'0104','Fabricacin')
'0105','Mantenimiento')

select *from PROYECTO


insert into Proyecto values ('0001','Seguridad en redes','Seguridad contra amena
zas en red','0103')
insert into Proyecto values ('0002','Pago empleados','Orden del pago de empleado
s','0101')
insert into Proyecto values ('0003','Construccin de hardware exclusivo','Fabricac
in de hardware nico de la empresa','0104')
insert into Proyecto values ('0004','Adquisicin de nuevo mobiliario','Compra de n
uevos productos/artefactos','0105')
insert into Proyecto values ('0005','Instalacin sistemas Linux','Instalacin de sis
temas operativos en las mquinas ','0105')
select *from mAsignada
insert
insert
insert
insert
insert

into
into
into
into
into

mAsignada
mAsignada
mAsignada
mAsignada
mAsignada

values
values
values
values
values

(
(
(
(
(

'0001','1000','02/12/14','09/12/14','Hecho')
'0002','1004','01/12/14','08/12/14','Hecho')
'0003','1005','07/12/14','12/12/14','Pendiente')
'0004','1001','01/12/14','07/12/14','Hecho')
'0005','1003','02/12/14','09/12/14','Hecho')

You might also like