Jump to content

Script MySql con estaciones del metro


Recommended Posts

Me vi en la obligación, la semana pasada, de crear un script mysql para cargar las estaciones del metro, aquí van las tablas (estan incluidas las estaciones del metro a maipú, que pronto se supone qe van a funcionar)

 

CÓDIGO

 

--

02 -- Estructura de tabla para la tabla `metro_linea`

03 --

04

05 CREATE TABLE IF NOT EXISTS `metro_linea` (

06 `metro_linea_id` bigint(20) NOT NULL auto_increment,

07 `nombre` varchar(255) collate utf8_spanish_ci NOT NULL,

08 PRIMARY KEY (`metro_linea_id`)

09 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;

10

11 -- --------------------------------------------------------------

12

13 --

14 -- Estructura de tabla para la tabla `metro_estacion`

15 --

16

17 CREATE TABLE IF NOT EXISTS `metro_estacion` (

18 `metro_estacion_id` bigint(20) NOT NULL auto_increment,

19 `metro_linea_id` bigint(20) NOT NULL,

20 `nombre` varchar(255) collate utf8_spanish_ci NOT NULL,

21 PRIMARY KEY (`metro_estacion_id`),

22 KEY `fk_metro_linea_id` (`metro_linea_id`)

23 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;

24

25 --

26 -- Filtros para la tabla `metro_estacion`

27 --

28 ALTER TABLE `metro_estacion`

29 ADD CONSTRAINT `fk_metro_estacion_metro_linea` FOREIGN KEY (`metro_linea_id`) REFERENCES `metro_linea` (`metro_linea_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

 

 

dentro del zip se encuentran los datos de la carga, ojala les sirvansmile.gif

 

--Edit : el archivo estaba en MU, luego pongo la carga de estaciones :)

Edited by claudysta
Link to comment
Share on other sites

  • 2 weeks later...
  • 10 months later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...