Foreign key constraint is incorrectly formed

I hope someone can help me with this… ( I’m very new at base )
As a test, I created two tables, both with a clientID field, consecutive numbers in each field, both set as primary keys,
both field types the same, both field names exactly the same.
When I tried to relate the two tables I get
Can’t create table security.#sql-19c4_f4 (errno: 150 “Foreign key constraint is incorrectly formed”)
So I deleted the data in both tables and with two empty tables tried to relate the two fields and got the same error message

Thanks

Bob

I believe the problem is with your understanding of relationships. The primary key of a table is to insure the uniqueness of a record. If you were to relate the primary key of one table to the primary key of another, it is just like extending the data in the first table. There is no real relationship.

What you want is a secondary field in the ‘Master’ record which points to a key in the ‘Secondary’ table (or vice versa depending upon what is being connected). This is where the linking comes in.

For a more complete description, please see the LO documentation - click here. Chapter 3 - Tables has a section on relationships.

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).