简体   繁体   中英

which is a better design for database status values?

I see some people design design their database having a column STATUS INT where they add values like 0- not active, 1-active, 2-pending . What is the difference between just making an enum('not active','active','pending'). Is it a better database design to not have strings defined for fields and use integers?

If option are limited and fix use enum with direct ('not active','active','pending')

Otherwise it will be better to make child table for options and store corresponding integer id( Primary key of child table) in parent table.

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