[PHP-DB] novice on table design

2005-05-13 Thread tony yau

Hi all,

I have the following tables

EmployeeCustomernon-CustomerAddress
=======
pkey pkeypkey
pkey
number type type
...
payrate grantcapital

I need to allow the three types of people to have n addresses, so I've added
a type to distinguish the 3 types of people and their respective pkey onto
address table.

Address
=
pkey
...
type(either Employee, Customer or non-Customer etc)
fkey(the pkey of Employee, Customer or non-Customer etc)

I know this design looks awkward but it does have the advantage of having
less tables otherwise.
BUT somehow it doesn't feel right. Can someone points me its pros and cons.

thanks all.
Tony Yau

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



Re: [PHP-DB] novice on table design

2005-05-13 Thread tony yau
Hi Miguel,
Thanks for the reply.

the non-customer is actually a Shop, so Employee, Customer and Shop are
distinct enough to have their own tables. Now they all have an Address, and
the problem is how do I allow multiple addresses for each these 'people'
(without using
a lookup table)

tony.

Miguel Guirao [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The schema of your table is wrong, is you do bnormalize it you will find
out
 that you need two tables for this approach.

 One table for your people and another one for the n addresses of your
 people.

 If you keep your current schema, you will have as many rows for one person
 as many addresses for that person you have, and you will be duplicating
many
 fields. So you must split your tables, one for your people and another for
 your people's addresses.

 -Original Message-
 From: tony yau [mailto:[EMAIL PROTECTED]
 Sent: Viernes, 13 de Mayo de 2005 09:27 a.m.
 To: php-db@lists.php.net
 Subject: [PHP-DB] novice on table design



 Hi all,

 I have the following tables

 EmployeeCustomernon-Customer
Address
 =======
 pkey pkeypkey
 pkey
 number type type
 ...
 payrate grantcapital

 I need to allow the three types of people to have n addresses, so I've
added
 a type to distinguish the 3 types of people and their respective pkey onto
 address table.

 Address
 =
 pkey
 ...
 type(either Employee, Customer or non-Customer etc)
 fkey(the pkey of Employee, Customer or non-Customer etc)

 I know this design looks awkward but it does have the advantage of having
 less tables otherwise.
 BUT somehow it doesn't feel right. Can someone points me its pros and
cons.

 thanks all.
 Tony Yau

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

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



[PHP-DB] ways of making access and visib compat with 4 and 5

2005-03-14 Thread tony yau
hi all,

I'm trying to make my classes compat with php4 and php5 is there a way of
doing something like this:

if( version== 4)
define( VISIBILITY,  );
else if (version==5)
define( VISIBILITY, protected );

class Flex
{
 VISIBILITY function CompatFunc();
}
-- 

Tony Yau

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