|
Posted by Ed Murphy on 02/01/08 02:36
--CELKO-- wrote:
> 4) "So I need to Update them in the order 1,2,3 etc for their
> respective Invoice number"
>
> Unh? SQL is a set-oriented language. Updates are done in whole sets
> and not row-at-a-time. You are confusing tables with magnetic tape
> files. The usual patter is like this skeleton:
>
> CREATE TABLE Invoices
> (invoice_nbr INTEGER NOT NULL PRIMARY KEY,
> ..);
>
> (CREATE TABLE InvoiceDetails
> (invoice_nbr INTEGER NOT NULL
> REFERENCES Invoices (invoice_nbr),
> sku CHAR(10) NOT NULL
> REFERENCES Inventory (sku),
> PRIMARY KEY (invoice_nbr, sku),
> order_qty INTEGER NOT NULL
> CHECK(order_qty > 0),
> ..);
>
> There is no mention of the paper (or video) order form lines in the
> RDBMS. They are physical and the RDBMS is logical. You are really
> missing basic concepts and need to get help.
Many reasonable real-world systems include some type of sort criteria
as well, e.g. OrderDetails may wish to record which line item the
customer ordered first, second, etc. - but of course there's plenty of
room for debate over how best to implement the concept.
[Back to original message]
|