473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Table Relation

VS2008
I have created 3 tables.

Vendors
Customers
PhoneNumbers

each have their own key
Vendor has: VendorID - int unique identifier
Customer has: CustomerID - int unique identifier

PhoneNumbers have:
PhoneNumberID -int unique identifier
PhoneNumberType - varchar(1)
KeyID - int

I would like ( in the relation ) to linke the Customers Table and the Vendor
Table to the PhoneNumbers Table.
They would both link to KeyID, but PhoneNumberType would either be a letter
"C" or "V".

I cannot figure out how to set this up in the relation. If I could somehow
hardcode a letter in the PhoneNumberType in the relations dialog box...that
would be great - but I must be missing something.

I do not see a point in creating a VendorPhoneNumbers and
CustomerPhoneNumbers table as they will have the exact same columns.

Thanks,

Miro

Aug 26 '08 #1
8 889
I am starting to think I need to create an 'in-between' table.

Table: PhoneLinker
PhoneLinkerID -unique identifier
KeyID - links to VendorID or CustomerID

PhoneLinkerID would linke to the PhoneNumbers.KeyID field.

The other option I was mentioning is not prefered?

Miro

"Miro" <mi**@beero.comwrote in message
news:Ov**************@TK2MSFTNGP03.phx.gbl...
VS2008
I have created 3 tables.

Vendors
Customers
PhoneNumbers

each have their own key
Vendor has: VendorID - int unique identifier
Customer has: CustomerID - int unique identifier

PhoneNumbers have:
PhoneNumberID -int unique identifier
PhoneNumberType - varchar(1)
KeyID - int

I would like ( in the relation ) to linke the Customers Table and the
Vendor Table to the PhoneNumbers Table.
They would both link to KeyID, but PhoneNumberType would either be a
letter "C" or "V".

I cannot figure out how to set this up in the relation. If I could
somehow hardcode a letter in the PhoneNumberType in the relations dialog
box...that would be great - but I must be missing something.

I do not see a point in creating a VendorPhoneNumbers and
CustomerPhoneNumbers table as they will have the exact same columns.

Thanks,

Miro
Aug 26 '08 #2
Miro wrote:
VS2008
I have created 3 tables.

Vendors
Customers
PhoneNumbers

each have their own key
Vendor has: VendorID - int unique identifier
Customer has: CustomerID - int unique identifier

PhoneNumbers have:
PhoneNumberID -int unique identifier
PhoneNumberType - varchar(1)
KeyID - int

I would like ( in the relation ) to linke the Customers Table and the
Vendor Table to the PhoneNumbers Table.
They would both link to KeyID, but PhoneNumberType would either be a
letter "C" or "V".

I cannot figure out how to set this up in the relation. If I could
somehow hardcode a letter in the PhoneNumberType in the relations
dialog box...that would be great - but I must be missing something.

I do not see a point in creating a VendorPhoneNumbers and
CustomerPhoneNumbers table as they will have the exact same columns.
Have you considered having an Organization table instead of separate Vendor and
Customer tables? They are often very similar. You could put the V or C in the
Organization table to separate them. You might even create separate fields for V
and C, so that some organizations could be both - it can happen.

Aug 26 '08 #3
"Steve Gerrard" <my********@comcast.netwrote in message
news:YK******************************@comcast.com. ..
Miro wrote:
>VS2008
I have created 3 tables.

Vendors
Customers
PhoneNumbers

each have their own key
Vendor has: VendorID - int unique identifier
Customer has: CustomerID - int unique identifier

PhoneNumbers have:
PhoneNumberID -int unique identifier
PhoneNumberType - varchar(1)
KeyID - int

I would like ( in the relation ) to linke the Customers Table and the
Vendor Table to the PhoneNumbers Table.
They would both link to KeyID, but PhoneNumberType would either be a
letter "C" or "V".

I cannot figure out how to set this up in the relation. If I could
somehow hardcode a letter in the PhoneNumberType in the relations
dialog box...that would be great - but I must be missing something.

I do not see a point in creating a VendorPhoneNumbers and
CustomerPhoneNumbers table as they will have the exact same columns.

Have you considered having an Organization table instead of separate
Vendor and Customer tables? They are often very similar. You could put the
V or C in the Organization table to separate them. You might even create
separate fields for V and C, so that some organizations could be both - it
can happen.
At one point I want to add more tables that will have phone numbers - such
as.

CompanyDivisions - Yes this will have similar fields
Employee - This will not be simillar as it will be something like a quick
contacts list.

Later im assuming ill make an 'Email' table as well.

This program is not going to be used in the 'real world'. I just am trying
to re-create some things we do at work now to learn all the quirks about it.
Stumbled upon the multi-field key problem.

So far my only solution I have dreamt up with is to have a linker file such
as:

PhoneLinker
LinkerID -Unique - Links to the PhoneNumber File - Later an EmailFile ( and
so on )
CustID -links to customer
VendID - links to vendor
EmployeeID -links to employee

