0

I have a database named BusinessPass and a website that users can use to create Business Passes. Below is the web form.

Date | Time From | Time To | Location

The problem is the table design. Below is my proposed table design.

BusinessPassId, UserID, Date1, From1, To1, Location1, Date2, From2, To2, Location2.... and so on. There would be a maximum of up to 31 days. So I would have 126 columns total. Is there a better way to design this?

0

2 Answers 2

1

The better way is the original design with 1 column for Date, From and To. If data is large size than you can partition the table on the basis of date(month wise or day wise).

ID, Date, From, To, Location
0

You should use two separate tables

  • Business_Pass_Header : Contains infos about the business pass
  • Business_Pass_Detail : Contains dates ranges

And finally you use a foreign key to link up the two tables. This ways you can have 0 to N dates ranges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.