473,782 Members | 2,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

which table design is more correct?

Hi,

I want to create a table like this:

ID Autonum
Datefld Date
Cat Text
Itm Text
tCount Number

Data would look like this:

Data would look like this:

ID Datefld Cat Itm tCount
1 1/1/03 A itm1 3
2 1/1/03 A itm2 4
....
20 1/1/03 A itm20 2
21 1/1/03 B itm1 4
22 1/1/03 B itm2 5
....
40 1/1/03 B itm20 7
....
121 1/1/03 G itm1 8
....
140 1/1/03 G itm20 14
141 1/2/03 A itm1 7
....
160 1/2/03 A itm20 16
161 1/2/03 B itm1 9
....
281 1/3/03 A itm1 22
....

There are 7 categories A, B, C,... G. Each category
contains 20 Items per day, and a count of each item in
each category for each day. Someone at my place is telling
me that the correct way to create my table to to have 2
tables Master Table, Detail Table.

The Master table would contain the ID field, Date field,
and Cat field. The Detail table would contain the ID
field, Itm field and Count field. The argument is that
each category should be listed only one time per day, and
relate to the Detail table by ID. Data would now look
like this:

Master Table
ID Datefld Cat
1 1/1/03 A
2 1/1/03 B
...
7 1/1/03 G
8 1/2/03 A

Detail Table
ID Itm tCount
1 itm1 ...
1 itm2 ...
....
1 itm20 ...
2 itm1 ...
....

This seems a little redundant to me. You have less rows
in the Master table but the same number of rows in the
Detail table as with my original plan of using just one
table. The second design contains an extra column and an
extra table and joins I would now have to deal with.

So my question is - for my purposes - just to query count of items per
category per date range (real basic queries),
which of the 2 designs described here is more
correct/practical? Any suggestions appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
5 1874
Seems to me that your friend is correct. Since you said "each Category has
20 Items per day" that tell me you have a one-to-many relationship between
the items and the categories. If you make a form for your Category info and
a linked subform for your items data, then you will only enter the data in
the Date and Category fields once for all 20 items, etc. This is the idea
of a relational database. One of the ways you can check this is to go to
the Tools.Analyze.T able feature in your MS Access database and analyze your
table. It will help you to decide. Let me know who wins.

Denny G.
"mm nn" <bb******@hotma il.com> wrote in message
news:3f******** *************** @news.frii.net. ..
Hi,

I want to create a table like this:

ID Autonum
Datefld Date
Cat Text
Itm Text
tCount Number

Data would look like this:

Data would look like this:

ID Datefld Cat Itm tCount
1 1/1/03 A itm1 3
2 1/1/03 A itm2 4
...
20 1/1/03 A itm20 2
21 1/1/03 B itm1 4
22 1/1/03 B itm2 5
...
40 1/1/03 B itm20 7
...
121 1/1/03 G itm1 8
...
140 1/1/03 G itm20 14
141 1/2/03 A itm1 7
...
160 1/2/03 A itm20 16
161 1/2/03 B itm1 9
...
281 1/3/03 A itm1 22
...

There are 7 categories A, B, C,... G. Each category
contains 20 Items per day, and a count of each item in
each category for each day. Someone at my place is telling
me that the correct way to create my table to to have 2
tables Master Table, Detail Table.

The Master table would contain the ID field, Date field,
and Cat field. The Detail table would contain the ID
field, Itm field and Count field. The argument is that
each category should be listed only one time per day, and
relate to the Detail table by ID. Data would now look
like this:

Master Table
ID Datefld Cat
1 1/1/03 A
2 1/1/03 B
..
7 1/1/03 G
8 1/2/03 A

Detail Table
ID Itm tCount
1 itm1 ...
1 itm2 ...
...
1 itm20 ...
2 itm1 ...
...

This seems a little redundant to me. You have less rows
in the Master table but the same number of rows in the
Detail table as with my original plan of using just one
table. The second design contains an extra column and an
extra table and joins I would now have to deal with.

So my question is - for my purposes - just to query count of items per
category per date range (real basic queries),
which of the 2 designs described here is more
correct/practical? Any suggestions appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
A good example of our discussion is the Categories form in the Northwind
Sample Database that ships with your version of MS Access. This form has
Categories as the main form and Products in the subform.

Denny G.
"mm nn" <bb******@hotma il.com> wrote in message
news:3f******** *************** @news.frii.net. ..
Hi,

I want to create a table like this:

ID Autonum
Datefld Date
Cat Text
Itm Text
tCount Number

Data would look like this:

Data would look like this:

ID Datefld Cat Itm tCount
1 1/1/03 A itm1 3
2 1/1/03 A itm2 4
...
20 1/1/03 A itm20 2
21 1/1/03 B itm1 4
22 1/1/03 B itm2 5
...
40 1/1/03 B itm20 7
...
121 1/1/03 G itm1 8
...
140 1/1/03 G itm20 14
141 1/2/03 A itm1 7
...
160 1/2/03 A itm20 16
161 1/2/03 B itm1 9
...
281 1/3/03 A itm1 22
...

There are 7 categories A, B, C,... G. Each category
contains 20 Items per day, and a count of each item in
each category for each day. Someone at my place is telling
me that the correct way to create my table to to have 2
tables Master Table, Detail Table.

The Master table would contain the ID field, Date field,
and Cat field. The Detail table would contain the ID
field, Itm field and Count field. The argument is that
each category should be listed only one time per day, and
relate to the Detail table by ID. Data would now look
like this:

