我用你的句法试了下,没有错误!你再写一次,注意一下标点,空格之类。
从你出错的信息"ERROR 1005 (HY000): Can't create table '.\testdb\#sql-260_3.frm' (errno: 150)"
来看,说的是外键声明发生了错误。
从你出错的信息"ERROR 1005 (HY000): Can't create table '.\testdb\#sql-260_3.frm' (errno: 150)"
来看,说的是外键声明发生了错误。
解决方案 »
- 联合主键自增
- MYSQL 导入大文本文件进库
- mysql存储过程中两个CURSOR嵌套使用遇到的问题
- source 导入, 过一会can't connect server..
- mysql表之间的对比更新
- 连接mysql出现错误,急,在线等
- 关于Mysql Administrator
- 有没有比较适合mysql5.0的客户端工具?
- RH9中的mysql如何卸载,再重新安装mysql-standard-4.0.15-pc-linux-i686.tar
- 关于一个计算的查询语句。
- 我要将表中所有字段含有“矸”转成“碶”。有没有整体替换的函数或语句
- MySQL Query Browser无法正确显示中文?
代码如下:
/*==============================================================*/
/* DBMS name: MySQL 4.0 */
/* Created on: 2005-10-28 12:21:16 */
/*==============================================================*/
drop table if exists country;drop table if exists person;/*==============================================================*/
/* Table: country */
/*==============================================================*/
create table country
(
id varchar(20) not null,
name varchar(40),
primary key (id)
)
type = InnoDB;/*==============================================================*/
/* Table: person */
/*==============================================================*/
create table person
(
id varchar(30) not null,
cou_id varchar(20),
primary key (id)
)
type = InnoDB;/*==============================================================*/
/* Index: "Reference_1_FK" */
/*==============================================================*/
create index Reference_1_FK
(
cou_id
);alter table person add constraint FK_Reference_1 foreign key (cou_id)
references country (id) on delete restrict on update restrict;