Re: SQL question

  • From: Jared Still <jkstill@xxxxxxxxx>
  • To: dubey.sandeep@xxxxxxxxx
  • Date: Mon, 16 Jan 2006 15:56:50 -0800

Comments inline:

On 1/13/06, Sandeep Dubey <dubey.sandeep@xxxxxxxxx> wrote:
> > I am sorry I can't be more helpful. I don't really see this as problem,
> to
> > me it's more of an exemple of bad data.
> I am not sure if it is a bad data model. It's battle of normalization
> - denormalization.

The example given would appear to be denormalized.  There is no
candidate key to start with.

I have a table Items. It's child is item_parts. Item can be made up of
> 1 or may parts. So it is right to store in a table like item_parts.
> okay?

The example does not match what you were trying to do.
You won't get much help here with an example like that.

What you are trying to do requires 3 tables.

ITEMS, PARTS, and an intersection table.

If a a part can appear in more than 1 item, you can't store the
PARTS data as a child table of ITEMS.

Now if business asks give me the item that EXACTLY matches these parts
> - no more no less, its a valid question too.

Yes, it is.  You just can't answer it in a reasonable manner with 1 table,
or 2 tables. Answering that particular question will probably still require
some imaginative SQL.

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: