i have "status" column in 2 of database tables, same status types each one. instance, author can have following status': pending, active, void, suspended. these same status types work status of published article.
is proper use char() either table under status , enter either of 4 listed status', or make more database sense make "status" table status_id , status_type each type of status , use status_id foreign key in either table or future tables?
simply typing in either of 4 types easy way, i'm thinking may possibility of user error...
thanks
you can use enum
field data type enforce value must once of pre-selected set of values. behind scenes mysql stores these value integer representationd save on storage requirements.
whether need seperate table or not you. if think set of allowable values need change dynamically on time, perhaps makes sense (with foreign key contraint in place enforce selection of 1 of values). might benefit having values in separate table if values represent sort of real-world objects in system need have own properties (fields) associated them.
Comments
Post a Comment