Basically in a record the PhoneID will be unique, and the other 3 fields 99%
of the time ( im assuming 100% ) will have only one of the fields filled in.

I am trying to poke holes in that now to see if thats the right way of going
about it.

Aug 26 '08 #4
And the features you want are ? Multiple phone numbers per vendor or
customer ? Search someone just by it s phone number ? For now I would like
denormalize a bit this and would liekly store the phone number as an
attribute for each user.

--
Patrice

"Miro" <mi**@beero.coma écrit dans le message de groupe de discussion :
ur**************@TK2MSFTNGP03.phx.gbl...
"Steve Gerrard" <my********@comcast.netwrote in message
news:YK******************************@comcast.com. ..
>Miro wrote:
>>VS2008
I have created 3 tables.

Vendors
Customers
PhoneNumbers

each have their own key
Vendor has: VendorID - int unique identifier
Customer has: CustomerID - int unique identifier

PhoneNumbers have:
PhoneNumberID -int unique identifier
PhoneNumberType - varchar(1)
KeyID - int

I would like ( in the relation ) to linke the Customers Table and the
Vendor Table to the PhoneNumbers Table.
They would both link to KeyID, but PhoneNumberType would either be a
letter "C" or "V".

I cannot figure out how to set this up in the relation. If I could
somehow hardcode a letter in the PhoneNumberType in the relations
dialog box...that would be great - but I must be missing something.

I do not see a point in creating a VendorPhoneNumbers and
CustomerPhoneNumbers table as they will have the exact same columns.

Have you considered having an Organization table instead of separate
Vendor and Customer tables? They are often very similar. You could put
the V or C in the Organization table to separate them. You might even
create separate fields for V and C, so that some organizations could be
both - it can happen.

At one point I want to add more tables that will have phone numbers - such
as.

CompanyDivisions - Yes this will have similar fields
Employee - This will not be simillar as it will be something like a quick
contacts list.

Later im assuming ill make an 'Email' table as well.

This program is not going to be used in the 'real world'. I just am
trying to re-create some things we do at work now to learn all the quirks
about it. Stumbled upon the multi-field key problem.

So far my only solution I have dreamt up with is to have a linker file
such as:

PhoneLinker
LinkerID -Unique - Links to the PhoneNumber File - Later an EmailFile (
and so on )
CustID -links to customer
VendID - links to vendor
EmployeeID -links to employee

Basically in a record the PhoneID will be unique, and the other 3 fields
99% of the time ( im assuming 100% ) will have only one of the fields
filled in.

I am trying to poke holes in that now to see if thats the right way of
going about it.
Aug 26 '08 #5
Why not have multiple phone numbers per user/customer/vendor?

My stupid cell phone allows 1 cell phone number, 1 lan, and 1 alternate.
That is not enough in some cases as some people have multiple phones /
offices.

So thats why I would like to create the structure as a 1 to many/(infinite)
phone numbers relation.
I do not want to create a 'field' for each 'Customer / Vendor' to store
numbers. I would like a file relation.

I just couldnt seem to do it my original thought idea way, and the only
solution I am having is to actually create a linker table.

Wondering if the same problem was out there to anyone else who has had to
create a 1 to many relation what the solution was.

I can just as easily create a "CustomerPhoneNumbers", "VendorPhoneNumbers",
"EmployeePhoneNumbers" table, and each would have the exact same fields.
But what would the point be then? I beleive it would be more proper to
store all that in 1 table, and link it to the proper master table as
required.

In this case normalization seems to be the right course of action and not to
denormalize it.

Miro
"Patrice" <http://www.chez.com/scribe/wrote in message
news:69**********************************@microsof t.com...
And the features you want are ? Multiple phone numbers per vendor or
customer ? Search someone just by it s phone number ? For now I would like
denormalize a bit this and would liekly store the phone number as an
attribute for each user.

--
Patrice

"Miro" <mi**@beero.coma écrit dans le message de groupe de discussion :
ur**************@TK2MSFTNGP03.phx.gbl...
>"Steve Gerrard" <my********@comcast.netwrote in message
news:YK******************************@comcast.com ...
>>Miro wrote:
VS2008
I have created 3 tables.

Vendors
Customers
PhoneNumbers

each have their own key
Vendor has: VendorID - int unique identifier
Customer has: CustomerID - int unique identifier

PhoneNumbers have:
PhoneNumberID -int unique identifier
PhoneNumberType - varchar(1)
KeyID - int

I would like ( in the relation ) to linke the Customers Table and the
Vendor Table to the PhoneNumbers Table.
They would both link to KeyID, but PhoneNumberType would either be a
letter "C" or "V".

I cannot figure out how to set this up in the relation. If I could
somehow hardcode a letter in the PhoneNumberType in the relations
dialog box...that would be great - but I must be missing something.

I do not see a point in creating a VendorPhoneNumbers and
CustomerPhoneNumbers table as they will have the exact same columns.
Have you considered having an Organization table instead of separate
Vendor and Customer tables? They are often very similar. You could put
the V or C in the Organization table to separate them. You might even
create separate fields for V and C, so that some organizations could be
both - it can happen.

