[英]query in oracle(sql)10g
i have a table like this 我有这样的桌子
Name Skills
mahesh c,c++,java
santosh Java
srikanth c
in this i need people who know c. 在这我需要知道c的人。 i am not getting the query can u help me out.
我没有得到查询可以帮助我。 or i should break the skills colums... if yes then how should i break and achive my query... please can you anser me.....
还是我应该打破技能专栏...如果是的话,那么我应该如何打破并达到我的要求...请您回答我...
it is a bad idea to store multiple values in a single column, instead either have multiple rows or a link table. 将多个值存储在单个列中是一个坏主意,而不是具有多个行或链接表。
Multiple rows would appear as: 多行显示为:
mahesh c
mahesh c++
mahesh java
santosh java
srikanth c
For a link table approach you might have three tables: Person, Skill and PersonSkill. 对于链接表方法,您可能具有三个表:Person,Skill和PersonSkill。 Something like like this:
像这样的东西:
Person
ID Name
1 mahesh
2 santosh
3 scrikanth
Skill
ID Description
1 C
2 C++
3 Java
PersonSkill
PersonID SkillID
1 1
1 2
1 3
2 3
3 1
you would then query for people who have the C skill as follows: 然后,您将查询具有C技能的人员,如下所示:
select Name
from Person, Skill, PersonSkill
where Person.ID = PersonID and Skill.ID = SkillID and Skill.Description = 'C'
Just for the case that mahesh didn't design the database but just has to query it: 只是因为mahesh没有设计数据库但只需查询它:
select Name
from yourTable
where ',' || SKills || ',' like '%,c,%';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.