mysql_query(“SELECT * FROM my_table_1”);
mysql_query(“SELECT * FROM my_table_2”);
mysql_query(“SELECT * FROM my_table_3”);
mysql_query(“SELECT * FROM my_table_4”);
…and put all the results in a array and echo that array…?
Do the tables have the same exact structure or are they different?
If they’re the same, write one query which UNIONs the results. If they’re not, then you write 4 bits of code to read the result sets into an array, one at a time.
yeah, combined, if you wish.
it must be advised to anyone who don’t know how to add an item to an array, and so considered as a newcomer to programming arts.
speaking of normal form, we can call it eliminating of repeating groups. What these tables are if not repeating groups?
Ugh, ok.
Probably I’m lack of knowledge and have to buy and study your book.
But so far I am sure that table is a data structure which consists of set of rows which share the same type. And there must be strong reasons to divide it apart.
often, there ~are~ good reasons to split a table into multiple tables
i can think of one really simple example: current_accounts and expired_accounts
these two tables have identical structures, but the current_accounts table is backed up every night and the expired_accounts table is backed up every year
combine them, and you are backing up the expired rows needlessly several hundred times
by the way, sorry, my book does not discuss normalization – just primary keys and foreign keys
Well
I am speaking of general ways, not exceptions. Yes, there are always can be exception.
But when you’re learning, you should learn general way first.
When I see repeated and even enumerated tables, I suspect wrong database design.
Yes, I can invent thousand excuses for it myself. But when I answer a question, I am trying to answer not from mine, but from one’s point of view.
So, if it’s first database design. I’d recommend to make it one table.