views:

219

answers:

1

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.

A: 

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

codeulike
Is it? The problem I guess might be the limitation of the Datamapper Library itself.So the problem is, Datamapper forces the database design to be On 5th Normal Form.So say there is users table and events table, to represent any relationship between the two tables, there needs to exist a events_users table which is automatically populated by CodeIgniter and afaik, I cannot put extra fields in the events_users table.
bibstha
Yeah perhaps 5NF is not the problem
codeulike