php - store multiple values in single column in mysql -
table name :internship ,now want store "skill_required"for company name xyz skill are: php , java etc mow question @ time of company registration have specify text of or check box..etc , how store in database ?with id ?like 1 php 2 java
2nd. when student search internship in field of interest specify php other student specify java ,so company xyz must display both student search company providing internship on php , java both,so how retrieve form database,? there should separate table skills skill name , skill id?
you should have separate table linking each company skills require, example company
table:
companyid companyname _________ ___________ 1 bobco 2 peteco ...
...and skills required in internship
table:
companyid skillid _________ _______ 1 1 1 2 2 1 ...
...and have separate skill
table mapping skill ids skill names:
skillid skillname _______ _________ 1 php 2 java 3 mysql ...
for example, if java skill 2
, do:
select companyid internship skillid=2;
that query returns companies require java. alternatively, more complex query:
select companyname company join internship using(companyid) join skill using(skillid) skillname = 'java'
you should not put multiple values in single column, because doing breaks first normal form. have @ link examples of problems you're come across, , how fix them.
Comments
Post a Comment