There's situation when I have table named "status", which only contains ID (PK) and name (string, unique). Also, other table has reference to this status (e.g. status_id)
let's say, there's two statuses:
1 - status1
2 - status2
Now, I'd like to insert/update record in table2 (which has reference to status table). What is the best way to do it, should I hardcode ID of status that I'd like to set or should I query by name, then get ID and assign it after?
NOTES: this is also general programming question (no direct SQL queries). I was not able to find a tag for it.