ERROR 1064 (42000): 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 '"FK_t
b_user--tb_question" foreign key (username)
      references tb_user (usern' at line 1
这是怎么回事 给点修改的意见,我是使用powerdesigner建的数据库

解决方案 »

  1.   

    语法问题,好像是创建外键失败。没用过Powerdesigner,不知道它能导出建表语句吗?能的话发上来看看。
      

  2.   

    能 而且给希望的表是一样的
    这个就是导出的表的代码
    /*==============================================================*/
    /* DBMS name:      MySQL 5.0                                    */
    /* Created on:     2011-5-23 11:16:53                           */
    /*==============================================================*/
    drop table if exists tb_question;drop table if exists tb_user;/*==============================================================*/
    /* Table: tb_question                                           */
    /*==============================================================*/
    create table tb_question
    (
       q_ID                 int not null,
       username             varchar(20) not null,
       q_content            varchar(200) not null,
       q_time               timestamp not null,
       q_check              int not null,
       primary key (q_ID)
    );/*==============================================================*/
    /* Table: tb_user                                               */
    /*==============================================================*/
    create table tb_user
    (
       username             varchar(20) not null,
       userpwd              varchar(20) not null,
       usertime             timestamp not null,
       userquestion         varchar(100) not null,
       useranswer           varchar(50) not null,
       usertype             int not null,
       primary key (username)
    );alter table tb_question add constraint "FK_tb_user--tb_question" foreign key (username)
          references tb_user (username) on delete restrict on update restrict;