473,973 Members | 57,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Design question

I have 3 tables: Message, Workgroup, and Hyperlink. Message has 1xM link
with Hyperlink and Workgroup has 1xM link with Hyperlink. Hyperlink has the
following fields:
IDhyperlink*
IDmessage
IDworkgroup
Name_Hyperlink
In most cases either IDmessage or IDworkgroup will have no value.
Is this a good approach or should I make 2 Hyperlink tables or...?
thanks,
john
Sep 23 '06
18 2130

"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
In article <W5************ ********@casema .nl>, jo**@test.com says...
>"Mike Gramelspacher" <gr******@psci. netschreef in bericht
news:MP******* *************** **@news.psci.ne t...
>>

My previous example should not have the UNIQUE statement,
but it may be that you have 3 many-to-many relationships.

Message-Workgroup is M:M, Message-Hyperlink is M:M and
Hyperlink-Workgroup is M:M.

You have 3 tables and need 3 relationships to resolve them,
so, you need 6 tables.

Thanks. I'll look into that.
john
Here is a small database where I tried to do multiple relations.
http://www.psci.net/gramelsp/temp/Mu...s%20No%202.zip

This was just a learning thing, so take it for what it is worth.
Sorry Mike,
I looked at the zip but that design is just not right at all...
No offence meant, but I take it for learning indeed.

A few comments:
Your table 'Modules' is a single-field-table with a PK on the name 'Modules'.
What if a module with the same name exist in another program ??

Your table 'Procedures' (also single-field) has a PK on the name 'Procedures'.
What if a procedure with the same name exists in another module in another program ??

If I delete a record in ProgramProcedur es we have a procedure left (in ModuleProcedure s) with no program...
If I delete a record in ProgramModules we have a module left (in ModuleProcedure s) with no program...
If I delete a record in ModuleProcedure s we have a procedure left with no module...

Also look at your table 'ProgramProcedu res':
You are (only) storing ProcedureNames together with ProgramNames here.
I guess that procedures 'belong to' modules, and modules 'belong to' programs.
Thus you could store ProcedureName (and author and Type) together with a ModuleProgramID

- - - - -

You are only storing 5 attributes and you are using 8 tables... Why ??
In fact I think you could do with only two tables instead of 8:

TblProgramModul es:
IDProgMod PK
Program
Module Unique index here on Program together with Module

TblProcedures:
IDProgMod FK
ProcedureName Unique index here on ProcedureName together with IDProgMod
ProcedureAuthor
ProcedureType

Arno R
Sep 25 '06 #11
In article <45************ **********@text .nova.planet.nl >,
ar***********@t iscali.nl says...
>
"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
In article <W5************ ********@casema .nl>, jo**@test.com says...
"Mike Gramelspacher" <gr******@psci. netschreef in bericht
news:MP******** *************** *@news.psci.net ...
My previous example should not have the UNIQUE statement,
but it may be that you have 3 many-to-many relationships.

Message-Workgroup is M:M, Message-Hyperlink is M:M and
Hyperlink-Workgroup is M:M.

You have 3 tables and need 3 relationships to resolve them,
so, you need 6 tables.

Thanks. I'll look into that.
john
Here is a small database where I tried to do multiple relations.
http://www.psci.net/gramelsp/temp/Mu...s%20No%202.zip

This was just a learning thing, so take it for what it is worth.

Sorry Mike,
I looked at the zip but that design is just not right at all...
No offence meant, but I take it for learning indeed.

A few comments:
Your table 'Modules' is a single-field-table with a PK on the name 'Modules'.
What if a module with the same name exist in another program ??

Your table 'Procedures' (also single-field) has a PK on the name 'Procedures'.
What if a procedure with the same name exists in another module in another program ??

If I delete a record in ProgramProcedur es we have a procedure left (in ModuleProcedure s) with no program...
If I delete a record in ProgramModules we have a module left (in ModuleProcedure s) with no program...
If I delete a record in ModuleProcedure s we have a procedure left with no module...

