Successfully reported this slideshow.

Tablas, Codigos De Base De Datos

13,175 views

Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Tablas, Codigos De Base De Datos

  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; Insertar datos en la tabla empleado insert into `Emleados` values('8001','Daniel Martin','Fernandez','Ruiz','3001','900','2007-11-15','0','Soleedad y los robles','9001'), ('8002','Carlos','Lira','Fernandez','3008','904','2007-11-05','0','Soledad de Doblado, Ver.','9001'), ('8003','Ana Karen','Pablo','Cano','3003','905','2007-11-08','0','Soledad de Doblado, Ver.','9003'), ('8004','Guadalupe','Luna','Mendoza','3002','903','2007-11-13','0','Soledad de Doblado, Ver.','9002'), ('8005','Karen','Bamaca','Portela','3001','900','2007-11-13','0','Soledad de Doblado, Ver.','9003'), ('8006','Martin','Gonzales','Pegueros','3004','902','2007-11-07','0','Soledad de Doblado, Ver.','9003'),
  5. 5. ('8007','Francisco','Cuesta','Romero','3009','901','2007-11-05','0','Soledad de Doblado, Ver.','9004'), ('8008','Ana Graciela','Sarmiento','Marquez','3007','904','2007-11-15','0','Soledad de Doblado, Ver.','9006'), ('8009','Jessica','Sarda','Saturnino','3003','905','2007-12-03','0','Soledad de Doblado, Ver.','9006'), ('8010','Erick','Mondragon','Barrios','3006','906','2007-11-23','0','Soledad de Doblado, Ver.','9001'), ('8011','Ana Lorena','Grajales','Aguirre','3005','902','2007-11-09','0','Soledad de Doblado, Ver.','9001'); insert into `Anuncio` values('800','4001','c:/anuncios/2009/080'); insert into `Areas` values('900','Fotografia'), ('901','Administra'), ('902','Diseno'), ('903','Ventas'), ('904','Coodinacio'), ('905','Recepcion'), ('906','Distribuci'); insert into `Cliente` values('2','Jonnatan','Vera','Vera','Soledad Conocida','Distribuidora De Solares Veracruz','Soledad de Doblado, Ver','1557269','vera_rp34@hotmail.com','VEVJ671122HVZ'), ('3','Gabriela','Vargas','Cruz','Soledad de Doblado, Ver','Centro de Estudios en Computacion e Ingles de M','Tambien conocida','2147483647','gaby_sole547@hotmail.com','VACG820423MVZ'), ('4','Aaron','Uriel','','Soledad de Doblado, Ver','Prenda Mex','Calle Abasolo no 106 Col Centro cp 94240 Soledad de Doblado, Ver','2147483647','aaron_7804@gmail.com','URSA780129HVZ'), ('5','Anais','Sanchez','Ortiz','Soledad de Doblado, Ver','Casa de Empeno El Retiro S.A. de C.V.','Calle Mariano Abasolo 101 Local 1 Col Centro Soledad de Doblado, Ver',null,'anaiscer@yahoo.com','SAOA660721MVZ'), ('6','Armando','Sanchez','Cortes','Soledad de Doblado, Ver','Show del Payasito Kastriny','Soledad de Doblado, Ver','9720785','t9_asc@hotmail.com','SACA651127HVZ'), ('7','Ivan','Ruiz','Cruz','Soledad de Doblado, Ver','Santeria Ochanla','Soledad de Doblado, Ver','9720069','smith2305@gmail.com','RUCI810111HVZ'), ('8','Cristian','Romero','Silva','Soledad de Doblado, Ver','ConstrucTodo','Morelos #303 col Centro Soledad de Doblado, Ver',null,'contructodo@yahoo.com','ROSC880612HVZ'), ('9','Paulina','Rodriguez','Ramirez','Soledad de Doblado, Ver','Laboratorio de Analisis Clinicos Roner','Aldama No 307 entre ocampo y matamoros Soledad de Doblado, Ver','9720416','','RORP790211MVZ'), ('10','Cinthia','Ruiz','Sanchez','Soledad de Doblado, Ver','Sayer Lack','Interior del Mercado Juarez Soledad de Doblado, Ver','9720955',null,null), ('11','Sandra','Castro','Fernandez','Soledad de Doblado, Ver','Ciber Speed Red Black','Soledad de Doblado, Ver',null,'','RIMS860502MVZ'), ('12','Ruben','Aguilar','Garcia','Soledad de Doblado, Ver','Alimentos Balanceados de Veracruz','Manlio Fabio Altamirano, Ver',null,null,null), ('13','Josue','Reyes','Vaes','Soledad de Doblado, Ver','Articulos de Fiestas Rali','Local 64 en el nuevo mercado Hidalgo Soledad de Doblado, Ver',null,null,'REVV880229HVZ'),
  6. 6. ('14','Juan','Montero','Gamboa','Soledad de Doblado, Ver','G.G.A.V..A.T.T','Local 43 Interior del Mercado Hidalgo Soledad de Doblado, Ver',null,'',''), ('15','Diana','Sanchez','Vega','Soledad de Doblado, Ver','Ainat Cristales y Aluminios','Zaragoza, esq Rayon S/N, Col Sonora Soledad de Doblado, Ver','2147483647','','RAVD870322MVZ'), ('16','Nombre1','ApellidoP1','ApellidoM1','Soledad de Doblado, Ver','Empresa1','Soledad de Doblado, Ver',null,null,null), ('17','Nombre2','ApellidoP2','ApellidoM2','Soledad de Doblado, Ver','Empresa2','Soledad de Doblado, Ver',null,null,null), ('18','Nombre3','ApellidoP3','ApellidoM3','Soledad de Doblado, Ver','Empresa3','Soledad de Doblado, Ver',null,null,null); 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'), ('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'),
  7. 7. ('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), ('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');
  8. 8. 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;

×