Tablas, Codigos Base De Datos Excelsa

992 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
992
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tablas, Codigos Base De Datos Excelsa

  1. 1. Creación de tablas DROP TABLE IF EXISTS `Emleados`; CREATE TABLE `Emleados` ( `ID_Empleado` int(4) NOT NULL, `Nombre_Empleado` char(50) NOT NULL, `Apellido_Paterno` char(20) NOT NULL, `Apellido_Materno` char(20) NOT NULL, `Puesto` char(20) NOT NULL, `Area` varchar(10) NOT NULL, `F_Ingreso` date NOT NULL, `Telefono` int(13) NOT NULL, `Direccion` char(100) NOT NULL, `Eficiencia` char(10) DEFAULT NULL, PRIMARY KEY (`ID_Empleado`) ) DROP TABLE IF EXISTS `Anuncio`; CREATE TABLE `Anuncio` ( `ID_Anuncio` int(4) NOT NULL, `ID_Pedido` int(10) NOT NULL, `Archivo` char(20) NOT NULL, PRIMARY KEY (`ID_Anuncio`) ) DROP TABLE IF EXISTS `Areas`; CREATE TABLE `Areas` ( `ID_Area` int(4) NOT NULL, `Area` varchar(10) NOT NULL, PRIMARY KEY (`ID_Area`) ) DROP TABLE IF EXISTS `Cobros`; CREATE TABLE `Cobros` ( `ID_Cobro` int(4) NOT NULL, `ID_Pedido` int(4) NOT NULL, `Pago_No` int(2) DEFAULT NULL, `Fe_Pago` datetime DEFAULT NULL, `Fe_Pro_Pago` datetime DEFAULT NULL, `Abono` int(10) NOT NULL, `Resta` int(10) NOT NULL, PRIMARY KEY (`ID_Cobro`), KEY `ID_Pedido` (`ID_Pedido`) )
  2. 2. Creación de tablas DROP TABLE IF EXISTS `Tamano`; CREATE TABLE `Tamano` ( `ID_Tamano` int(4) NOT NULL, `Tamano` char(10) NOT NULL, PRIMARY KEY (`ID_Tamano`) ) DROP TABLE IF EXISTS `Cliente`; CREATE TABLE `Cliente` ( `ID_Cliente` int(4) NOT NULL, `Nombre_Cliente` char(20) NOT NULL, `Apellido_Paterno` char(20) NOT NULL, `Apellido_Materno` char(20) DEFAULT NULL, `Direccion` char(100) NOT NULL, `Nombre_Organizacion` char(50) NOT NULL, `Dir_Org` char(100) DEFAULT NULL, `Telefono_Cli` int(13) DEFAULT NULL, `e_mail` char(50) DEFAULT NULL, `RFC` char(13) DEFAULT NULL, PRIMARY KEY (`ID_Cliente`) ) DROP TABLE IF EXISTS `Puestos`; CREATE TABLE `Puestos` ( `ID_Puesto` int(4) NOT NULL, `Puesto` char(20) NOT NULL, PRIMARY KEY (`ID_Puesto`) )
  3. 3. Creación de tablas DROP TABLE IF EXISTS `Eficiencia`; CREATE TABLE `Eficiencia` ( `ID_Eficiencia` int(4) NOT NULL, `Nivel` char(10) NOT NULL, PRIMARY KEY (`ID_Eficiencia`) ) DROP TABLE IF EXISTS `Imprenta`; CREATE TABLE `Imprenta` ( `ID_Envio` int(4) NOT NULL, `ID_Revista` int(4) NOT NULL, `Fe_Envio` date NOT NULL, `Fe_Recoger` date NOT NULL, `ID_Empleado` int(4) DEFAULT NULL, PRIMARY KEY (`ID_Envio`) ) DROP TABLE IF EXISTS `Pedido`; CREATE TABLE `Pedido` ( `ID_Pedido` int(10) NOT NULL, `ID_Cliente` int(12) NOT NULL, `F_Pedido` datetime NOT NULL, `Meses` int(2) NOT NULL, `Ejemplar` int(4) NOT NULL, `Tamano` int(4) NOT NULL, `Total_Pagar` float DEFAULT NULL, `Forma_Pago` char(8) NOT NULL, `Pago_Inicial` int(10) NOT NULL, `Debe` int(10) NOT NULL, `Archivo` char(20) DEFAULT NULL, PRIMARY KEY (`ID_Pedido`), KEY `Forma_Pago` (`Forma_Pago`), KEY `ID_Cliente` (`ID_Cliente`) )
  4. 4. Creación de tablas DROP TABLE IF EXISTS `Revista`; CREATE TABLE `Revista` ( `ID_Revista` int(4) NOT NULL, `Ejemplar` int(4) NOT NULL, `Archivo` char(10) NOT NULL, PRIMARY KEY (`ID_Revista`) ) DROP TABLE IF EXISTS `Tipo_Pago`; CREATE TABLE `Tipo_Pago` ( `ID_TipoPago` char(4) NOT NULL, `Forma_Pago` char(8) DEFAULT NULL, PRIMARY KEY (`ID_TipoPago`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  5. 5. Insertar datos en la tabla insert into `Cobros` values('700','4001','1','2009-03-14 00:00:00','2009-04-14 00:00:00','400','700'), ('702','4001','2','2009-04-14 00:00:00','2009-05-14 00:03:11','300','400'), ('703','4001','3','2009-05-14 00:00:00',null,'400','0'), ('701','4002','1','2009-03-05 00:09:34','2009-04-05 00:09:52','1200','8606'), ('704','4002','2','2009-04-05 00:09:52','2009-05-05 00:13:27','3000','5606'), ('705','4002','3','2009-05-05 00:13:27','2009-06-05 00:15:44','700','4906'), ('706','4002','4','2009-06-05 00:15:44','2009-07-05 00:18:24','900','4006'), ('707','4002','5','2009-07-05 00:18:24','2009-08-05 00:18:24','1000','3006'), ('708','4002','6','2009-08-05 00:18:24','2009-09-05 00:18:24','600','2406'), ('709','4002','7','2009-09-05 00:18:24','2009-10-05 00:18:24','1400','1006'), ('710','4003','8','2009-11-05 00:18:24',null,'1006','0'), ('711','4003','1','2009-04-16 00:31:06','2009-05-16 00:31:06','300','702'), ('712','4003','2','2009-05-16 00:31:06','2009-06-16 00:31:06','300','402'), ('713','4003','3','2009-06-16 00:31:06',null,'402','0'), ('714','4005','1','2009-04-17 00:37:09','2009-05-17 00:37:09','500','500'), ('715','4005','2','2009-05-17 00:37:09',null,'500','0'), ('716','4006','1','2009-05-22 00:42:07','2009-06-22 00:42:07','200','800'), ('717','4006','2','2009-06-22 00:42:07','2009-07-22 00:42:07','400','400'), ('718','4006','3','2009-07-22 00:42:07','2009-08-22 00:42:07','200','200'), ('719','4006','4','2009-08-22 00:42:07','0000-00-00 00:00:00','200','0'), ('720','4007','1','2009-06-04 00:46:40','2009-07-04 00:46:40','400','902'),
  6. 6. ('721','4007','2','2009-07-04 00:46:40','2009-08-04 00:46:40','400','502'), ('722','4007','3','2009-08-04 00:46:40',null,'502','0'), ('723','4010','1','2009-06-18 00:49:37','2009-07-18 00:49:37','1000','4904'), ('724','4010','2','2009-07-18 00:49:37','2009-08-18 00:49:37','1000','3904'), ('725','4010','3','2009-08-18 00:49:37','2009-09-18 00:49:37','1200','2704'), ('726','4010','4','2009-09-18 00:49:37','2009-10-18 00:49:37','500','2204'), ('727','4010','5','2009-10-18 00:49:37','2009-11-18 00:49:37','1000','1204'), ('728','4010','6','2009-11-16 00:49:37',null,'1204','0'), ('729','4011','1','2009-05-04 00:54:44','2009-06-04 00:54:44','300','1200'), ('730','4011','2','2009-06-04 00:54:44','2009-07-04 00:54:44','300','900'), ('731','4011','3','2009-07-04 00:54:44','2009-08-04 00:54:44','300','600'), ('732','4011','4','2009-08-04 00:54:44',null,'600','0'), ('733','4013','1','2009-07-16 00:56:39','2009-08-16 00:56:39','300','1353'), ('734','4013','2','2009-08-16 00:56:39','2009-09-16 00:56:39','600','753'), ('735','4013','3','2009-09-16 00:56:39','2009-10-16 00:56:39','500','253'), ('736','4013','4','2009-10-16 00:56:39',null,'253','0'), ('737','4014','1','2009-09-14 01:00:43','2009-10-14 01:00:43','1000','4105'), ('738','4014','2','2009-10-14 01:00:43','2009-11-14 01:00:43','1300','2805'), ('739','4014','3','2009-11-14 01:00:43',null,'0','2805'), ('740','4015','1','2009-10-17 01:12:02','2009-11-17 01:12:56','300','250'), ('741','4016','1','2009-11-11 01:14:35','2009-12-17 01:15:16','300','400'), ('742','4015','2','2009-11-17 01:12:56',null,'0','250'); insert into `Eficiencia` values('9001','Exelente'), ('9002','Bueno'), ('9003','Optimo'), ('9004','Regular'), ('9005','Malo'), ('9006','Sin Evalua'); insert into `Imprenta` values('7001','600','2009-11-23','2009-12-01','8001'); insert into `Pedido` values('4001','2','2009-02-14 21:54:51','6','603','1001','1500','2002','400','1100',null), ('4002','3','2009-02-05 22:12:07','11','603','1004','11005.5','2002','1200','9806',null), ('4003','4','2009-03-16 22:22:19','3','604','1002','1351.5','2002','350','1002',null), ('4004','5','2009-03-19 22:25:29','2','604','1001','0','2003','0','0',null), ('4005','6','2009-03-07 22:43:14','5','604','1001','1250','2002','250','1000',null), ('4006','7','2009-04-01 22:43:32','6','605','1001','1500','2002','500','1000',null), ('4007','8','2009-05-04 22:43:54','3','606','1003','2101.5','2002','800','1302',null), ('4008','9','2009-05-13 22:44:19','4','606','1001','0','2003','0','0',null), ('4009','10','2009-05-15 22:44:28','2','606','1004','2001','2001','2001','0',null), ('4010','11','2009-05-18 22:45:44','7','606','1004','7003.5','2002','1100','5904',null), ('4011','12','2009-06-04 22:45:58','8','607','1001','2000','2002','500','1500',null), ('4012','13','2009-06-17 22:46:09','6','607','1002','0','2003','0','0',null), ('4013','14','2009-07-16 22:46:23','5','608','1002','2252.5','2002','600','1653',null),
  7. 7. ('4014','15','2009-08-17 22:46:43','9','609','1003','6304.5','2002','1200','5105',null), ('4015','16','2009-09-17 01:07:33','3','610','1001','750','2002','200','550',null), ('4016','17','2009-10-11 01:07:49','4','611','1001','1000','2002','300','700',null), ('4017','18','2009-11-13 01:07:56','5','612','1001','1250','2002','400','850',null); insert into Puestos values ('3001','Fotografo'), ('3002','Ejecutivo de Ventas'), ('3003','Recepcionista'), ('3004','Escritor'), ('3005','Disenador Grafico'), ('3006','Repartidor'), ('3007','Coordinador de Publi',), ('3008','Director General'), ('3009','Admon Y Finanzas'); insert into `Revista` values('600','11','c:/revista'), ('601','1','c:/revista'), ('602','2','c:/revista'), ('603','3','c:/revista'), ('604','4','c:/revista'), ('605','5','c:/revista'), ('606','6','c:/revista'), ('607','7','c:/revista'), ('608','8','c:/revista'), ('609','9','c:/revista'), ('610','10','c:/revista'), ('611','11','c:/revista'), ('612','12','c:/revista'), ('613','13','c:/revista'), ('614','14','c:/revista'), ('615','15','c:/revista'); insert into `Tamano` values('1001','1 Cuarto'), ('1002','1/2 Pagina'), ('1003','3 Cuartos'), ('1004','1 Pagina'); insert into `Tipo_Pago` values('2001','Contado'), ('2002','Credito'), ('2003','Cortecia'); SET FOREIGN_KEY_CHECKS = 1;

×