473,386 Members | 1,736 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,386 software developers and data experts.

Repeated Attributes in tables (Address, contacts etc)

Hi, i have found out as i have developed the database i've ended up
with a number of tables that have the same attributes.

For instance, my suppliers and customers have the same fields for the
address. Would it make more sense to create an additonal table and to
reference the addressID in the address table?

Some tables like employees have multiple addresses, like home address,
next of kin address etc. Now this is more of an issue for maintance as
if i want to add an additional address field (such as state) then i
would need to add that for each table that has address like fields.

Is this a comon and recommended way? Its not normilsation per se as
this isnt reducing the data it just makes it easier to maintain.

Also, how would i go about mixing a table of contacts, which could
either belong to supplier, customer company etc? A contact wouldnt be
able to have both a supllier and customerID as one would be blank,
would i be better off having a CompanyID FK in the contacts table, and
then in the Companies table a lookup domain value which defines wether
the company is supplier/cuustomer etc?

Appreciate any recommendations on good books for the basic design
scenarios and how they are done professionally. Spent an hour on
google without too much enlightenment hence the post here.

Many thanks in advance,

Chris

Nov 4 '07 #1
7 2112
On Nov 4, 5:01 am, Chris Morley <morl...@gmail.comwrote:
Hi, i have found out as i have developed the database i've ended up
with a number of tables that have the same attributes.

For instance, my suppliers and customers have the same fields for the
address. Would it make more sense to create an additonal table and to
reference the addressID in the address table?

Some tables like employees have multiple addresses, like home address,
next of kin address etc. Now this is more of an issue for maintance as
if i want to add an additional address field (such as state) then i
would need to add that for each table that has address like fields.

Is this a comon and recommended way? Its not normilsation per se as
this isnt reducing the data it just makes it easier to maintain.

Also, how would i go about mixing a table of contacts, which could
either belong to supplier, customer company etc? A contact wouldnt be
able to have both a supllier and customerID as one would be blank,
would i be better off having a CompanyID FK in the contacts table, and
then in the Companies table a lookup domain value which defines wether
the company is supplier/cuustomer etc?

Appreciate any recommendations on good books for the basic design
scenarios and how they are done professionally. Spent an hour on
google without too much enlightenment hence the post here.

Many thanks in advance,

Chris
I was looking at mork with respect to this recently. Mork is an older
Mozilla technology for storing things like addresses.
Supposing I have several siblings and that their last names are all
"Fairfield" and that I have all of my siblings in my address book. How
many times does "Fairfield" appear in the address book mork file?
Once!
We have a (hex) pointer say
11a=Last Name
and another
ffe=Fairfield
and so for each sibling we have a several pairs of pointers, one of
which is:
(11a^ffe)
I see some value in this in a web application which struggles
maintaining a db connection or there is concern about exposing other
more important data in the db to hackers. The data is just saved in
text files. We can interpret this data super fast with regular
expressions and reading a text file may be faster than sending off a
select query to some remote server.
I like this. But is it so efficient as to make it worthwhile? I don't
know. And the Mozilla crowd seems to be abandoning it for SQLite.

Nov 4 '07 #2
Hi Allen,

Thanks for the insight, i think my post got lost so i have re-typed
the message. Sorry if double posts.

I like the idea of having all contacts in one table, but in my case
for employees i would keep additional fields such as salary, paassport
number etc, basically fields which i wouldnt keep for the suppliers or
customers. As the information is not 100% common im still confused how
i can make this flexible but maintain the additional fields above, or
perhaps i should stick with the seperate tables and have an address
fields table such as:

Address Table:
AddressID
Address
State
Country
....etc

EmployeesAddresses (PK on all columns)
CustomerID
AddressID
EmployeeAddressType (Home, Work, next of kin)

SuppliersAddresses (PK on both columns)
SupplierID
AddressID

This way i get the address fields which are common into one table, and
the specific information can sit in Employees, Customers, Supplier
tables etc.

I do like the idea of the roles, but i have one question. Say for
example i have an HoursBooked table which stores what employees have
been working on what project (EmployeeID, ProjectID, hours). The
employee is defined as a contact which has a employee role. Now, i
enter the details in the table for a particular employee, and then at
some point in the future the Employee role is removed from that
contact. On the hours entry form i am doing a lookup of employee's
only (contacts who have an employee role), howeverr as that contact is
no longer an employee they will not be listed but at the same time the
record is still there and we have a problem as the name cannot be
found as it doesnt exist in the list. I can see it becomes more
flexible but i have to include additional checking in my business
object tier to ensure everything stays in sync and remains logical.

