Database Table design for Weekdays and Values

Posted by Ved on Stack Overflow See other posts from Stack Overflow or by Ved
Published on 2010-04-25T20:12:54Z Indexed on 2010/04/25 20:23 UTC
Read the original article Hit count: 252

Filed under:

Guys,

I would love to here your ideas on this. I am creating a table which will store weekly shift hours for employees.

for example: Jon works 9:00am tp 9:00pm Monday , 10:00 AM to 5:00PM on Tuseday etc....

How should i go on designing this table.

I thought of 2 options.

(1) For every record I can have two lines for AM and PM and have columns for Monday to Sunday

ID | ParentID | Type | Monday | Tuseday ......Sunday

1 | 1 | AM | 9:00 | 9:00 12:00
2 | 1 | PM | 9:00 | 5:00 02:00
3 | 2 | AM | 10:00 |
4 | 2 | PM | 10:00 |

(2) I can save Preference in XML format in one column

ID | Info

1 | |Hours|Monday|9:00 AM - 9:00PM|Monday|Tuseday........|Hours

Any better ideas ?

Thanks

© Stack Overflow or respective owner

Related posts about database-design