Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/09/2008, 09:24
Avatar de naitmeir
naitmeir
 
Fecha de Ingreso: junio-2008
Ubicación: Barcelona
Mensajes: 227
Antigüedad: 15 años, 10 meses
Puntos: 0
Pequeño problema con script

Cuando ejecuto el siguiente script, me falla en el momento de crear la tabla video, supongo que esta relacionado con el tema de la clave foranea, pero no estoy demasiado puesto en el tema, como puedo solucionarlo?

Código PHP:
create database naitmeir;
use 
naitmeir;

create table user  (

  
username varchar(16),
  
passwd char(16not null,
  
email varchar(100not null,

  
constraint PK_username primary key (username)
);


create table new(

  
id integer not null,
  
username varchar(16not null,
  
tipo varchar(15),
  
genero varchar(16),
  
fecha text(15),
  
titulo varchar(50),

  
constraint PK_id primary key (id),
  
constraint FK_user foreign key (usernamereferences user (username)

);

create table articulo(

 
id integer not null,
 
noticia longtext,

 
constraint FK_new foreign key (idreferences new (id

);

create table video(

 
id integer not null,
 
noticia longtext,

 
constraint FK_new foreign key (idreferences new (id

);

create table encuesta(

  
idencuesta integer not null,
  
username varchar(16),
  
pregunta varchar(50not null
  
respuesta1 varchar(50not null,
  
respuesta2 varchar(50not null,
  
respuesta3 varchar(50not null,
  
respuesta4 varchar(50not null,


  
constraint PK_idencuesta primary key (idencuesta),
  
constraint FK_user foreign key (usernamereferences user (username)

);