Yedidyah Bar-David wrote:
No it's not.
What you can do is called a subquery. That is, do a 'select' on the
output of another select, interpreted as data, not as a table name.
Look carefully at the mentioned URL.

There are no subqueries in MySQL 3.x and 4.0.x, only 4.1.x onwards. However, it is possible to get the same results using joins.


Regarding the number of tables, breaking down one table into many tables is actually in accordance with 'good DB practice' - normalization.


You usually have 1st, 2nd, 3rd and BCNF normal forms, each one being more and more strict about how the data is structured. Real world DBs should usually be in 3rd NF or BCNF (there are theoretical higher levels).

As a rule of thumb, I think having something similar to encapsulation in OOP is good - each table contains whatever is relevant and no more. E.g a customer table can have names, ID's, phone numbers etc., but all of the transactions a customer performed should be in a transactions table (ofcourse this requires foreign keys and the like).

Keeping one big table brings about many problems - e.g. what happens when a customer makes a few transactions? Do you keep a few duplicate rows of the same customer, one for each transaction? How do you keep track of the duplicates and maintain their integrity when you update one?
All this can be avoided using normalized tables.


Cheers,
Gad

--
http://chookies.homeunix.org

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to