2

I have 2 tables: Lecturer and Department.

The Lecturer table has these columns:

id, email, phone, expertise, dept_id.

The Department table has these:

dept_id, dept_name, dept_code, dept_program.

Sample data is as follows:

Lecturer table

(id=1, email= a@a.com, phone= 9999, expertise= multimedia and programming, dept_id=1)

Department table

(id=1, dept_name=Computer Science, dept_code=CS, dept_program=Bachelor of Comp Science)

The expertise column has several values, and some lecturers might have more than 5 expertise areas, so I think I should create another table for expertise alone. But how to insert multiple attributes of expertise into lecturer table?

4

1 に答える 1

5

You can't really do this by changing only the lecturer table. Normally, you handle multivalued attributes by creating seperate tables. In this case, you would create one table to hold expertise attributes and another one to associate expertises with lecturers. As a bonus, that'll also help to prevent inconsistencies when it comes to descriptions of expertise.

The resulting tables might look like this:

department(dept_id, dept_name, dept_code, dept_program)
lecturer(id, email, phone, dept_id*)
expertise(id, description)
lecturer_expertise(lect_id*, expertise_id*)
于 2012-05-01T14:48:31.157 に答える