create table purchases
(
product_id integer constraint purchases_fk_products references products(product_id),
constomer_id integer constraint purchases_fp_customers references customers(customer_id),
quantity integer not null,
constraint purchases_pk primary key (product_id, customer_id)
);
提示customer_id标示符无效
customer_id见
http://topic.csdn.net/u/20110420/15/f507e1ff-e637-466e-b6be-a8c19fc14526.html?1654930965
上面有,出错。
约束一般都会出现在那个地方。
请问是什么原因,前面句是定义的外键约束,最后一句定义的主键约束 ??
写错了
customer_id;
(
product_id integer ,
constomer_id integer ,
quantity integer not null
);ALTER TABLE purchases ADD (
PRIMARY KEY
(product_id, customer_id);
ALTER TABLE purchases ADD (
CONSTRAINT purchases_fk_products
FOREIGN KEY (product_id)
REFERENCES products,
CONSTRAINT purchases_fp_customers
FOREIGN KEY (customer_id)
REFERENCES customers);按照上面步骤一个一个做,就可以了
你确定customers表里面有customer_id这一列吗?会不会是定义时,写错了
oracle alter table详解