sql - How to model user profiles with languages spoken? How to store the languages? -


say user1 speaks english,chinese , user2 speaks english,spanish.

assume there many more languages choose from.

should storing like:

user --- id: 1 | languages_spoken: [1,2] id: 2 | languages_spoken: [1,3] 

or

user --- id: 1 | languages_spoken: ["english","chinese"] id: 2 | languages_spoken: ["english","spanish"] 

if went languages_spoken: int[], how should convert these displayed values? should have separate table language maps 1->"english" or should convert code on frontend?

(i coming nosql background confusing me.)

better have 3 separated tables.

user: user_id (pk), user_name languages: language_id (pk), language user_languages: user_id (fk), language_id (fk) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -