2

Each user/person could know one or more languages.

All I can think is a table like

+----------+------+-----+------------+-----+-----+-----+-------+
| PersonID | Java | PHP | Javascript | C++ |  C  | CSS | HTML  |
+----------+------+-----+------------+-----+-----+-----+-------+
|        1 | Yes  | Yes | No         | Yes | No  | Yes | No    |
|        2 | No   | Yes | Yes        | No  | Yes | No  | No    |
|        3 | Yes  | No  | Yes        | Yes | Yes | Yes | No    |
+----------+------+-----+------------+-----+-----+-----+-------+

Considering I'm going to need at least 100 columns for all the languages, is it normal to have that many columns? Something tells me this is the wrong approach.

Thank you very much and sorry about my english!

1 Answer 1

3

You should have a 'language' table as well as your current 'person' table. It would look something like the following:

Person table

+----------+------------+
| PersonID | LanguageID |
+----------+------------+
|        1 | 2          |
|        1 | 5          | 
|        1 | 9          |
+----------+------------+

Language table

+------------+------------+
| LanguageID | Name       |
+------------+------------+
|        1   | Java       | 
|        2   | PHP        | 
|        3   | Javascript |
|        4   | C++        |
|        5   | CSS        |
+------------+------------+

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.