473,807 Members | 2,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please offer an opinion on Normalization Question

A database keeps track of invoices (date, amount, balance, category,
etc) and advertisements (size, text, sponsored by, date entered etc)
(among other things).

Sometimes, an advertisement is sponsored by more than one person, so
each one gets an invoice for his or her share of the advertisement,
done by a button to an append query when the ad is created.

Thought 1: Store the ADID in Comment field of tblInvoices.

However, not reliable for linking as Comment is a memo field and can
store additional info (e.g. description of ad).

Thought 2: Add a field to tblInvoices to store ADID.

However, not all Invoices are associated with an Ad, so some space is
being wasted with this field.

Thought 3: use a linking table, invoiceID & AdID.

However, linking fields are usually used in a many-to-many
relationship. This relationship is one-to-many from tbIAds to
tblInvoices. However, the Invoices side can also have one or zero Ads
associated with it, while the Ad can have many invoices associated with
it.

Of course, this approach will also require more work on the part of the
programmer to link the linking table to every query using the AdID,
whereas the second method is simple.

Any further thoughts, comments, will be most appreciated.

May 23 '06 #1
8 1282
If you have multiple payers for a single invoice, you'd need a payments
table something like this:

tblPayments(
PaymentID --- Autonumber,
PayerID --- FK from Payer(PayerID)
PaidToInvoice --- FK from Invoices(Invoic eID)
Payment Amount --- Currency
Payment Date --- Date)

This would act as an intermediary table to break the "many invoices,
many payments" problem.

I would approach it from the query point of view. What kinds of
answers/summaries do you need to do on this information? If you build
a really small DB (a handful of records per table), you can
verify/validate your design before you go too far. you can check the
numbers manually and be sure your design will provide accurate answers
to your questions.

Sort of a roundabout answer, but in a nutshell, your final design
depends on the answers you need out of your database. (You might want
to read the Introduction in Access Developer's Handbook volume I. They
discuss that in the introduction, if I remember right.)

HTH,

Pieter

May 23 '06 #2
I use a one to many relationship all of the time in my DB's. I don't
see why you can't go that route, as you said it makes it much easier on
the programmer and it doesn't matter if there is nothing there as the
space used is probably very minimal and would not impact the DB size
significantly. Just my thoughts

May 23 '06 #3
One point I just realized in your posts - thanks, all - is that if
tblInvoices.ADI D is allowed to be blank, I can't enforce referential
integrity. On the other hand, does a linking table help? Can I
enforce referential integrity in a three-way link?

As for payments, I already have that in tblAllocations - InvoiceID,
PaymentID, amount. This question is unrelated. It's only about
tracking the Ad that led to the Invoice. Payments are only tracked
with reference to the Invoice.

May 23 '06 #4
depends on which is the child record and which is the parent. If your
business rules allow/require you to create childless records, then you
can't use the built-in referential integrity constraints.

What do you mean, a 3-way link? (Example?) You mean the child has to
have three parent records?

May 24 '06 #5
You can use cascading updates, cascading deletes
and referential integrity on optional fields.

The only thing you can't do is set the 'required'
property, or use it as a primary key.

<pe***********@ aol.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
One point I just realized in your posts - thanks, all - is that if
tblInvoices.ADI D is allowed to be blank, I can't enforce referential
integrity. On the other hand, does a linking table help? Can I
enforce referential integrity in a three-way link?

As for payments, I already have that in tblAllocations - InvoiceID,
PaymentID, amount. This question is unrelated. It's only about
tracking the Ad that led to the Invoice. Payments are only tracked
with reference to the Invoice.

May 24 '06 #6
Yes the fact that a field can be null does not restrict the use if
Referential Integrity.

The best way to go in this case is to have ADID in the tblInvoices as a
non required field. (Just be aware that in any quereies that Join
Invoices and ADDs you may need to use Left or Right joins - eg if you
want all invoices and ADD info if it exists).

Just a point from above - There are not several payers for an invoice ,
there are (potentially) several invoices (and hence Payments) for an
Advertisement. It would however be a good idea to have a Client (or
Payers) table in any case.

