i have two tables (they are fixed, not going to update any more) in my databae "phoneadd"

phone_nos----name(primary id),home,office,college,friend.

john   87954 45698 78965 12365 
martin 45698 78962 45789 45789 
trull  47896 14587 85632 14563 

addresses----name(primary id),address

home       first street,new town
office     second street,old town
college    thrid street,maxi world twon
friend     fourth streed,hobert town

The result have to show only one person details in a vertical table

examble:search result of john will be

Place Name         Address                    Phone number
  home         first street,new town            87954
  office       second street,old town           45698
  college      thrid street,maxi world twon     78965
  friend       fourth streed,hobert town        12365

friends help me.

3 Years
Discussion Span
Last Post by tpunt

I don't understand the logic of your database design. Within your "phone_nos" relation (table), why set the persons name as the primary key when people can (and will) have the same first name. Using the ID column would have made more sense as a primary (auto incrementing) key because it will always be unique.

As for your "addresses" relation, why have the name of the type of phone number as the primary key, when you know you're going to have multiple values for each "home", "office", etc, phone number (for each of your users in the first database). Again, having the ID as the primary (auto incrementing) key would have made more sense.

With this design setup, you also cannot link the two relations together because there's no foreign key to do so (there's no field that is the same within both tables). You therefore could not query for a name in the "phone_nos" relation, and be able to gather data from the "addresses" relation with your current setup.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.