Home > Software engineering >  More table data is stored and table SQL queries and problems
More table data is stored and table SQL queries and problems

Time:10-09

Such as I want to climb two jingdong and taobao commodity, assuming that both products have their own id as the primary key (their database, so there may be a same id), that if I want to save to my database, assuming that only one table, the id is bound to a primary key, and the corresponding commodity images (a list of individual deposit) cannot simply to id as foreign keys, in must be based on id as the primary key and foreign key, the need to give jingdong and taobao commodity built two separate database? So I in front a little goods can use SQL statements within the two databases on sorting goods together?

CodePudding user response:

On the basis of the original primary key, in increase the field will be able to distinguish between taobao and jingdong, also can reset the primary key content, such as on the basis of the original primary key plus _jd or _tb

CodePudding user response:

His new new id as the primary key, foreign key, and then add a site identification field

CodePudding user response:

For example,
10000000000000000 + taobao id
20000000000000000 + jingdong id
  • Related