Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When working with larger enterprise software, it is common to have large CASE WHEN statements translating application status codes into plain English. For example, status code 1 could mean the item is out of stock.

Why wouldn’t you store this information in a table and query it when you need it? What if you need to support other languages? With a table you can just add more columns for more languages!



I usually use generated columns for this. It still uses CASE WHEN but it is obvious to all consumers of the table that it exists.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: