Re: Relational Modelling Question

From: Reinier Post <rp_at_raampje.lan>
Date: 22 Apr 2010 22:36:37 GMT
Message-ID: <4bd0cf75$0$14118$703f8584_at_textnews.kpn.nl>


Daniel Austria wrote:

>Hi,
>
>i m not sure if i m right in this group, but i think relational
>database modelling is a theoretical issue:

Not really. You're not here to discuss theory, but to apply it.

>I have to following (simplified) situation. I have a company which
>sells
>
>- simply one article
>- a basket with an amount of the same article
>- a customer special bill of material (n articles with amount)
>
>Now the question is: How should i correctly model that with sql on a
>relational database?

One table for the articles.
No table for baskets, as far as I can see. One table for customers.
One table for orders, with columns referring to customers and articles, and another column for the amount.
You probably want multiple rows in this table pertaining to the same order. Not sure whether you want some kind of order number to identify the order, you may not need that.

>3 different tables for my products? But than: What should i reference
>in the sales document (also a table)?

I think it's a selection from a table: the rows in the orders table that satisfy certain criteria (having the same order number, or the same customer and order timestamp, or somethign else, depending on how you identify them).

>Constraints:
>- It s not allowed to use positions for the basket
>- It s not allowed to add a foreign key (to the sales document) to the
>article table

Why not?

>In my opinion, this problem is prety much a object orientated
>inheritance problem ...

I don't see how.

-- 
Reinier
Received on Fri Apr 23 2010 - 00:36:37 CEST

Original text of this message