• MariaDB for warehouse (school exercise)

    From ^Bart@gabriele1NOSPAM@hotmail.com to comp.databases.mysql on Sat Jan 18 16:01:55 2020
    From Newsgroup: comp.databases.mysql

    Hi Guys,

    I should help a person with something like a school exercise, we suppose
    to manage boxes for a warehouse:

    warehouse
    ------------------------------------
    warehouse_id name
    1 Dep01
    2 Dep02
    3 Dep03

    things
    -------------------------------------
    thing_id name available
    1 Printer cable Yes
    2 Tv Yes
    3 Pc Yes
    4 Smartphone Yes
    5 Empty No

    boxes
    --------------------------------------
    box_id name thing_id warehouse_id
    1 Box01 1 1
    2 Box02 2 1
    3 Box03 3 1
    4 Box04 5 1
    5 Box01 3 1

    Maybe I should use a table to store every boxes names and another one to
    store things linked to the same box name...

    ^Bart


    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Luuk@luuk@invalid.lan to comp.databases.mysql on Sat Jan 18 17:22:38 2020
    From Newsgroup: comp.databases.mysql

    On 18-1-2020 16:01, ^Bart wrote:
    Hi Guys,

    I should help a person with something like a school exercise, we suppose
    to manage boxes for a warehouse:

    warehouse
    ------------------------------------
    warehouse_id name
    1aaaaaaaaaaaa Dep01
    2aaaaaaaaa Dep02
    3aaaaaaaaa Dep03

    things
    -------------------------------------
    thing_idaaaa nameaaaaaaa available
    1aaaaaaa Printer cableaaa Yes
    2aaaaaaa Tvaaaaaaa Yes
    3aaaaaaa Pcaaaaaaa Yes
    4aaaaaaa Smartphoneaaa Yes
    5aaaaaaa Emptyaaaaaaa No

    boxes
    --------------------------------------
    box_idaaa nameaaa thing_idaaa warehouse_id
    1aaaaaa Box01aaa 1aaaaaaa 1
    2aaa Box02aaa 2aaaaaaa 1
    3aaa Box03aaa 3aaaaaaa 1
    4aaa Box04aaaa 5aaaaaaa 1
    5aaa Box01aaa 3aaaaaaa 1

    Maybe I should use a table to store every boxes names and another one to store things linked to the same box name...

    ^Bart



    And the question is ?
    --
    Luuk
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Luuk@luuk@invalid.lan to comp.databases.mysql on Sat Jan 18 17:24:45 2020
    From Newsgroup: comp.databases.mysql

    On 18-1-2020 17:22, Luuk wrote:
    On 18-1-2020 16:01, ^Bart wrote:
    Hi Guys,

    I should help a person with something like a school exercise, we
    suppose to manage boxes for a warehouse:

    warehouse
    ------------------------------------
    warehouse_id name
    1-a-a-a-a-a-a-a-a-a-a-a-a Dep01
    2-a-a-a-a-a-a-a-a-a Dep02
    3-a-a-a-a-a-a-a-a-a Dep03

    things
    -------------------------------------
    thing_id-a-a-a-a name-a-a-a-a-a-a-a available
    1-a-a-a-a-a-a-a Printer cable-a-a-a Yes
    2-a-a-a-a-a-a-a Tv-a-a-a-a-a-a-a Yes
    3-a-a-a-a-a-a-a Pc-a-a-a-a-a-a-a Yes
    4-a-a-a-a-a-a-a Smartphone-a-a-a Yes
    5-a-a-a-a-a-a-a Empty-a-a-a-a-a-a-a No

    boxes
    --------------------------------------
    box_id-a-a-a name-a-a-a thing_id-a-a-a warehouse_id
    1-a-a-a-a-a-a Box01-a-a-a 1-a-a-a-a-a-a-a 1
    2-a-a-a Box02-a-a-a 2-a-a-a-a-a-a-a 1
    3-a-a-a Box03-a-a-a 3-a-a-a-a-a-a-a 1
    4-a-a-a Box04-a-a-a-a 5-a-a-a-a-a-a-a 1
    5-a-a-a Box01-a-a-a 3-a-a-a-a-a-a-a 1

    Maybe I should use a table to store every boxes names and another one
    to store things linked to the same box name...

    ^Bart



    And the question is ?


    If your post was not meant to be a question, than whu did you post this?

    Should we say: "No, i do not think you are going the correct way?"

    I do not think so, because YOU are helping someone.... EfyeEfnuEfyeEfnu
    --
    Luuk
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kees Nuyt@k.nuyt@nospam.demon.nl to comp.databases.mysql on Sat Jan 18 17:29:18 2020
    From Newsgroup: comp.databases.mysql

    On Sat, 18 Jan 2020 16:01:55 +0100, ^Bart <gabriele1NOSPAM@hotmail.com> wrote:

    Hi Guys,

    I should help a person with something like a school exercise, we suppose
    to manage boxes for a warehouse:

    warehouse
    ------------------------------------
    warehouse_id name
    1 Dep01
    2 Dep02
    3 Dep03

    things
    -------------------------------------
    thing_id name available
    1 Printer cable Yes
    2 Tv Yes
    3 Pc Yes
    4 Smartphone Yes
    5 Empty No

    boxes
    --------------------------------------
    box_id name thing_id warehouse_id
    1 Box01 1 1
    2 Box02 2 1
    3 Box03 3 1
    4 Box04 5 1
    5 Box01 3 1

    Maybe I should use a table to store every boxes names and another one to >store things linked to the same box name...


    Assuming every Thing is in a box, and every Box
    is in a Warehouse, I would suggest:

    Warehouses(
    w_id integer prinary key not null
    , name varchar unique
    )

    Boxes(
    b_id integer prinary key not null
    , location integer references Warehouses(w_id)
    , name varchar unique
    )

    Things(
    t_id integer prinary key not null
    , box integer references Boxes(b_id)
    , name varchar
    , available enum(true,false)
    )

    If some things are not in a box, you would need:

    Warehouses as above
    Boxes as above
    Things(
    t_id integer prinary key not null
    , name varchar
    , available enum(true,false)
    )

    Thing_Box(
    thing integer references Things(t_id) not null
    , box integer references Boxes(b_id) not null
    , primary key (thing,box)
    )

    But it all depends on the requirements of your logistic operations.

    HTH
    --
    Regards,
    Kees Nuyt
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From ^Bart@gabriele1NOSPAM@hotmail.com to comp.databases.mysql on Tue Jan 21 20:38:36 2020
    From Newsgroup: comp.databases.mysql

    If some things are not in a box, you would need:

    Warehouses as above
    Boxes as above
    Things(
    t_id integer prinary key not null
    , name varchar
    , available enum(true,false)
    )

    Thing_Box(
    thing integer references Things(t_id) not null
    , box integer references Boxes(b_id) not null
    , primary key (thing,box)
    )

    This is a good idea! :)

    But it all depends on the requirements of your logistic operations.

    Yes of course, now I should solve another "problem" about products which
    will be rent to others outside of the company, they will be stored in
    the things and thing_box but but after it when the product will go
    outside what happen?

    I thought to create a new record in warehouse table named "external"
    linked to a user's table, for external user I could add the product in
    things table because I don't know what happen outside.

    I'd like to try to use tables which already exist but maybe I should use
    a specific table for outside products...

    HTH

    ^Bart
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From The Natural Philosopher@tnp@invalid.invalid to comp.databases.mysql on Wed Jan 22 10:33:38 2020
    From Newsgroup: comp.databases.mysql

    On 21/01/2020 19:38, ^Bart wrote:
    Yes of course, now I should solve another "problem" about products which will be rent to others outside of the company, they will be stored in
    the things and thing_box but but after it when the product will go
    outside what happen?

    I thought to create a new record in warehouse table named "external"
    linked to a user's table, for external user I could add the product in things table because I don't know what happen outside.

    I'd like to try to use tables which already exist but maybe I should use
    a specific table for outside products...

    The normal way to flag products whichg are 'elsewhere' but still on a company's asset register is to create a different warehouse 'location'.

    'On hire' is just another 'location' with an address and contact details.

    So you need a table of 'warehouses' and then each part is tagged with a location field that points to the warehouse (or customer) location.

    Whether you add internal 'warehouses' to a 'customer' table or flag 'on
    hire' as a separate flag in the part table with a customer field, is up
    to the logistics of the business you are modelling.
    --
    "A point of view can be a dangerous luxury when substituted for insight
    and understanding".

    Marshall McLuhan

    --- Synchronet 3.21d-Linux NewsLink 1.2