Master Table
ID Datefld Cat
1 1/1/03 A
2 1/1/03 B
..
7 1/1/03 G
8 1/2/03 A

Detail Table
ID Itm tCount
1 itm1 ...
1 itm2 ...
...
1 itm20 ...
2 itm1 ...
...

This seems a little redundant to me. You have less rows
in the Master table but the same number of rows in the
Detail table as with my original plan of using just one
table. The second design contains an extra column and an
extra table and joins I would now have to deal with.

So my question is - for my purposes - just to query count of items per
category per date range (real basic queries),
which of the 2 designs described here is more
correct/practical? Any suggestions appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #3
Thanks for your reply. I am just thinking that dealing with one table is
easier than dealing with two tables. I guess either way would be correct, but
I just don't see any benefit from having a master table and a detail table. One
table would seem like less work because I would not have to deal with
relationships, it would be one less column to deal with (link ID to ID). It
looks like it could be one or the other.
Nov 12 '05 #4
TC

"Rpng123" <rp*****@aol.co m> wrote in message
news:20******** *************** ****@mb-m22.aol.com...
Thanks for your reply. I am just thinking that dealing with one table is
easier than dealing with two tables. I guess either way would be correct, but I just don't see any benefit from having a master table and a detail table. One table would seem like less work because I would not have to deal with
relationships, it would be one less column to deal with (link ID to ID). It looks like it could be one or the other.


You need to read
http://support.microsoft.com/support...es/Q100139.ASP

HTH,
TC

Nov 12 '05 #5

That was a very interesing article. So I am now convinced. My actual
question should have been - which is better? Less tables or less
repeating rows?

I was thinking less tables, but the literature appears to say that less
repeating rows is correct for rdbms. So I will go with that.

How about this? The place where I am at they have the master table and
detail table, but the data in the detail table is stored horizontally.
Like 20 int fields. These fields are what I was calling Itm fields.
Each category has 20 Items. Instead of storing data like this in the
detail table:

ID Itm1 Itm2 Itm3 ... Itm20
1 3 17 13 8
2 4 6 5 19
...

wouldn't it be more correct to store it this way in the detail table?

ID Itm tCount
1 itm1 3
1 itm2 4
...itm20 8
2 itm1 4
2 itm2 6
...
2 itm20 19
...

Then you pick the data you need and pivot it horizontally. Isn't that
the correct way to do it? Just asking.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #6

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

Similar topics

9
3212
by: Gleep | last post by:
sorry i didn't explain it correctly before my table is like this example fields: ID name username outcome date1 date2 date3 (etc..) - date15 price1 price2 price3 (etc..) I know that Mysql query order by will compare records on a specific date, but how do i compare multiple fields within the same record. Want to find the latest date within the record..
0
2158
by: Philip Meyer | last post by:
1) setting image as Background with alignment in center not working..help Explanation : i need to set a image as background and also it should be dispalyed in the center.i am using apache fop 0.25 Problem : i am using apache fop 0.25 and i used the below to set a gif as background and alignment to be center...
6
1827
by: BT | last post by:
I'm trying to format a three column table and I can't get things to line up the way I need to. The first column is text of variable length that might wrap onto multiple lines. It is within <p></p> tags to right/left justify it. The second column is a column of ditto marks, centered left/right in the cell and aligned with the bottom line of text of column 1. The third column is a column of numbers also aligned with the bottom line of...
15
2143
by: kimi | last post by:
I have just started working on a project that is partially complete. It is an application that is using access to store test results. The test results are being stored in two Access 2000 databases. DB #1 = StudentDB DB #2 = TestResulstsDB Why are there 2 dbs? I do not know - but that is one of the tings that we will be changing. Combining all of the data into one database.
5
8912
by: nishantxl | last post by:
Hi there, I am looking to design a project using C++ The main objective of the project is to display details of periodic table elements such as periodic element name, properties(such as atomic number and atomic mass) for each periodic number entered by user. I am thinking to input all the data regarding each periodic element number in form of class. Please give your opinion on the correct design method for the same.
13
2876
by: Giggle Girl | last post by:
Hi there, I am having a problem with the behavior of Firefox, where lefthand column content is not resized properly after it is "collapsed" and then "re-expanded". An online demo is available here: http://s161149005.onlinehome.us/DEMOS/FF/RESIZE_PROB/main/frameset.asp It works fine in IE 6, but in Firefox, it is broken. Specifically, when the page/frameset first loads in either browser, it looks correct. But when you click the...
5
3408
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character text field. I want to know which Data type I need to use so that it doesnt waste memory. thanks in advance, rAinDeEr
22
17939
by: klenwell | last post by:
I'm in the process of refactoring the php code base I've amassed over the last few years into an object-oriented framework. I'm about to start in on the authentication/login extension and I've been thinking about different approaches to the mysql table schema that stores basic user login information. At present, user authentication is keyed to a table with the following columns: TABLE: basic_user uid - int handle - varchar *
8
2361
by: =?Utf-8?B?eWRibg==?= | last post by:
I need to write a program validate a text file in CSV format. So I will have a class DataType and a lot of of derived class for various type, e.g. IntType, StringType, FloatType, MoneyType, ... etc. For each column of a type, it may accept null/empty value. or not. It may have various max length for StringType, IntType,... etc.
0
9639
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
10308
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
10143
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
9939
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...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
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
5375
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...
1
4040
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
3
2870
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.