我正在使用MAMP phpmyadmin並且正在學習簡單的sql來創建數據庫,其中成員可以檢出一本書。我能夠創建兩個第一個表,但在訂單表中失敗。在mysql中創建表時出現語法錯誤
我哪裏錯了?
CREATE TABLE if not exists book (
b_id int UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title varchar(30),
author varchar(50),
publisher varchar(25)
)
CREATE TABLE if not exists Member (
m_id int UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname varchar(30),
lastname varchar(30),
address varchar(20)
)
CREATE TABLE if not exists Order (
o_id int AUTO_INCREMENT PRIMARY KEY,
b_id int FOREIGN KEY REFERENCES Book(b_id),
m_id int FOREIGN KEY REFERENCES Member(m_id)
)
什麼是錯誤訊息您收到? – cdhowie 2013-04-11 17:42:39
缺少'unsigned'位? – 2013-04-11 17:43:21