At one point I want to add more tables that will have phone numbers -
such as.

CompanyDivisions - Yes this will have similar fields
Employee - This will not be simillar as it will be something like a quick
contacts list.

Later im assuming ill make an 'Email' table as well.

This program is not going to be used in the 'real world'. I just am
trying to re-create some things we do at work now to learn all the quirks
about it. Stumbled upon the multi-field key problem.

So far my only solution I have dreamt up with is to have a linker file
such as:

PhoneLinker
LinkerID -Unique - Links to the PhoneNumber File - Later an EmailFile
( and so on )
CustID -links to customer
VendID - links to vendor
EmployeeID -links to employee

Basically in a record the PhoneID will be unique, and the other 3 fields
99% of the time ( im assuming 100% ) will have only one of the fields
filled in.

I am trying to poke holes in that now to see if thats the right way of
going about it.
Aug 26 '08 #6
Miro wrote:
Why not have multiple phone numbers per user/customer/vendor?

My stupid cell phone allows 1 cell phone number, 1 lan, and 1
alternate. That is not enough in some cases as some people have
multiple phones / offices.
My cell phone does the same, and allows any number of numbers per contact. But
it does treat friends, family, business, and other contacts all as contacts.

I think you will find that the linker table doesn't help much, it just pushes
the same problem off to another table. Unless you mean a separate table of links
for each main table, i.e. a table of customer links, a table of vendor links,
etc.

Another option is to use 0 records, and have the phone number contain a
CustomerID, a VendorID, and however many IDs you have tables that need phone
numbers. By establishing a 0 record in Customers, you can then create an
enforced relationship of Customers to the CustomerID field of your phone record.
You just need to be sure to exclude the 0 record when you are retrieving a list
of Customers.

It may or may not work for your situation. I have used it to allow Note records
to be associated with records in several different tables, sometimes linked to
several at once. For example, a Note record can be linked to a contact, or to a
project, or to a quality issue, or to a specific product, and may be linked to
several of those if needed.


Sep 2 '08 #7
"Miro" <mi**@beero.comwrote in message
news:Ow**************@TK2MSFTNGP02.phx.gbl...
>
Wondering if the same problem was out there to anyone else who has had to
create a 1 to many relation what the solution was.
Database design has existed for over 30 years and nearly a half a century.
Your requirements have been solved long before.

This question would get better answers in a database group or forum.
Microsoft has database newsgroups, I assume, and MSDN database forum(s).
There are also other sites, such as:
http://www.dbforums.com.
Sep 14 '08 #8
>>"Database design has existed for over 30 years and nearly a half a
>>century. Your requirements have been solved long before."
Wow computers can do that now?
Thanks for that great information.

My solution was to create 3 seperate tables.

M.
"Sam Hobbs" <sa****@social.rr.com_change_social_to_socalwrot e in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"Miro" <mi**@beero.comwrote in message
news:Ow**************@TK2MSFTNGP02.phx.gbl...
>>
Wondering if the same problem was out there to anyone else who has had to
create a 1 to many relation what the solution was.

Database design has existed for over 30 years and nearly a half a century.
Your requirements have been solved long before.

This question would get better answers in a database group or forum.
Microsoft has database newsgroups, I assume, and MSDN database forum(s).
There are also other sites, such as:
http://www.dbforums.com.

Sep 14 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Juris Krumins | last post by:
Couple a weeks ago (19.08.03 Subject: Temporaty tables) I've posted message with question about errors I'm getting while using create temporaty table command. So I'm start digging in src code as...
3
by: Terrence Brannon | last post by:
I don't know what Postgres considers a relation and had no intention of creating one when piping my schema to it... I always DROP TABLE before CREATE TABLE, so here are the ERRORS emitted when...
3
by: GGerard | last post by:
Hello Does anyone know if it is possible with Access 2000 to create relationships between tables using code? Thanks G.Gerard
6
by: Kevin Chambers | last post by:
Hi all-- In an attempt to commit an Access MDB to a versioning system (subversion), I'm trying to figure out how to convert a jet table's metadata to text, a la SaveAsText. The end goal is to...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
76
MMcCarthy
by: MMcCarthy | last post by:
Normalisation is the term used to describe how you break a file down into tables to create a database. There are 3 or 4 major steps involved known as 1NF (First Normal Form), 2NF (Second Normal...
5
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big...
5
by: mfaisalwarraich | last post by:
Hi, I have a table called mainTable. two fields of this table are SNO which is text and Relation which is also text. there are more than 10 fields in this table. i made a small form called...
4
bugboy
by: bugboy | last post by:
I'm inserting a new word into table 'w' and a definition into table 'c' which are linked in table 's' which is the relation table for the many to many relationship between 'w' and 'c'. I've been...
9
by: Miro | last post by:
VS2008 I have created 3 tables. Vendors Customers PhoneNumbers each have their own key Vendor has: VendorID - int unique identifier Customer has: CustomerID - int unique identifier
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.