Hi Ciprian,

OK,  I'm  by  no means a DB guru, so a) take this with a grain of salt
and b) feel free to tear it apart if I'm completely wrong! ;]

If  in  fact  your  people and city tables aren't going to change very
often,  then  why  don't  you  just  go  all  the  way  and  keep that
information  somewhere  else in your application and write it straight
to your travel_expenditures table, e.g.:

  travel_expenditures
 -----------------------------------------------
 | id | date  | people    | city    | per_diem |
 -----------------------------------------------
 | 1  | 05.08 | John      | Glasgow |    1.600 |
 | 2  | 05.09 | Mary      | Madrid  |    2.000 |
 | 3  | 06.12 | John      | Madrid  |    1.000 |
 -----------------------------------------------

This  way  you  completely avoid any JOINs. Of course, this only makes
sense  if  your  people and cities information is not likely to change
much at all...

Thursday, April 8, 2004, 3:29:22 AM, you wrote:

CT> Hello,

CT> I have the following structure:

CT>  people
CT> -------------
CT> | id | name |
CT> -------------
CT> | 1  | John |
CT> | 2  | Mary |
CT> -------------

CT>  cities
CT> ----------------
CT> | id | city    |
CT> ----------------
CT> | 1  | Glasgow |
CT> | 2  | Madrid  |
CT> | 3  | Berlin  |
CT> ----------------

CT>  travel_expenditures
CT> -----------------------------------------------
CT> | id | date  | id_people | id_city | per_diem |
CT> -----------------------------------------------
CT> | 1  | 05.08 | 1         | 1       |    1.600 |
CT> | 2  | 05.09 | 2         | 3       |    2.000 |
CT> | 3  | 06.12 | 1         | 2       |    1.000 |
CT> -----------------------------------------------


CT> The `people` and `cities` tables aren't going to be very populated, so a
CT> thought to merge them into something like this:

CT> central_data
CT> -----------------------
CT> | id | name    | type |
CT> -----------------------
CT> | 1  | John    | P    |
CT> | 2  | Glasgow | C    |
CT> | 3  | Mary    | P    |
CT> | 4  | Madrid  | C    |
CT> | 5  | Berlin  | C    |
CT> -----------------------

CT> where central_data.type is P for people and C for cities.


CT> Do you think it is a good ideea ?



CT> --
CT> Best regards,
CT>   Ciprian Trofin





-- 
Best regards,

Carsten R. Dreesbach                   mailto:[EMAIL PROTECTED]
Senior Consultant
Systar, Inc.
8000 Westpark Dr
Suite 450
McLean, VA  22102
USA
Tel:  (703) 556-8436
Fax:  (703) 556-8430
Cel:  (571) 213-7904




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to