栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

多个外键?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

多个外键?

您定义了两次主键。尝试:

CREATE TABLE SHIPPING_GRID(      id INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Unique ID for each row',      shipping_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to VENDOR.no for the shipping vendor (vendors_type must be 3)',      start_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to VENDOR.no for the vendor being shipped from',      end_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to the VENDOR.no for the vendor being shipped to',      shipment_duration INT(1) DEFAULT 1 COMMENT 'Duration in whole days shipment will take',      price FLOAT(5,5) NOT NULL COMMENT 'Price in US dollars per shipment lbs (down to 5 decimal places)',      is_flat_rate TINYINT(1) DEFAULT 0 COMMENT '1 if is flat rate regardless of weight, 0 if price is by lbs',      INDEX (shipping_vendor_no),      INDEX (start_vendor_no),      INDEX (end_vendor_no),      FOREIGN KEY (shipping_vendor_no) REFERENCES VENDOR (no),      FOREIGN KEY (start_vendor_no) REFERENCES VENDOR (no),      FOREIGN KEY (end_vendor_no) REFERENCES VENDOR (no)  ) TYPE = INNODB;

VENDOR主键必须是INT(6),并且两个表都必须是InnoDB类型。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/431622.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号