I have a table primary_details which has the the following fields
uid ---> primary key & Auto incremented & unique
name
age
I have another table cust_info with the following fields
uid ---> foreign key of primary key in primary_details table & not unique
score
comments
Now the question is when ever I insert a row in primary_details table it automatically inserts the value in uid column and it auto increments on all subsequent new rows which is perfect. However now I want the uid in cust_info table to also have the same uid value as in the primary_details table when ever I write a row in the primary_details table
For Eg:
In primary_details table if I insert the following row
uid name age
1 Mark 25
Now if I insert a record in secondary table right after the above one it should also get the uid 1
I'm using Java to write the tables. In java I can easily generate a uid and insert it into the table but I wanna use the unique ID and auto increment feature in MySQL