I'm new to SQL and I'd like to know how I could code the information of a many values into a single column. More precisely, suppose I have this table:
create table recurrent_events(
id integer primary key autoincrement,
weekday integer,
action text
);
For some records, the weekday column will have to contain more than 1 day (ex: Monday, Friday).
Is there a good way of doing this without using a list of values?
I thought of using flags to store the information of the days in the column weekday:
2^0: Monday2^1: Tuesday- ...
2^6: Sunday
Adding the powers of 2 corresponding to the days and extracting the bits with the bitwise AND.
Is it a good choice? Are there alternatives or better techniques I should know?
Aucun commentaire:
Enregistrer un commentaire