Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `estados`
-- ----------------------------
DROP TABLE IF EXISTS `estados`;
CREATE TABLE `estados` (
`idestado` int(11) NOT NULL,
`estado` varchar(70) NOT NULL,
PRIMARY KEY (`idestado`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of estados
-- ----------------------------
INSERT INTO `estados` VALUES ('0', 'Jalisco');
INSERT INTO `estados` VALUES ('1', 'Sinaloa');
INSERT INTO `estados` VALUES ('2', 'Sonora');
-- ----------------------------
-- Table structure for `ciudades`
-- ----------------------------
DROP TABLE IF EXISTS `ciudades`;
CREATE TABLE `ciudades` (
`idciudad` int(11) NOT NULL AUTO_INCREMENT,
`ciudad` varchar(70) NOT NULL,
`idestado` int(11) NOT NULL,
PRIMARY KEY (`idciudad`),
KEY `fkestado` (`idestado`),
CONSTRAINT `fkestado` FOREIGN KEY (`idestado`) REFERENCES `estados` (`idestado`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ciudades
-- ----------------------------
INSERT INTO `ciudades` VALUES ('1', 'Los Mochis', '1');
INSERT INTO `ciudades` VALUES ('2', 'Culiacan', '1');
INSERT INTO `ciudades` VALUES ('3', 'Guadalajara', '0');
INSERT INTO `ciudades` VALUES ('4', 'Hermosillo', '2');
-- ----------------------------
-- Table structure for `clientes`
-- ----------------------------
DROP TABLE IF EXISTS `clientes`;
CREATE TABLE `clientes` (
`idclientes` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`apellidomaterno` varchar(50) NOT NULL,
`apellidopaterno` varchar(50) NOT NULL DEFAULT '''''',
`email` varchar(70) NOT NULL,
`direccion` varchar(250) NOT NULL,
`idciudad` int(11) NOT NULL,
`idestado` int(11) NOT NULL,
`codigopostal` varchar(7) NOT NULL,
PRIMARY KEY (`idclientes`),
KEY `fk_clientesciudad` (`idciudad`),
KEY `fk_clientesestado` (`idestado`),
CONSTRAINT `fk_clientesestado` FOREIGN KEY (`idestado`) REFERENCES `estados` (`idestado`),
CONSTRAINT `fk_clientesciudad` FOREIGN KEY (`idciudad`) REFERENCES `ciudades` (`idciudad`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of clientes
-- ----------------------------
INSERT INTO `clientes` VALUES ('1', 'Jorge', 'Lopez', 'Ramirez', 'jlpr@hotmail.com', 'Calle conocida #123', '1', '1', '81200');
INSERT INTO `clientes` VALUES ('2', 'Juan', 'Camargo', 'Salas', 'jcms@gmail.com', 'Calle delicias 1765', '2', '1', '72340');
INSERT INTO `clientes` VALUES ('3', 'Jaime', 'Martinez', 'Lara', 'jaimemal@yahoo.com', 'Loma Plana sur #1432', '3', '0', '33456');
INSERT INTO `clientes` VALUES ('4', 'Jesus', 'Lara', 'Nieblas', 'jlnb95@hotmail.com', 'Calle Pitaya #256', '4', '2', '93647');
INSERT INTO `clientes` VALUES ('5', 'Miguel', 'Gastelum', 'Valdez', 'miguelgv@gmail.com', 'Calle Esmeralda # 1650', '1', '1', '81245');
INSERT INTO `clientes` VALUES ('6', 'Daniel', 'Rodriguez', 'Campuzano', 'dnlrc@gmail.com', 'Calle Opalo #423', '2', '1', '72345');
-- ----------------------------
-- Table structure for `ordenes`
-- ----------------------------
DROP TABLE IF EXISTS `ordenes`;
CREATE TABLE `ordenes` (
`idorden` int(11) NOT NULL AUTO_INCREMENT,
`fechaorden` date NOT NULL,
`total` float NOT NULL,
`idcliente` int(11) NOT NULL,
PRIMARY KEY (`idorden`),
KEY `fkorden_idcliente` (`idcliente`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ordenes
-- ----------------------------
INSERT INTO `ordenes` VALUES ('1', '2016-10-23', '234.67', '1');
INSERT INTO `ordenes` VALUES ('2', '2016-10-23', '78.5', '3');
INSERT INTO `ordenes` VALUES ('3', '2016-10-25', '224', '2');
INSERT INTO `ordenes` VALUES ('4', '2016-10-26', '65.5', '3');
INSERT INTO `ordenes` VALUES ('5', '2016-10-27', '25.5', '5');
INSERT INTO `ordenes` VALUES ('6', '2016-10-28', '14.4', '4');
INSERT INTO `ordenes` VALUES ('8', '2016-10-29', '123.6', '7');
INSERT INTO `ordenes` VALUES ('9', '2016-10-30', '45.5', '9');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.