How to store unregistered users in database?
I have a table that contains users of my system. The order
table has columns:
id | user_id | price
Where user_id
is foreign key.
Problem is that if user not registered there is no user_id
. It means order cannot be placed because violates the integrity.
Solution 1:
Make user_id
nullable and insert a NULL
, if there's no user associated with an order.