How do correctly design shipping address and mailing address?

Greetings experts,
We have a form that collects information from the user.
Such information as name, phone, email, street address, etc
On the form, when a user is asked to provide his/her shipping address, there is a checkbox that asks the user to check that box if shipping address s/he is providing is same as mailing address.
If the user says yes, then the shipping address is copied over to mailing address.
I use JS to do this and it works just fine.
On the DB side, I have the following:

ContactInformation
contactID int PK - identity seed
FirstName nvarchar(50)
Middle Initial nvarchar(5)
LastName nvarchar(50)
PhoneNumber nvarchar(12)
AltPhoneNumber nvarchar(12)
EmailAddress nvarchar(50)
ShippingAddress nvarchar(50)
MailingAddress nvarchar(50)

Is it necesssary to include a field that checks if the shipping address is same is same as mailing address, for instance ShippingSameAsMailing?

My take is that that can be captured on the asp.net side without putting it on the DB.

What do you think?
Thanks in advance or your help.

Database normalization description - Office | Microsoft Learn

1 Like

This is crazy. I don't need to create a separate table for mailing address.

If your business requirements do not call for it, you don't have to create a table for storing addresses. But there may be some good reasons to do so even if that is not a current requirement. Think through the various scenarios you may need to support, such as how you will support it if

  • the user changes their address, or
  • if they want to have two or more shipping addresses, or
  • if you are asked to keep history of their addresses and/or shipping addresses

If you login on Amazon.com, and see the options they give you, you can get an idea of the kind of things you will need to support. But

1 Like

OK, maybe I am missing something here.

My question is, is it necessary to add CHECKBOX that asks users if shipping address is same as mailing, as part of a database field?

That's really all I am asking.

At least you have attempted to answer my question, unlike the other person but have not addressed that question.

It is ok to make the suggestions you made but at least address my question.

In the scenario you are describing, you can do without a field/column in the database to represent whether shipping address is the same as the mailing address. Your workflow would be something like this:

  • You always have shipping and mailing address, along with the checkbox in your user interface.
  • If the user checks the box, then you disable and auto-populate the shipping address to be the same as the mailing address.
  • When you save the data into the database, you always save the shipping and mailing address, regardless of whether they are the same or not

That should work just fine.

1 Like