Help me out, /g/.
New to database design. If I have table like this:# User
id
username
password
type (regular, company)
first_name
last_name
company_name
company_address
company_vat_number
As you can see this table supports both kind of users. Company will use the company_* fields and regular won't. Is this bad design? This is for a really small project.
>>57499225
I also have the same usage in another table:# Taxi Booking
id
address_type (google, internal)
from_address_place_id (for Google address)
from_address_internal_id (for internal addresses)
to_address_place_id
to_address_internal_id
As you can see the value of the address will be saved in the appropriate field. There must be a name for this kind of table design and I hope it's good design.
Yes. Make two different tables and JOIN them. It will make your tables cleaner and optimize your queries so you only select what you really need.
>>57499290
It really is a horrible design
bad design
>>57499225
If this is 1 to [0-1] you can have them joined unless you're using CLOB for some of the fields)
>>57499290
>As you can see the value of the address will be saved in the appropriate field
Based on the address_type. For Google address place_id fields are populated and for internal ones the internal.*
>>57499303
Different table for company and regular with a foreign key to user?