Are there any specific pointers to the above scenarios?

Many thanks,

Chris

Nov 5 '07 #3
Re your first question, you can subclass if necessary. That is, the generic
"client" table contains all the fields that are relevant for most clients.
Then use related tables for the additional fields specific to each specific
subtype. Sometimes that's the best way to go; other times it is overkill,
i.e. you can just leave those fields in the client table, but when you build
the interface for the employees you include the fields for them on that
form.

Your question about roles that cease to be relvant is an issue. One approach
is to include a StartDate (when the client first took that role) and EndDate
(when the client ceased holding that role, null for current roles.) In this
way, you maintain the relevant information over time, and you can identify
those who are currently active or inactive in the role. If you are using a
combo, you can then sort the clients so the inactive ones are listed after
the active ones (with " (inactive)" after their name) so their names still
appear in the combo correctly instead of showing as blank.

It does involve more checking, as you say. Depends whether the flexibility
you gain is worth the effort to develop, and the answer will be different in
different scenarios.

As always, the goal is the very simplest solution that will cope with all
cases you could need to handle.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chris Morley" <mo*****@gmail.comwrote in message
news:11**********************@v3g2000hsg.googlegro ups.com...
Hi Allen,

Thanks for the insight, i think my post got lost so i have re-typed
the message. Sorry if double posts.

I like the idea of having all contacts in one table, but in my case
for employees i would keep additional fields such as salary, paassport
number etc, basically fields which i wouldnt keep for the suppliers or
customers. As the information is not 100% common im still confused how
i can make this flexible but maintain the additional fields above, or
perhaps i should stick with the seperate tables and have an address
fields table such as:

Address Table:
AddressID
Address
State
Country
...etc

EmployeesAddresses (PK on all columns)
CustomerID
AddressID
EmployeeAddressType (Home, Work, next of kin)

SuppliersAddresses (PK on both columns)
SupplierID
AddressID

This way i get the address fields which are common into one table, and
the specific information can sit in Employees, Customers, Supplier
tables etc.

I do like the idea of the roles, but i have one question. Say for
example i have an HoursBooked table which stores what employees have
been working on what project (EmployeeID, ProjectID, hours). The
employee is defined as a contact which has a employee role. Now, i
enter the details in the table for a particular employee, and then at
some point in the future the Employee role is removed from that
contact. On the hours entry form i am doing a lookup of employee's
only (contacts who have an employee role), howeverr as that contact is
no longer an employee they will not be listed but at the same time the
record is still there and we have a problem as the name cannot be
found as it doesnt exist in the list. I can see it becomes more
flexible but i have to include additional checking in my business
object tier to ensure everything stays in sync and remains logical.

Are there any specific pointers to the above scenarios?

Many thanks,

Chris
Nov 5 '07 #4
I'll throw in my two cents, as well.

Many times having one table for multiple "types" of people can cause
security issues. You might not want everyone to see your HR data, or
Client list, etc.

If you wanted to keep a Employees Table, Customer Table, Shippers
Table, etc. then you could:
tblAddresses:
AddressID AutoNumber
EmployeeID Long Int, Allow Nulls
CustomerID Long Int, Allow Nulls
ShipperID Long Int, Allow nulls.
When you join the address table to the Employees Table on Employee ID,
it will only show employee Addresses. I've modeled database like this
in the past, and it works well.

Chris Nebinger

On Nov 5, 6:05 am, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
Re your first question, you can subclass if necessary. That is, the generic
"client" table contains all the fields that are relevant for most clients.
Then use related tables for the additional fields specific to each specific
subtype. Sometimes that's the best way to go; other times it is overkill,
i.e. you can just leave those fields in the client table, but when you build
the interface for the employees you include the fields for them on that
form.

Your question about roles that cease to be relvant is an issue. One approach
is to include a StartDate (when the client first took that role) and EndDate
(when the client ceased holding that role, null for current roles.) In this
way, you maintain the relevant information over time, and you can identify
those who are currently active or inactive in the role. If you are using a
combo, you can then sort the clients so the inactive ones are listed after
the active ones (with " (inactive)" after their name) so their names still
appear in the combo correctly instead of showing as blank.

It does involve more checking, as you say. Depends whether the flexibility
you gain is worth the effort to develop, and the answer will be different in
different scenarios.

