Let's take a look at your example (Note: there IS more than one way to
reach a 3NF, it depends on what restrictions exist within the data being
modeled).
"Does 3NF mean that I cannot for example have too many fields in a table?
EG:"
3NF tries to build 'tall, skinny' tables --> lots of rows not many columns
So 3NF says you CAN (do) have too many fields in a table (basically when
you look at your table and see 'blank' fields, you ain't at 3NF.
"> Also, I don't quite get what is meant when each table is supposed to
describe the real world? Could someone explain this for me please?"
You have the following 'real world entities'
Each of these might become a table (depending on data restricions)
Employees
Calls
Managers
ManagedGroup e.g. Departments (implied since we have 'managers', we must
have something for them to manage)
-----------------------------don't really understand these so will ignore
them (they just complicate things anyway)
these could be in the tblEmployee if they are 1:1 (each Employee has one
and only one NTLogon and one and only one QuestionAnswer)
NTLogon ?? QuestionAnswer ??
--------------------------------------------------------------
Have to guess here but expect the following business rules: (different rules
can lead to different data models)
Employee is assigned to one and only one ManagedGroup (frequently not the
case in modern organizations, but then we would have to go a Many:Many
relationship. I don't want to go there for simplicity sake right now ;>.
Managers manage one and only one ManagedGroup --again may or may not be true
in a modern organization.
Each ManagedGroup has one and only one 'manager'
Employees make/take many calls ( I will assume Employees 'take calls')
each call has 1 and only one "caller" and/or CallTaker.
-----------------------------------------------------------------------
So we will need the following tables
tblEmployee
EmployeeID (primary Key)
EmployeeLastName (text)
EmployeeFirstName (text)
other stuff that relates to the employee (Not to employment)
tblManagedGroup
ManagedGroupID (Primary Key)
Manager_EmployeeID (Foreign Key) --> tblEmployee (all managers are by
definition employees)
ManagedGroupDescription (text) (some human meaningful words, like
'Marketing', "Sales", etc.
other stuff relating directly to the managed group
tblEmployeesAssignedToManagedGroup
---------------------------------------------------------here you have two
choices 1 combine the ManagedGroupID/EmployeeID into a unique Primary key or
add a Unique primary key (autoinc)
ManagedGroupID
EmployeeID
------------------>Combined
unique primary key based on ManagedGroupID and EmployeeID -- this will make
sure that a employee can be assigned to a ManagedGroup once and only once.
And using cascading deletes will allow access to delete the relationship
when you fire Jake the Stupid -- all his assignments to ManagedGroups will
be gone.
or
------------------
EmployeeManagedGroupID (primary key)
ManagedGroupID (foreign key ) links to the tblManagedGroup
EmployeeID (foreign key) links to tblEmployeeID
Now if you want to limit employee to group only once build another
unique key based on managedgroup and employee.
-----------------------------------------------------------------------------
tblCalls
CallID (PrimaryKey)
CallDateTime --dateTime
EmployeeID (Foreign Key) --M:1
CallingData (this could relate to a customer table through a
customerID or could be the calling telephone number or ... what ever you
need)
CallingNotes
other stuff relating to the specific call.
-------------------------------------------------------------------------------------
The above is just a start. As you can see there is a dependence on knowing
enough about the buisness and its 'rules of organization' to be able to
'properly' model the database. Then of course, as soon as everyone says
these rules are 'iron-clad' the first exception pops up, so try to not
depend too much on the 'rules'. For example I will assure you that as soon
as you build based on "Each Employee will be assigned to one and only one
ManagedGroup". Someone will be assigned to two or more. You will have
managers that are assigned to manage more than one ManagedGroup.
Hope this helps more than confuses the issue.
Ed Warren.