Also look at your table 'ProgramProcedu res':
You are (only) storing ProcedureNames together with ProgramNames here.
I guess that procedures 'belong to' modules, and modules 'belong to' programs.
Thus you could store ProcedureName (and author and Type) together with a ModuleProgramID

- - - - -

You are only storing 5 attributes and you are using 8 tables... Why ??
In fact I think you could do with only two tables instead of 8:
Indeed it was a learning attempt. I will look closely at all you have
written. It may be that you have done me a valuable service and that is
appreciated. Thanks.
Sep 25 '06 #12
In article <45************ **********@text .nova.planet.nl >,
ar***********@t iscali.nl says...
>
"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
In article <W5************ ********@casema .nl>, jo**@test.com says...
"Mike Gramelspacher" <gr******@psci. netschreef in bericht
news:MP******** *************** *@news.psci.net ...
My previous example should not have the UNIQUE statement,
but it may be that you have 3 many-to-many relationships.

Message-Workgroup is M:M, Message-Hyperlink is M:M and
Hyperlink-Workgroup is M:M.

You have 3 tables and need 3 relationships to resolve them,
so, you need 6 tables.

Thanks. I'll look into that.
john
Here is a small database where I tried to do multiple relations.
http://www.psci.net/gramelsp/temp/Mu...s%20No%202.zip

This was just a learning thing, so take it for what it is worth.

Sorry Mike,
I looked at the zip but that design is just not right at all...
No offence meant, but I take it for learning indeed.

A few comments:
Your table 'Modules' is a single-field-table with a PK on the name 'Modules'.
What if a module with the same name exist in another program ??

Your table 'Procedures' (also single-field) has a PK on the name 'Procedures'.
What if a procedure with the same name exists in another module in another program ??

If I delete a record in ProgramProcedur es we have a procedure left (in ModuleProcedure s) with no program...
If I delete a record in ProgramModules we have a module left (in ModuleProcedure s) with no program...
If I delete a record in ModuleProcedure s we have a procedure left with no module...

Also look at your table 'ProgramProcedu res':
You are (only) storing ProcedureNames together with ProgramNames here.
I guess that procedures 'belong to' modules, and modules 'belong to' programs.
Thus you could store ProcedureName (and author and Type) together with a ModuleProgramID

- - - - -

You are only storing 5 attributes and you are using 8 tables... Why ??
In fact I think you could do with only two tables instead of 8:
I have looked at some issues.
Yes, a module with the same name can exist in another program, and a
procedure with the same name can exist in another module in another
program. True situations.

I can end up with orphaned procedures, but I do not think it matters.

Of the 8 tables 3 are relationships. I think this is as it should be.

Authors and Types are lookup tables and limit the possibilities to what
is in the lookup tables.

The problems that I see are the cascading deletes. Deleting an entity
may have consequences that are not wanted. I really need to look at
deletes more. I eliminated the cascading deletes.
Sep 26 '06 #13