As always, the goal is the very simplest solution that will cope with all
cases you could need to handle.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chris Morley" <morl...@gmail.comwrote in message

news:11**********************@v3g2000hsg.googlegro ups.com...
Hi Allen,
Thanks for the insight, i think my post got lost so i have re-typed
the message. Sorry if double posts.
I like the idea of having all contacts in one table, but in my case
for employees i would keep additional fields such as salary, paassport
number etc, basically fields which i wouldnt keep for the suppliers or
customers. As the information is not 100% common im still confused how
i can make this flexible but maintain the additional fields above, or
perhaps i should stick with the seperate tables and have an address
fields table such as:
Address Table:
AddressID
Address
State
Country
...etc
EmployeesAddresses (PK on all columns)
CustomerID
AddressID
EmployeeAddressType (Home, Work, next of kin)
SuppliersAddresses (PK on both columns)
SupplierID
AddressID
This way i get the address fields which are common into one table, and
the specific information can sit in Employees, Customers, Supplier
tables etc.
I do like the idea of the roles, but i have one question. Say for
example i have an HoursBooked table which stores what employees have
been working on what project (EmployeeID, ProjectID, hours). The
employee is defined as a contact which has a employee role. Now, i
enter the details in the table for a particular employee, and then at
some point in the future the Employee role is removed from that
contact. On the hours entry form i am doing a lookup of employee's
only (contacts who have an employee role), howeverr as that contact is
no longer an employee they will not be listed but at the same time the
record is still there and we have a problem as the name cannot be
found as it doesnt exist in the list. I can see it becomes more
flexible but i have to include additional checking in my business
object tier to ensure everything stays in sync and remains logical.
Are there any specific pointers to the above scenarios?
Many thanks,
Chris- Hide quoted text -

- Show quoted text -

Nov 5 '07 #5
Thanks for the replies. In keeping the common data in one table, and
moving specific data into sub-tables, wouldnt we need to perform a 1:1
join? This is where it starts getting complicated, i am using
CSLA .NET framework for my business object and typically business
objects are derived from individual tables. The code generator will
derive business objects over multiple tables as required but obviously
the more joins and tables involved the more complicated it is to
devlop. It certainly can handle 1:1 joins and 1:many joins (sub lists)
so maybe i will look into this to reduce the repeating attributes.

Many thanks,

Chris

Nov 6 '07 #6
Just to say, If the CSLA business objects is going off topic please
ignore that part as i am using that for web front end and access for
the desktop front end so the 1:1 joins are still applicable and i am
interested in that part not business objects per se.

Many Thanks,

Chris

Nov 6 '07 #7
Yes, you seem to be thinking well about this, Chris.

As I suggested, avoid subclassing unless it's really needed. Keeping it as
simple as possible is one of your goals, so if you can get away without the
extra tables, so much the better.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chris Morley" <mo*****@gmail.comwrote in message
news:11*********************@d55g2000hsg.googlegro ups.com...
Just to say, If the CSLA business objects is going off topic please
ignore that part as i am using that for web front end and access for
the desktop front end so the 1:1 joins are still applicable and i am
interested in that part not business objects per se.

Many Thanks,

Chris
Nov 6 '07 #8

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

Similar topics

3
by: xAvailx | last post by:
I apologize ahead of time for the long post... Background: Working on a CRM type custom application. The application is for an event management company. The company will provide the application...
0
by: WindAndWaves | last post by:
Hi Gurus Here is another question that I have been struggling with for over a year. Basically, I would like to allow users to enter data into three tables in at the same time. The reason it...
3
by: Scotty | last post by:
I have a database which is made up of several tables "contacts", "coaching", "clubs" etc. The Contact and coach tables are linked by an "ID" field. The Contact and clubs table are linked a by a...
2
by: Burghew | last post by:
Hi all, Kindly help me out on this one. I am having a computer shop and we have many IT related equipments nearly 30 categories which comprises of Servers, Laptops, PC's, Printers, routers,...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
2
by: ringo | last post by:
I've come accross an interesting problem populating an asp.net datagrid. I am trying to bind XML data to a datagrid as I've done in countless other applications, the only difference this time being...
2
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two...
13
by: farhaaad | last post by:
Dears, I have many feilds in my tables that are left blank for some records, If I make a sub table for it and and change those feilds to a lookup feilds so only those options are chosen which...
3
Sandboxer
by: Sandboxer | last post by:
I am not a coder, so please bear with me while I attempt to explain in only the surface language of Access. I have created a form to input all information about each of my customers. The base form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.