Try not to think of a database in the same way as an Excel workbook; they are
very different animals with fundamentally different principles underlying
their design and operation.
If you are having to repeat data when entering records it sounds like you
need to 'normalize' your table(s). Normalization is the process of
eliminating redundancy from a database, and involves decomposing a table into
several related tables. In a relational database each table represents an
entity type, e.g. Contacts, Companies, Cities, States etc. and each column in
a table represents an attribute of the entity type, e.g. ContactID, FirstName
and LastName might be attributes of Contacts and hence columns of a Contacts
table. Its important that each attribute must be specific to the entity
type, so that each 'fact' is stored once only. In the jargon its said that
the attribute is 'functionally dependent' solely on the whole of the primary
key of a table.
To relate tables a 'referencing' table will have a foreign key column which
makes the link to the 'referenced' table, e.g. a Contacts table might have a
CompanyID column as a foreign key, while a Companies table has a CompanyID
column as its primary key. Consequently no data other than the CompanyID
needs to be stored in a row in the Contacts table for all the company
information for that contact to be known; its available via the relationship
and can be returned in a query joining the two tables on the CompanyID
columns.
Similarly the Companies table might have a CityID column and the Cities
table a StateID column. If its an international database the States (or more
generically Regions) table would have a CountryID referencing the primary key
of a Countries table. So via the relationships, simply by entering (in
reality this would be selected from a list of Companies in a combo box, not
typed in) a CompanyID in the Contacts table the location of the contact's
company is also known. Redundancy, and therefore repetitive data entry is
avoided.
To see how a database is made up of related tables take a look at the sample
Northwind database. Its not completely normalized in fact (deliberately so
for the sake of simplicity) but illustrates the main principles of how tables
representing entity types relate to each other. An example of its lack of
proper normalization can be found in its Customers table. You'll see that
this has City, Region and Country columns so we are told numerous times that
São Paulo is in SP region (as is Resende) and that SP region is in Brazil.
Not only does this require repetitive data entry, but more importantly it
opens up the risk of 'update anomalies', e.g. it would be perfectly possible
to put São Paulo in California in one row and California in Ireland! Proper
normalization as I described above would prevent this as the fact that São
Paulo is in SP region would be stored only once in the database as would the
fact that SP region is in Brazil and California is in the USA.
Ken Sheridan
Stafford, England