"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
I have looked at some issues.
I also looked a bit better ... ;-(
My solution still needs some normalizing!!

I was a bit eager skipping some tables, but we need at least 3NF isn't it ??
So 'Programs' should be a separate table and Authors is also a candidate for a separate table.
I will give you the revised table-structure at the end.
Yes, a module with the same name can exist in another program, and a
procedure with the same name can exist in another module in another
program. True situations.

I can end up with orphaned procedures, but I do not think it matters.
Of course that matters !!
Of the 8 tables 3 are relationships. I think this is as it should be.
I disagree
Authors and Types are lookup tables and limit the possibilities to what
is in the lookup tables.
Authors is a candidate indeed as I said above. (My first solution was incomplete)
Because there are only two possible Types I don't think you *need* a separate table for Types
(I would just limit the input with a combo)
But in a 'strict' sense, yes this could be a separate table, so let's add that table as well.
The problems that I see are the cascading deletes. Deleting an entity
may have consequences that are not wanted. I really need to look at
deletes more. I eliminated the cascading deletes.
You should indeed avoid that. Cascading deletes can be very dangerous.

New structure:

TblPrograms:
ProgramID (PK)
ProgramName

TblProgramModul es:
IDProgMod (PK)
ProgramID (FK)
ModuleName Unique index here on ProgramID together with ModuleName

TblProcedures:
ProcedureID (PK)
IDProgMod (FK)
ProcedureName Unique index here on ProcedureName together with IDProgMod
AuthorID (FK)
ProcTypeID (FK)

TblAuthors:
AuthorID (PK)
AuthorName

TblProcedureTyp es:
ProcTypeID (PK)
ProcTypeName
Look at http://home.tiscali.nl/arracom/design.jpg too see the difference between the structures.

Arno R
Sep 26 '06 #14
In article <45************ **********@text .nova.planet.nl >,
ar***********@t iscali.nl says...
>
"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
I have looked at some issues.

I also looked a bit better ... ;-(
My solution still needs some normalizing!!

I was a bit eager skipping some tables, but we need at least 3NF isn't it ??
So 'Programs' should be a separate table and Authors is also a candidate for a separate table.
I will give you the revised table-structure at the end.
Yes, a module with the same name can exist in another program, and a
procedure with the same name can exist in another module in another
program. True situations.

I can end up with orphaned procedures, but I do not think it matters.

Of course that matters !!
Of the 8 tables 3 are relationships. I think this is as it should be.

I disagree
Authors and Types are lookup tables and limit the possibilities to what
is in the lookup tables.

Authors is a candidate indeed as I said above. (My first solution was incomplete)
Because there are only two possible Types I don't think you *need* a separate table for Types
(I would just limit the input with a combo)
But in a 'strict' sense, yes this could be a separate table, so let's add that table as well.
The problems that I see are the cascading deletes. Deleting an entity
may have consequences that are not wanted. I really need to look at
deletes more. I eliminated the cascading deletes.

You should indeed avoid that. Cascading deletes can be very dangerous.

New structure:

TblPrograms:
ProgramID (PK)
ProgramName

TblProgramModul es:
IDProgMod (PK)
ProgramID (FK)
ModuleName Unique index here on ProgramID together with ModuleName

TblProcedures:
This seems to be a correct solution, but it is not my solution.
http://www.psci.net/gramelsp/temp/Mu...ships_No_1.zip

In your solution can you have a program with two modules, which
contain the same procedures?

I am unsure about dangling procedures. I sort of look at the three
entity tables as lookup tables which contain all programs, modules and
procedures which exist in my programs. I compare this to a State_code
lookup table with all U.S. States and Possessions. Certainly I will
never use each and every code.

I agree that function and subprogram could be a value list in a combo
box. That is how I would do it now, although a separate table is not
incorrect.
Sep 26 '06 #15

"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
This seems to be a correct solution, but it is not my solution.
http://www.psci.net/gramelsp/temp/Mu...ships_No_1.zip
Seems all right at first sight, but it is *not* a correct solution...
It is MUCH better than the other one but still wrong.

The Modules table is the problem here.
There is a relation (1:M) between Programs and Modules. We don't see that relation here.

What if we might like to simply count the *exact* number of modules ??
We can't do this reliably because we can have modules with the same name...
Or what if we want to know in what Program the module "XXX" exists ??
If we delete the procedures belonging to that module the 'link' is lost!!
That is only because the structure is wrong!!

In my solution we do not have these problems. It is more 'bullet-proof'.
Also the relationships are more 'clear' (at least the way I look at them)
In your solution can you have a program with two modules, which
contain the same procedures?
No, but since Access will not allow that, I did not allow that.
I said: "Unique index here on ProcedureName together with IDProgMod"
This index is meant to prevent just that possibility.

If we need that possibility we can do so by changing or removing that specific index in TblProcedures.
We could allow duplicates for ProcedureName. (but why ???)
I am unsure about dangling procedures. I sort of look at the three
entity tables as lookup tables which contain all programs, modules and
procedures which exist in my programs. I compare this to a State_code
lookup table with all U.S. States and Possessions. Certainly I will
never use each and every code.
If you want to 'get it right' you will have to learn to look differently...

You can *not* compare your tables with a Lookup table like the State_Codes.
But I guess I simply don't understand what you are trying to say here...
I agree that function and subprogram could be a value list in a combo
box. That is how I would do it now, although a separate table is not
incorrect.
I agree on this,

Arno R
Sep 26 '06 #16
In article <45************ **********@text .nova.planet.nl >,
ar***********@t iscali.nl says...
>
"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
This seems to be a correct solution, but it is not my solution.
http://www.psci.net/gramelsp/temp/Mu...ships_No_1.zip

Seems all right at first sight, but it is *not* a correct solution...
It is MUCH better than the other one but still wrong.

The Modules table is the problem here.
There is a relation (1:M) between Programs and Modules. We don't see that relation here.

What if we might like to simply count the *exact* number of modules ??
We can't do this reliably because we can have modules with the same name...
Or what if we want to know in what Program the module "XXX" exists ??
If we delete the procedures belonging to that module the 'link' is lost!!
That is only because the structure is wrong!!

In my solution we do not have these problems. It is more 'bullet-proof'.
Also the relationships are more 'clear' (at least the way I look at them)
In your solution can you have a program with two modules, which
contain the same procedures?

No, but since Access will not allow that, I did not allow that.
I said: "Unique index here on ProcedureName together with IDProgMod"
This index is meant to prevent just that possibility.

If we need that possibility we can do so by changing or removing that specific index in TblProcedures.
We could allow duplicates for ProcedureName. (but why ???)
I am unsure about dangling procedures. I sort of look at the three
entity tables as lookup tables which contain all programs, modules and
procedures which exist in my programs. I compare this to a State_code
lookup table with all U.S. States and Possessions. Certainly I will
never use each and every code.

If you want to 'get it right' you will have to learn to look differently...

You can *not* compare your tables with a Lookup table like the State_Codes.
But I guess I simply don't understand what you are trying to say here...
I agree that function and subprogram could be a value list in a combo
box. That is how I would do it now, although a separate table is not
incorrect.

I agree on this,

Arno R
Is the second example equivalent to your design?
http://www.psci.net/gramelsp/temp/Relationships.jpg

I will work with both designs, but I do not have the time to devote to
it now. I will get back in the not too distant future, but I want to
make working databases using both designs.

With the other design it was still possible to get a count of modules,
but not as easily as with your design.

I wanted to get all my program names, modules names and procedure names
into tables and then build the relationships. The way I was thinking
the entities would only be lookup tables.

Anyway, I cannot really do anything now. I sincerely appreciate you
kind help. Your design looks to be the correct one. Thanks.

Sep 26 '06 #17

"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
Is the second example equivalent to your design?
http://www.psci.net/gramelsp/temp/Relationships.jpg
Yes, the 'bottem' design is equivalent. This design is all right as far as I can see now.
The main difference I notice is in the ID of the Programs-Modules table.
Some people like a PK which is single RecordID, more than a composite PK.
(It's more easy when we need to get a specific record)
I will work with both designs, but I do not have the time to devote to
it now. I will get back in the not too distant future, but I want to
make working databases using both designs.
==>I would use the second design, because the other one is NOT right...
With the other design it was still possible to get a count of modules,
but not as easily as with your design.
You can NOT get a *reliable* count of modules. Also you could get orphan modules.
(Sorry if I am nitpicking here)
I wanted to get all my program names, modules names and procedure names
into tables and then build the relationships. The way I was thinking
the entities would only be lookup tables.
Anyway, I cannot really do anything now. I sincerely appreciate you
kind help. Your design looks to be the correct one. Thanks.
You are welcome

Arno R
Sep 26 '06 #18
In article <45************ **********@text .nova.planet.nl >,
ar***********@t iscali.nl says...
>
"Mike Gramelspacher" <gr******@psci. netschreef in bericht news:MP******** *************** *@news.psci.net ...
Is the second example equivalent to your design?
http://www.psci.net/gramelsp/temp/Relationships.jpg

Yes, the 'bottem' design is equivalent. This design is all right as far as I can see now.
The main difference I notice is in the ID of the Programs-Modules table.
Some people like a PK which is single RecordID, more than a composite PK.
(It's more easy when we need to get a specific record)
I will work with both designs, but I do not have the time to devote to
it now. I will get back in the not too distant future, but I want to
make working databases using both designs.

==>I would use the second design, because the other one is NOT right...
With the other design it was still possible to get a count of modules,
but not as easily as with your design.

You can NOT get a *reliable* count of modules. Also you could get orphan modules.
(Sorry if I am nitpicking here)
I wanted to get all my program names, modules names and procedure names
into tables and then build the relationships. The way I was thinking
the entities would only be lookup tables.
Anyway, I cannot really do anything now. I sincerely appreciate you
kind help. Your design looks to be the correct one. Thanks.

You are welcome

Arno R
Number of modules is 8, but number of modules in relationships is 4.
I will double check, but

Query: Distinct_module
SELECT DISTINCT DatabaseCodeQue ry.ModuleName
FROM DatabaseCodeQue ry;

together with
SELECT Count(Distinct_ module.ModuleNa me) AS CountOfModuleNa me
FROM Distinct_module ;

I am referring to Multiple Modules No 1. mdb, and DatabaseCodeQue ry
already is there.

It seems to work.

The main thing I need to model is than the same module name can be in
different programs, but have different procedures. That is the crux of
the problem.

Mike
Sep 26 '06 #19

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

Similar topics

5
674
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of generic design patterns that can be used and shared amongst many sub-schemas. For example, the grouping of entities. I may have the following tables: employee, product and client. These tables have no direct relationship with each other. But...
9
2958
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with a device. The definition of the table is as follows: CREATE TABLE devicedata ( device_id int NOT NULL REFERENCES devices(id), -- id in the device
2
2461
by: Test User | last post by:
Hi all, (please excuse the crosspost as I'm trying to reach as many people as possible) I am somewhat familiar with Access 2000, but my latest project has me stumped. So, I defer to you experts. I've been asked to create a Daily Log sheet to be distributed to some of our clerks. For each day, the clerk is to log tasks worked on for the day, (i.e worked on the johnson account).
6
2135
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is responsible for instantiating the orders class? Would it be the ui layer or the master class in the business layer? thanks,
17
2751
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
17
4880
by: roN | last post by:
Hi, I'm creating a Website with divs and i do have some troubles, to make it looking the same way in Firefox and IE (tested with IE7). I checked it with the e3c validator and it says: " This Page Is Valid XHTML 1.0 Transitional!" but it still wouldn't look the same. It is on http://www.dvdnowkiosks.com/new/theproduct.php scroll down and recognize the black bottom bar when you go ewith firefox(2.0) which isn't there with IE7. Why does...
6
2151
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often times when I program, I will create objects for a specific purpose for a program and if I need to add to it I just add the code.
0
2096
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently structured relational database system. The CMS stores articles. The CMS also stores related items --...
19
3194
by: neelsmail | last post by:
Hi, I have been working on C++ for some time now, and I think I have a flair for design (which just might be only my imagination over- stretched.. :) ). So, I tried to find a design certification, possibly that involves C++, but, if not, C++ and UML. All I could find was Java + UML design certifications (one such is detailed on http://www.objectsbydesign.com/tools/certification.html). Although UML is expected to be language independent,...
8
2247
by: indrawati.yahya | last post by:
In a recent job interview, the interviewer asked me how I'd design classes for the following problem: let's consider a hypothetical firewall, which filters network packets by either IP address, port number, or both. How should we design the classes to represent these filters? My answer was: class FilterRule {
0
10347
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11809
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11399
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10901
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6408
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6542
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4726
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.