0

Is it possible to represent a composite key functional dependency of a non key column in fifth normal form?

I have three tables,

users
----------
id
name

events
----------
id
name

events_users
---------------------------
id
user_id
event_id
participation_type (ENUM)

As I know, the 5th normal form needs the tables to be represented in its own small entity. So i guess the participation_type in events_users table cannot be called a 5th normal form?

Can anyone suggest me a better solution?

The problem is, I've been using the DataMapper library of CodeIgniter where each table need to exist independently, ie 5th normal form.

4

1 回答 1

1

As far as I can tell, the example you give is already in Fifth Normal Form.

You have so few columns in the tables that I can't see any other way to arrange them!

As far as I can tell, 'participation_type' does not break any NF rules because there are no other columns semantically related to it.

edit in response to comment: Perhaps as you suggest this is some other problem with Datamapper/Codeigniter that is not related to 5NF.

If you cannot add fields into the user_events table that it generates, then perhaps you need to pre-empt it and create another entity, lets call it 'Attendance' (or whatever makes sense in your model). Attendance will have these fields:

Attendance
----------
id
participation_type (ENUM)

Then tell Datamapper that Attendance is related to both Users and Events, and it will generate (or ask you to generate, or whatever) two linking tables:

user_attendance
---------------
id
user_id
attendance_id

event_attendance
----------------
id
event_id
attendance_id

If you do something along those lines, then you will have an Attendance entity that you can add fields to.

Disclaimer: I dont know anything about Datamapper, I'm just reading between the lines here

于 2009-05-08T07:27:17.590 回答