Database folks...help!
coppercoins
Posts: 6,084 ✭✭✭
I'm considering the possibility of creating a database of coin publication articles that will be searchable, and provide it to the world at large through my site, but also make it available to my local club for checking out coin publications that have articles of interest to their specialties. I have been tossing the idea around for a while, and have decided I need help in structuring the database for this project. The idea I have is to make the articles searchable by category - if you are a Seated Dime collector, you would be able to enter "seated dime" and find all of the articles I have found about seated dimes - the issue you would need to find would be listed next to the title of the article....something like a library card catalog system.
All was well in my thinking until I ran into a bit of a snag. What if there is an area that talks mainly about the history of the Carson City mint, then discusses something specific about the seated coins created there. I would want to include the article in "mint history", and also for each of the seated categories mentioned. This would end up building quite a redundancy if I had the volume, publication, pub date, and article title in the DB that many times. So, how should I solve this conundrum?
All was well in my thinking until I ran into a bit of a snag. What if there is an area that talks mainly about the history of the Carson City mint, then discusses something specific about the seated coins created there. I would want to include the article in "mint history", and also for each of the seated categories mentioned. This would end up building quite a redundancy if I had the volume, publication, pub date, and article title in the DB that many times. So, how should I solve this conundrum?
C. D. Daughtrey, NLG
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
0
Comments
New collectors, please educate yourself before spending money on coins; there are people who believe that using numismatic knowledge to rip the naïve is what this hobby is all about.
I do intend on doing one table of nothing but categories, and link them to the article list by cat. number....or at least that's what I think I will do.
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
First Place Winner of the 2005 Rampage design contest!
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
First Place Winner of the 2005 Rampage design contest!
categories
catnumber
catname
articles
articleID
catnumber1
catnumber2
catnumber3
details
articleID
pubname
pubdate
author
title
Dunno, like I said, I'm no good at this stuff, I'm raw and untrained.
description
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
Let's oversimplify and say we have eight categories of articles. We'll assign each one a value based on incrementing powers of two.
Copper coins = 1
Silver coins = 2
Gold coins = 4
Philadelphia Mint = 8
Denver Mint = 16
San Francisco Mint = 32
Circulation strikes = 64
Proof strikes = 128
Now our database record might contain the following fields:
Article title (character datatype)/ Publication (character)/ Date (date)/ Category flags (integer)
The integer field takes only one byte in this example - a very small amount of storage.
If a particular article relates to Proof (128, based on our table above) gold coins (4) from the Philadelphia Mint (8), we would add the flags together (128 + 8 + 4 = 140) and store 140 in the Category flags field. Obviously, you could do this with any number of flags, and make the flags field long enough to store 2^(number of categories).
When you want to retrieve articles related to a particular category, you just search the database for all records where the flags field has the particular bit set that represents the desired category by doing a bitwise AND with a number that has only that bit set. For example, to find all articles that relate to the Denver Mint, you would AND the flags field with the number 16.
I doubt my explanation is very good, but the concept isn't very hard. I'm no programmer, but I've used it in simple programs by finding examples in books and modifying them to suit my needs. It's a good way to store a lot of "yes/no"-type data efficiently.
But I wouldn't say this is the only answer, hopefully some real DB folks will have better suggestions.
[edit] couldn't add three numbers correctly! [/edit]
New collectors, please educate yourself before spending money on coins; there are people who believe that using numismatic knowledge to rip the naïve is what this hobby is all about.
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
I like bit mask idea Kranky, maybe we can use the redbook as a topic directory. I think we will end up needing more than the one byte will represent. Rapid development, love it.
First Place Winner of the 2005 Rampage design contest!
For series and type categories, it would be fine, though.
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
Makes more sense to me to have this article fit in the categories mentioned and have them pulled by category, for which there would be no text search needed. Once again, I'm keeping this as simple and easy to do as possible. My only problem is in multiple categories for a single article.
The Lincoln cent store:
http://www.lincolncent.com
My numismatic art work:
http://www.cdaughtrey.com
USAF veteran, 1986-1996 :: support our troops - the American way.
My suggestion would be to adopt a variable length table for each article. This table would contain a list of keywords for each article. You could use a fixed length table, but make sure to allow for plenty of keywords. You will then need to maintain a master keyword table and map all the links. By using such a list you can provide for considerable future re-organization or the addition of new keywords as time progresses. My experience is that a typical article will have about 20 keywords, but a small percentage of articles break all the rules.
After a while (several years), you'll find that the number of articles for each subject becomes staggering and you'll spend all yout time wading through cruft to find what you want. At that time you'll start looking for ways to subgroup your 1000 Lincoln Cent articles (as an example). That's where the variable length keyword table pays off.
I never got involved with any of the database programming work for our company projects. People with better skills were always available. I also don't have much UNIX skill, but the Microsoft based tools don't give much value for the cost.
perfectstrike