MySQL 中有 p_table 表,创建表语句如下:
CREATE TABLE `p_table` (
`id` int(11) NOT NULL auto_increment,
`p_name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8;
把表 p_table 的 id 作为表 c_table 的外键,则下面创建语句符合预期的是()
ACREATE TABLE `c_table` (
`id` int(11) NOT NULL auto_increment,
`c_name` varchar(20) DEFAULT NULL,
`p_id` int(11) NOT NULL ,
PRIMARY KEY (`id`),
foreign key fkeyName(p_id) references p_table(id)
) ENGINE=InnoDB CHARSET=utf8 ;
BCREATE TABLE `c_table` (
`id` int(11) NOT NULL auto_increment,
`c_name` varchar(20) DEFAULT NULL,
`p_id` int(11) NOT NULL ,
PRIMARY KEY (`id`),
foreign key p_id references p_table(id)
) ENGINE=InnoDB CHARSET=utf8 ;
CCREATE TABLE `c_table` (
`id` int(11) NOT NULL auto_increment,
`c_name` varchar(20) DEFAULT NULL,
`p_id` int(11) NOT NULL ,
PRIMARY KEY (`id`),
foreign key fkeyName(p_id) references p_table(id)
) ENGINE=MyISAM CHARSET=utf8 ;
D其他选项均不符合预期