Re: Help with Design and Obtaining of Data
- From: Martin T. <0xCDCDCDCD@xxxxxx>
- Date: Thu, 26 Jul 2007 08:40:31 +0200
On Wed, 25 Jul 2007 07:38:56 -0700, paulwragg2323@xxxxxxxxxxx wrote:
Hi,
We are currently in the process of attempting to come up with a
solution to redesign our database. I am not going to use real
examples, but I will attempt to give enough information to enable
somebody to help me.
(...)
So the data in the Phones table may be:
PersonID Type Value
----------------------------------------------------------------------------------
1 Home 012...
1 Mob 013...
1 Work etc
2 Home
3 Mob
I believe that this is the best way to store the data. The problem I
have is getting the data out in a single query, without using syntax
such as
SELECT PER.ID, PER.DOB
(SELECT PH.TYPE, PH.VALUE FROM PHONES WHERE PERSONID = PER.ID AND TYPE
= 'Home'),
(SELECT PH.TYPE, PH.VALUE FROM PHONES WHERE PERSONID = PER.ID AND TYPE
= 'Mob'),
....
etc
As I see it, your problem is not getting the data in one query but
getting the data in the same way as before, i.e. in one record, so
that your application(s) see the same thing.
I think ideally you would also refactor your app(s) to work with a
single join where you then retrieve the different "attributes" row by
row.
If that is not (yet) possible I'd just hide the complex statement
behind a view and check if the select performance doesn't take a
severe hit. (Maybe your database supports different methods like
pipelined functions and whatnot ...)
br,
Martin
.
- References:
- Help with Design and Obtaining of Data
- From: paulwragg2323
- Help with Design and Obtaining of Data
- Prev by Date: Re: I think my book may be wrong about cardinality, but I'm not sure
- Next by Date: Re: I think my book may be wrong about cardinality, but I'm not sure
- Previous by thread: Re: Help with Design and Obtaining of Data
- Next by thread: Subtyping as an alternative to references
- Index(es):
Relevant Pages
|
|