Re: Inserting into multiple tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 11:05 AM -0400 4/12/10, Gary wrote:
-snip-
If normalization is so important, why is it that the INSERT INTO multiple
tables is not a standard command or procedure?.

In my view, you are mixing apples and oranges.

"Normalization" is simply cutting down on repetition. Inserting data into multiple tables is a different critter -- it doesn't make "Normalization" any better or worse.

Just figure out what data you need to acquire, what tables you need to store it in, and then what references you need to what tables/fields to use it while reducing repetition.

For example if you have a customer table, you don't need to add all the customer data to each sales receipt (sales table) when you can simply record the customer's ID.

Likewise with the items that are sold, you don't need to include all the items attributes in the sales receipt (sales table) when you can simply record the items' ID.

None of the above requires some special way to inserting data into multiple tables -- you just record the sales.

Sales table

Sales ID --  Customer ID -- Item ID  -- and probably the date.
1234   -- 6789 --  101112131415  --  4/12/10

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux