I am using a bitmask value to store a list of possible people in a row (1=John, 2=Paul, 4=George, 8=Ringo, 16=Pete, etc.) and that's working just fine, but in a certain situation I need to store this value for each day of the week.
I can easily do it by creating columns for each day (peopleSun, peopleMon, peopleTue, etc.) since while the number of people could change, the number of days in a week won't. But it feels so... dirty, like I should be more efficient with it somehow.
I'm using it in connection with PHP, and so I realize I could create an array and encode it using serialize(), but that feels like it makes the database less accessible in the future.
Is there a better way of doing this, or should I just hardwire seven different columns and stop worrying about making my database ready to handle... eight days a week? (ugh, sorry I didn't plan for that, it was just too good to pass up)
Okay, I wasn't thinking with
portals
relational databases.
I created a second table with columns "people", "day" (1=Sun, 2=Mon, etc), and "recordID" (which is tied to the id of the row in the other table.
Sometimes you just need to let these things simmer for a weekend, I guess...
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.