Hello,

I'm currently designing a simple movie database. In a table I have a column called status. And for that there will only be a few possibilities like "pending", "watched" etc...

What would be a good way to design it such that I have some kind of constant? Should I use integers, like 1="pending" 2="watched", or should I link it to another table? Or simply use strings?

Thanks.

Recommended Answers

All 2 Replies

1. Add a check constraint with numbers only as value.
2. For the values refer to another column in some look up table.
3. In that table store the actual meaning of the numbers
i.e.-- 1="pending" 2="watched" etc..

Some databases have enum values (MySql and Postgresql both do) that are pretty much what @debasisdas suggested, but hide some of the complexity.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.