On Sat, 18 Jan 2020 16:01:55 +0100, ^Bart <
[email protected]> 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
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)