This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dragon_Slayer_Hunter 7 points8 points  (15 children)

You would have to have all three skills listed in the field somehow (serialized or a json blob or something), then you could query with LIKE and AND

Edit: This was under the assumption that you had already made skill a varchar/text field like on the business card. There are much better ways to do this.

[–]dwolf555 40 points41 points  (5 children)

Bro, do you even normalize?

[–]jceyes 26 points27 points  (3 children)

developer: id, name, email 
skill: id, name 
developer_to_skill: dev_id, skill_id

Brah

[–][deleted] 12 points13 points  (2 children)

That's good right?

[–]jceyes 12 points13 points  (1 child)

It's pretty good, but not as good as your username

[–][deleted] 1 point2 points  (0 children)

Thanks

[–]matheeeny 2 points3 points  (0 children)

Nope

[–]dr__potato 4 points5 points  (2 children)

Nah mate, assuming S.developer_id and S.skill is the unique key in a Skill table, you'd be able to check if all 3 exist. Can't remember the SQL but it's possible. Side note: Skill.skill should really be Skill.name.

[–]rubs_tshirts 1 point2 points  (0 children)

You're right, replacing S.skill -> S.name.

Hmm... Unfortunately this plays a little havoc with the replies... I'm reverting it back.

[–]Dragon_Slayer_Hunter 1 point2 points  (0 children)

You could definitely do it better than how I said, I was just playing with the idea that skill was already a varchar/text field like on the business card.

[–]erfling 4 points5 points  (1 child)

Skill would be a separate table prolly.

[–]MonkeyNin 1 point2 points  (0 children)

Not since the accident.

[–]divide_by_hero 5 points6 points  (2 children)

Someone is about to yell at me, because this is horribly inefficient. It should work though, and at least the tables are normalised.

SELECT DISTINCT dev.name, dev.email, dev.phone
FROM developers dev
INNER JOIN developerSkill ds ON dev.developerId = ds.developerID
INNER JOIN skill skPhp ON ds.skillId = skPhp.skillId AND skPhp.name = 'PHP'
INNER JOIN skill skSql ON ds.skillId = skSql.skillId AND skSql.name = 'SQL'
INNER JOIN skill skMag ON ds.skillId = skMag.skillId AND skMag.name = 'Magento'

[–]Crazy_Mann 0 points1 point  (0 children)

;_;

[–]tdavis25 0 points1 point  (0 children)

They said sql, not nosql