SQL   122
ciudades
Guest on 6th February 2023 02:35:21 AM


  1. TABLE STRUCTURE FOR TABLE `ciudades`
  2.  
  3. CREATE TABLE IF NOT EXISTS `ciudades` (
  4.   `idciudad` INT(11) NOT NULL AUTO_INCREMENT,
  5.   `nombre` VARCHAR(50) NOT NULL,
  6.   `idpais` INT(11) NOT NULL,
  7.   PRIMARY KEY (`idciudad`),
  8.   KEY `idpais` (`idpais`)
  9. ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
  10.  
  11. --
  12. -- RELATIONS FOR TABLE `ciudades`:
  13. --   `idpais`
  14. --       `paises` -> `idpais`
  15. --
  16.  
  17. --
  18. -- Dumping data for table `ciudades`
  19. --
  20.  
  21. INSERT INTO `ciudades` (`idciudad`, `nombre`, `idpais`) VALUES
  22. (1, 'Buenos Aires', 1),
  23. (2, 'Rosario', 1),
  24. (3, 'Mendoza', 1),
  25. (4, 'Madrid', 2),
  26. (5, 'Barcelona', 2),
  27. (6, 'Valencia', 2),
  28. (7, 'Puebla', 3),
  29. (8, 'Guadalajara', 3),
  30. (9, 'Monterrey', 3),
  31. (10, 'Barranquilla', 4),
  32. (12, 'Cali', 4);
  33.  
  34. --
  35. -- Constraints for dumped tables
  36. --
  37.  
  38. --
  39. -- Constraints for table `ciudades`
  40. --
  41. ALTER TABLE `ciudades`
  42.   ADD CONSTRAINT `paises_ciudades` FOREIGN KEY (

Raw Paste

Login or Register to edit or fork this paste. It's free.