Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Simple db table design question

Re: Simple db table design question

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 19 Mar 2003 11:25:19 -0800
Message-ID: <c0d87ec0.0303191125.7898d7fb@posting.google.com>


>> Actually in this case I can't guarantee that both home and work
emails are NOT NULL, ... <<

CREATE TABLE Foobar
(name ....

 home_email VARCHAR(64),
 work_email VARCHAR(64),
 best_email CHAR(1) DEFAULT 'h' NOT NULL
         CHECK (best_email IN ('h', 'w', 'n')),
 ...);

SELECT ...,

     CASE WHEN best_email = 'h'
          THEN home_email 
          WHEN best_email = 'w
          ELSE '{{NONE}}' END AS email,

  FROM Foobar
 WHERE ...; Received on Wed Mar 19 2003 - 13:25:19 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US