简体   繁体   中英

how to structure my mysql database

I have a table like this on my website

each time I click on a cell the background is changing and the unique id is stored in an array.

What kind of structure should i use in my database to store everyone is disponibility, one table with a field "name" (name of the user) and a different field for every hour (11*7 = 77 field + name field) ? or there is better solution.

I want to know when 5 users have the same disponibility

If I understood you correct you don't need to save all the hours, therefore there is no need of 77 columns.

I think it would be easier to maintain database of two tables:

Users: | ID | NAME | | ID | NAME |

Disponibility:

| ID | DAY | HOUR | USERID |

And you should save just the marked hours

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM