2 Replies - 966 Views - Last Post: 14 March 2016 - 02:14 PM

#1 dionisisd   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 07-December 14

Error 1215: Cannot add foreign key constraint

Posted 14 March 2016 - 02:00 PM

hello guys,

I have created a database (information about the tables below). So I am trying to create the one to many relationships with some foreign keys in the tables and I am getting this error:Error 1215: Cannot add foreign key constraint.

What is wrong? Why am I getting this error?

My code is:
ALTER TABLE account
ADD FOREIGN KEY (customer_id)
REFERENCES Persons(customer_id)



___________________________________________________________________
Database Design:
Posted Image

Database Connection as I want them:
http://i.imgur.com/BpwuqxL.png


Thanks for your time

Is This A Good Question/Topic? 0
  • +

Replies To: Error 1215: Cannot add foreign key constraint

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6798
  • View blog
  • Posts: 28,091
  • Joined: 12-December 12

Re: Error 1215: Cannot add foreign key constraint

Posted 14 March 2016 - 02:04 PM

You don't have a table named Persons.
Was This Post Helpful? 0
  • +
  • -

#3 dionisisd   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 07-December 14

Re: Error 1215: Cannot add foreign key constraint

Posted 14 March 2016 - 02:14 PM

View Postandrewsw, on 14 March 2016 - 02:04 PM, said:

You don't have a table named Persons.


omg thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1