If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Help with basics of database design (was "DataBase Newbie")

Hi -
I've been using Access for my website database's for a while now, but have really been scraping my was through.
I have created a simple database and wonder if you guys could check it out - i've attached a screen grab of it.
Any advise appreciated.
Thanks
Andy

Firstly, there is no detail on what you want this database to do. We must assume things and that's not great.

Guessing
History table has no primary key.
Instruments table has no primary key.
Instruments table should relate to the company table via it's primary key, CompanyID, not company name.
Enforce the relationships.

Firstly, there is no detail on what you want this database to do. We must assume things and that's not ideal.

Task List* History table has no primary key.
* Instruments table has no primary key.
* Instruments table should relate to the company table via it's primary key, CompanyID, not company name. (Done).
* Enforce the relationships.

If you need help on how to do these things, just ask if/when you get stuck

Thanks again guys -
I've added the PK to the Instrument and History tables, but left the naming the same. The InstrumentID won't be numericle so i can't use it as an autonumber.
Does this look correct now?
Andy

b.t.w. : What i normaly do is calling the PrimaryKey in table it self : Id and i call the ForeignKey _id so in your case

Table : Company
PK : Id

Table : Instruments
PK: Id
FK : Company_id

Table : History
PK: Id
FK : Instruments_id

Just a quite picky note...
Don't use this naming convention

It's quite acceptable to have a company_id field in the company table!
"ID" is so bland; it doesn't tell us very much about the field - it is one of the only exceptions where you are allowed to prefix a field name with the table name!

A great benefit of this is that it makes your query joins a lot easier to write (and remember) (order_id links to order_id; fancy that!)

Each to their own I suppose. I am a big fan of table aliasing, so I rarely find myself in the position of writing the fully 2 part name. Either way, I chose to name the primary key in such a way as it describes the data. I would argue that neither of us are incorrect in our method or justification