mysql - How to create unique key that can be maintained through exports and imports -


i want create 3 tables:

  1. categories
  2. items
  3. items within categories

the categories , items records need have unique keys, had planned create them auto-increment integer field called recordid.

the "items within categories" records have following fields match items categories: item_recordid, category_recordid.

however, want able rebuild these tables on multiple installations through flexible import/export utilities build myself. don't trust auto-increment keep recordid fields same through multiple installations.

what best way maintain consistency of recordid fields? should create duplicate recordid field write each items , categories record, use duplicate in "items within categories" table? or there more straightforward or more efficient way this?

this simple question. apologize if got terminology wrong - relatively new mysql , php. (background microsoft access, asp, , ecommerce technologies have import/export set up.)

thanks help.

what need foreign keys. whithout cannot trust on consistency on multiple tables , on auto increments. a-i can change in situations (if play backup/delete/restore or replication).


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -