Reputation: 1
alter table booking
add constraint fk_customer_id
foreign key customer_id
references customer (customer_id);
what is the problem, can somebody help?
Upvotes: 0
Views: 1594
Reputation: 4055
You need brackets around the source field name, and around the entire constraint as part of the alter table add (..your addition here...) syntax
alter table booking add
(
constraint fk_customer_id
foreign key (customer_id )
references customer (customer_id)
);
Revise that - the outer brackets are only required if adding more than one item, so give the correct answer to andraemc but be aware of the possible need for outer brackets. I always stick 'em in to keep the style consistent, and so I don't ever forget to!
Upvotes: 1
Reputation: 656
Try parens around the field name
alter table booking
add constraint fk_customer_id
foreign key (customer_id)
references customer (customer_id);
Upvotes: 4