| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: This table strikes me as wrong - could someone explain why?
>> Could anyone explain to me:
He has split an attribute, so he has two columns, one of which is always zero. Attribute splitting is taking an attribute and making its values into either tables or attributes on their own. Example:
CREATE TABLE Jan_2003 (...); CREATE TABLE Feb_2003 (...);
2) Split a code into columns:
CREATE TABLE Foobar
(..
male CHAR(1) NOT NULL CHECK (male IN ('y','n'),
female CHAR(1) NOT NULL CHECK (female IN ('y','n'),
..);
b) if (and how) the second one is better)?
It is in a proper domain key normal form (DKNF); he needs a constraint to enforce his model.
c) how to get the result wanted from the second table structure?
SELECT ...
SUM(CASE WHEN posting = 'CD' THEM amt ELSE 0.00 END) AS tot_cd,
SUM(CASE WHEN posting = 'DB' THEM amt ELSE 0.00 END) AS tot_db,
SUM(CASE WHEN posting = 'CD' THEM amt ELSE -amt END) AS
tot_balance,
![]() |
![]() |