1

I'm trying to design a database, in which one of the entities would be a User and one of its attributes would be programming_languages which should in theory hold a list of programming languages a user knows. What would be the best approach to designing such a database, since the cell can only hold a single value? Should I create a separate table in which each row would hold a user's id and one of the languages he/she knows? Or is there a better approach?

1 Answer 1

1

Having multiple values in a field is only useful if the data is static and not changing in the database, i.e. if you only read the field out of the database and process it afterwards.

Better is to create a separate table with userID and Language. The combination of both will be the primary key. This is the rule as per Database Normalization.

UserID          Language

User1           a,b,c
User2           x,y

After Normalization

UserID          Language

User1           a
User1           b
User1           c
User2           x
User2           y
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.