Schema design , many-to-many M:N

  • bugg - Thursday, June 15, 2017 1:44 AM

    RonKyle - Wednesday, June 14, 2017 10:45 AM

    John Mitchell-245523 suggested a new table

    I don't know that it needs a new table, although neither way is wrong.  It depends on other things.  But having them in the same table with a column referencing the parent makes it easier to assign goods to the parent.  Otherwise it seems to me that you'd have to join the goods table to both the warehouse child and the warehouse parent table.

    Yes I would have to join the goods table to both the warehouse child and the warehouse parent table, that is how i had it originally. 2 separate tables, which actually makes it easier as the current production the setup is using this master warehouse, so requires less changes. The introduction of child warehouse is new, so now I'm deciding whether to create this all in the one table or keep them separate

    No, I didn't suggest a new table, just an extra column and constraint for the existing Warehouse table.  Still only one join needed.

    John

  • John Mitchell-245523 - Thursday, June 15, 2017 2:14 AM

    bugg - Thursday, June 15, 2017 1:44 AM

    RonKyle - Wednesday, June 14, 2017 10:45 AM

    John Mitchell-245523 suggested a new table

    I don't know that it needs a new table, although neither way is wrong.  It depends on other things.  But having them in the same table with a column referencing the parent makes it easier to assign goods to the parent.  Otherwise it seems to me that you'd have to join the goods table to both the warehouse child and the warehouse parent table.

    Yes I would have to join the goods table to both the warehouse child and the warehouse parent table, that is how i had it originally. 2 separate tables, which actually makes it easier as the current production the setup is using this master warehouse, so requires less changes. The introduction of child warehouse is new, so now I'm deciding whether to create this all in the one table or keep them separate

    No, I didn't suggest a new table, just an extra column and constraint for the existing Warehouse table.  Still only one join needed.

    John

    Apologies you are correct, not a new table but yes storing the child/parent relationship in the warehouse table. Which does reduce the join to one table

  • bugg - Thursday, June 15, 2017 2:45 AM

    John Mitchell-245523 - Thursday, June 15, 2017 2:14 AM

    bugg - Thursday, June 15, 2017 1:44 AM

    RonKyle - Wednesday, June 14, 2017 10:45 AM

    Are the "parent" and "child" warehouse families totally different? My guess is they are not. Tables should not be split like this; each table should be complete set of the same kind of entities in your data model, or a relationship in that data model.

    You can show families like this with the encoding scheme. Look at Dewey Decimal Classification in the library. You can do the same sort of thing with a warehouse identifiers.

    Please post DDL and follow ANSI/ISO standards when asking for help. 

  • jcelko212 32090 - Thursday, June 15, 2017 10:52 AM

    bugg - Thursday, June 15, 2017 2:45 AM

    John Mitchell-245523 - Thursday, June 15, 2017 2:14 AM

    bugg - Thursday, June 15, 2017 1:44 AM

    RonKyle - Wednesday, June 14, 2017 10:45 AM

    Are the "parent" and "child" warehouse families totally different? My guess is they are not. Tables should not be split like this; each table should be complete set of the same kind of entities in your data model, or a relationship in that data model.

    You can show families like this with the encoding scheme. Look at Dewey Decimal Classification in the library. You can do the same sort of thing with a warehouse identifiers.

    They are kind of different , the child warehouse is a stock allocation in the parent warehouse that is set a side for certain shops.

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply