2011/5/4 Merlin Moncure <mmonc...@gmail.com>

> Most of the old school accounting systems maintained an invoice line
> number.
>
> > Invoice Line
> >     -Invoice Number
> >     -LineNo
> >     -ItemID
> >     -qty
> >     -Price
>
> The line number started from 1 (the first line on the invoice) on
> every unique invoice.  This has the added benefit of allowing the
> primary key index (invoice_no, line_no) allowing you to pull up the
> invoice line records in correct order without requiring an extra sort
> and, if you don't need any fields from the invoice, a join.
>
> Compare the two queries pulling up invoice lines over a range of
> invoice numbers.
>
> merlin
>


Thanks, merlin,

And in that case, what is "Natural" in LineNo? I would say, with adding
LineNo we are creating syntethic/surrogate Key (just instead of 1 surrogate
column - it will be Compound key with more columns...)? The same is with all
other tables what are "parts" of an Entity, Serial Numbers, Accounting
Distribution produced by Invoice...etc etc...

Reply via email to