foreign key, or "in" constraint?

From: <mh_at_pixar.com>
Date: Mon, 06 Oct 2008 20:39:17 GMT
Message-ID: <VHuGk.2205$Rx.296@flpi144.ffdc.sbc.com>


Suppose you have a table with a status column, and the status can be one of "queued", "inprogress", "failed", or "completed".

This can be enforced two ways:

  1. status has a FK to a "statuses" table, and the allowed statuses are in that table.
  2. with a constraint such as status in ('queued','ip','failed','completed')

Which is more typically used? What are the pros and cons, tradeoffs, etc, of each?

Many TIA!
Mark

-- 
Mark Harrison
Pixar Animation Studios
Received on Mon Oct 06 2008 - 15:39:17 CDT

Original text of this message