May 24 '06 #7
tblInvoices tblInvoicesAds tblAds
InvoiceID -----------------> InvoiceID | --------> AdID
Amt AdID-------------|
AdType(Size)
Date
Source
CustomerID
Text
etc.

Where every Invoice does not necessarily have an Ad. For that matter,
it's possible an ad is a courtesy ad with no invoice. Furthermore, the
ad is created first then an invoice is generated so we I'm not sure
when (if) referential integrity can be enforced.

May 25 '06 #8
This isn't that complicated.

You don't need a tblInvoicesAds because there is not a many to many
relationship between Invoices and Ads (unless the original problem is
mis-stated) and an Invoice can be for many Ads as well..

AdID goes in tblInvoices. The fact that it may mostly be null doesn't
matter. The field can be defined as 'not required'. This doesn't stop
RI from working. If a value is put in AdID it must exist in tblAds, if
it is null - then that's ok. Cascade deletes will still work (if
that's what you want) as will cascade updates (Why you'd want that with
IDs as keys ???).

Now it is likely that an invoice can be for an Ad, sale of Stock, any
number of things so you could end up with a whole list of foreign keys
in the tblInvoices and it could be that only one should exist. Nothing
you can do about that - the relational model doesn't cater for it!!

May 25 '06 #9

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

Similar topics

3
3180
by: JoeB | last post by:
I found an interesting thread on this from Nov., 2000, but it didn't fully answer my question. I understand normalization, but am trying to find the line between good database design and personal preference. I'm wondering if I've created too many tables. Normalization as I understand it would be to create tables if a field can have more than one occurrance (for example, book titles by an author). But if a field will only have one value,...
7
2463
by: John Welch | last post by:
I have three tables and the way they are currently set up violates good normalization, but I'm having trouble figuring out a better way. Can someone suggest a more elegant solution? My tables are: tblCompanies: CompanyID - PK other fields like address, type of business, etc
59
5032
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at ASP.NET. At first glance, it looks excellent, albeit nothing that couldn't have been done to Classic ASP. I have been through a few tutorials and was impressed with how quickly you can get database info onto a page.
5
1262
by: matthewtec | last post by:
I realize there are probably many discussions on these two... whether to get now or wait or yadda yadda yadda. My question is that I can continuing training on visual studio.net 2003, and continue to learn and be able to be an experienced programmer. And I fully realize that I'd obviously be missing out on some functionality. However, in the actual phase of getting a job, does anyone have any thoughts that would suggest I would get...
20
6937
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an "Outcomes Database" used to store response data from measures/ questionnaires for a longitudinal health study. It is essentially derived from Duane Hookom's Survey Database (thanks Duane!!!), with many modifications added to fit the needs of my lab.
4
2102
by: wideasleep | last post by:
I'm laying out a form and am in question on my normalization of data and I would appreciate a few opinions if this could be layed out better. I'm trying to follow a one to many all the way through on this. Here's the layout of my tables. tblBuildingInfo ID(pk) Building_Number - lookup Inspection_Date - date/time Inspection_Time - date/time tblChecklistItems ID(pk)
1
2030
by: weird0 | last post by:
I know that is not the appropriate group for asking this question, but I do not know of any better forum. Can anyone plz explain clearly what normalization is? The first three normal forms upto 3NF and BCNF. I know the first one but the remaining ones are really confusing. The language changes dramatically into functional dependencies x---y, all that, and normalization, the real topic is lost in between. Decent explanation or good...
22
2475
by: sophia | last post by:
Dear all, can any one explain what is meant by pointer normalization given here:- http://c-faq.com/ansi/norml.html
4
2891
by: FooFighter | last post by:
I was going to make a database to store a list of my DVD's. I have a question about the table structure though. I want to have some fields for actors. I'm thinking 4 or 5 would be plenty. From what I understand it wouldn't be proper to have fields like Actor1 Actor2 and so on. As I would want to be able to search for a movie based on an actor, how would I structure my tables for this and keep things normalized? I was thinking perhaps another...
0
10624
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
10371
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...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10111
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
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5684
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3853
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
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.