Re: Customer user and factory user in the same table

From: ^Bart <gabriele1NOSPAM_at_hotmail.com>
Date: Sun, 11 Aug 2019 12:28:02 +0200
Message-ID: <qioqjh$1out$1_at_gioia.aioe.org>


> Customer users and factory users are not the same thing so should not be
> in the same table.

[Quoted] I thought like what happen in Facebook so in this social network you must join like a user and after it you can make/enable a "page"!

I thought to create a user table to store all users, in this case I can check date of birth (>18), email, profile image, etc. and I thought to create another table named factories where I can store details like web page, address of the factory, etc.

A third table named factory_user will be connected by a foreign key to the users table and to the factories table, in this case I could add "n" users for a factory because more than one user could be in the owner's crew!

> I would have four tables.  A user table with userid, password and
> anything else common to both types.  Then a customer_user table with
> specific customer-user specific information and a foreign key leading
> back to the user table.

[Quoted] I think you have my same idea, both are users also a factory's owner, they are stored in users table but I think I should have just three tables like you can see here below:

users


id_user	name	Factory
1	Peter	Yes
2	John	Yes	
3	David	No

factories


id_factory	name			
1		Restaurant A	
2		Restaurant B	
3		Restaurant C	

factory_users


id_factory_user	FK_factories	FK_users
1		1		2
2		1		1
3		2		1

> And since you may have more than one owner of a factory, have a
> factory-user table with information specific to that factory and a link
> table joining the user and factory-user tables.

[Quoted] Like what I said above I think we had same idea!

Regards.
^Bart Received on Sun Aug 11 2019 - 12:28:02 CEST

Original text of this message