
09/02/2007, 01:58
|
| | Fecha de Ingreso: diciembre-2004
Mensajes: 4
Antigüedad: 20 años, 3 meses Puntos: 0 | |
Problema con un script de SQL Hola, pues sucede que estaba modelando una base de datos en Power Designer, sobre un catalogo de automoviles, el script que me genero es el siguiente
Código:
/*==============================================================*/
/* DBMS name: MySQL 4.0 */
/* Created on: 09/02/2007 12:49:32 a.m. */
/*==============================================================*/
drop table if exists AGENCIA;
drop table if exists AUTOS;
drop table if exists CIUDAD;
drop table if exists ESTADO;
drop table if exists MARCA;
drop table if exists MODELO;
drop table if exists PARTICULAR;
/*==============================================================*/
/* Table: AGENCIA */
/*==============================================================*/
create table AGENCIA
(
ID_AGENCIA int not null,
NOMBRE varchar(50),
TELEFONO varchar(50),
EMAIL varchar(50),
DIRECCION varchar(50),
FOTO_LOCAL varchar(50),
DESCRIPCION varchar(50),
primary key (ID_AGENCIA)
)
type = ISAM;
/*==============================================================*/
/* Table: AUTOS */
/*==============================================================*/
create table AUTOS
(
IDCAR varchar(8) not null,
ID_AGENCIA int,
ID_PARTICULAR int,
ID_MARCA int,
PRECIO int,
TIPO varchar(50),
MARCA varchar(50),
MODELO varchar(50),
ANO int,
KILOMETRAJE int,
INTERIORES varchar(50),
COLOR_EXT varchar(50),
COLOR_INT varchar(50),
TRANSMISION varchar(50),
NOPUERTAS varchar(50),
EQUIP_ADICIONAL varchar(200),
OBSERVACIONES varchar(200),
LEVEL int,
FOTO1 varchar(50),
FOTO2 varchar(50),
FOTO3 varchar(50),
FOTO4 varchar(50),
FOTO5 varchar(50),
FOTO6 varchar(50),
FOTO7 varchar(50),
FOTO8 varchar(50),
FOTO9 varchar(50),
FOTO10 varchar(50),
primary key (IDCAR)
)
type = InnoDB;
/*==============================================================*/
/* Index: "REFERENCE_1_FK" */
/*==============================================================*/
create index REFERENCE_1_FK
(
ID_AGENCIA
);
/*==============================================================*/
/* Index: "REFERENCE_2_FK" */
/*==============================================================*/
create index REFERENCE_2_FK
(
ID_PARTICULAR
);
/*==============================================================*/
/* Index: "REFERENCE_3_FK" */
/*==============================================================*/
create index REFERENCE_3_FK
(
ID_MARCA
);
/*==============================================================*/
/* Table: CIUDAD */
/*==============================================================*/
create table CIUDAD
(
NOMBRE_CIUDAD varchar(50),
ID_CIUDAD int not null,
ID_ESTADO INT,
primary key (ID_CIUDAD)
)
type = InnoDB;
/*==============================================================*/
/* Index: "REFERENCE_5_FK" */
/*==============================================================*/
create index REFERENCE_5_FK
(
ID_ESTADO
);
/*==============================================================*/
/* Table: ESTADO */
/*==============================================================*/
create table ESTADO
(
NOMBRE_ESTADO varchar(50),
ID_ESTADO INT not null,
primary key (ID_ESTADO)
)
type = InnoDB;
/*==============================================================*/
/* Table: MARCA */
/*==============================================================*/
create table MARCA
(
ID_MARCA int not null,
NOMBRE_MARCA varchar(50),
primary key (ID_MARCA)
)
type = InnoDB;
/*==============================================================*/
/* Table: MODELO */
/*==============================================================*/
create table MODELO
(
ID_MODELO int not null,
ID_MARCA int,
NOMRE_MODELO varchar(50),
primary key (ID_MODELO)
)
type = InnoDB;
/*==============================================================*/
/* Index: "REFERENCE_4_FK" */
/*==============================================================*/
create index REFERENCE_4_FK
(
ID_MARCA
);
/*==============================================================*/
/* Table: PARTICULAR */
/*==============================================================*/
create table PARTICULAR
(
ID_PARTICULAR int not null,
ID_CIUDAD int,
NOMBRE varchar(50),
TELEFONO varchar(50),
EMAIL varchar(50),
DIRECCION varchar(50),
CIUDAD varchar(50),
primary key (ID_PARTICULAR)
)
type = InnoDB;
/*==============================================================*/
/* Index: "REFERENCE_7_FK" */
/*==============================================================*/
create index REFERENCE_7_FK
(
ID_CIUDAD
);
alter table AUTOS add constraint FK_REFERENCE_1 foreign key (ID_AGENCIA)
references AGENCIA (ID_AGENCIA) on delete restrict on update restrict;
alter table AUTOS add constraint FK_REFERENCE_2 foreign key (ID_PARTICULAR)
references PARTICULAR (ID_PARTICULAR) on delete restrict on update restrict;
alter table AUTOS add constraint FK_REFERENCE_3 foreign key (ID_MARCA)
references MARCA (ID_MARCA) on delete restrict on update restrict;
alter table CIUDAD add constraint FK_REFERENCE_5 foreign key (ID_ESTADO)
references ESTADO (ID_ESTADO) on delete restrict on update restrict;
alter table MODELO add constraint FK_REFERENCE_4 foreign key (ID_MARCA)
references MARCA (ID_MARCA) on delete restrict on update restrict;
alter table PARTICULAR add constraint FK_REFERENCE_7 foreign key (ID_CIUDAD)
references CIUDAD (ID_CIUDAD) on delete restrict on update restrict;
Pero a la hora de importarlo en mi php myadmin me muestra el siguiente error:
SQL query:
/*================================================= =============*//* Index: "REFERENCE_1_FK" *//*================================================= =============*/ CREATE INDEX REFERENCE_1_FK(
ID_AGENCIA
);
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(
ID_AGENCIA
)' at line 2
Alguien sabe a que se debe??
Actualmente estoy usando
phpMyAdmin - 2.9.1.1
* MySQL client version: 5.0.27
Gracias de antemano |