Is this a good structure for a table

database-design

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!

Best Answer

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        |
+------------+------------+