i have a question about putting some string (fixed-length and variable (which Might be always null)) into a table or separate them (Because of space-usage even if it's null) ...
for example, my user register with cellphone number or an email address
this is for cellphone number:
cellphone_country_code (SMALLINT) (UNSIGNED) cellphone_num (BIGINT) (UNSIGNED)
and this is for email address:
Now which options are better ? (i want to know that i have to separate these data from user table or not)
user: id ..... cellphone_country_code (SMALLINT) (UNSIGNED) (Default = 0) cellphone_num (BIGINT) (UNSIGNED) (Default = 0) email_address (CHAR(60)) (NULL) (Default = NULL)
or (option 2)
user: id ..... .... user_cellphone: user_id ...... (unique-index) cellphone_country_code (SMALLINT) (UNSIGNED) cellphone_num (BIGINT) (UNSIGNED) user_email: user_id ...... (unique-index) email_address (CHAR(60))
for option 1, if user registers with cellphone number and never want to add an email address, we have an empty-unused 60-BYTE space for email address (which we not going to use it for that user !) so i think it's bad to have a column with extra bytes that you are not going to use !!! but it takes your ram space !
but in option 2, there is no extra unused-space because we add cellphone number or email address in separated tables so for example, if email address is not provided, there is no any empty-unused 60-BYTE space !!!!!
am i right ? what do you think ? which option is better ? if we have a column (string with fixed-length or variable-length) and we don't use it, still it's get ram space (based on it's length i mean) ???