如何从数据库表中的特定列搜索值 [英] How to search value from a particular column in a data base table

查看:54
本文介绍了如何从数据库表中的特定列搜索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要搜索代码,它会找到与表格中的列类似的所有文本。 PL / SQL也适用。



示例:

假设我在表的一列(Sample_text)中有3个文本。我想从给定的文本中搜索50%到80%的相似性文本。



1. a。安全门与一个门相结合。

b。安全门与三个门相结合。

c。安全门与其他门隔开。



1.输出:

安全门与一个门相结合。

安全门与三个门相结合。

安全门与其他门隔开。





如果我搜索文本安全门与一个门相结合,那么它将显示上述三个文本。因为这三个文本在三个文本之间的相似度超过70%。



但是,



2. 2.重要!保存(新AMII)。

b。重要!保持指令(AMII)。



输出:

未找到匹配项。





这两个文本之间没有50%的相似性。

所以,它什么也没有显示。

I want search code which will find all the text which is similar to a column in a table. PL/SQL also can applicable.

Example:
Suppose, I have 3 text in a column (Sample_text) of a table. I want to search 50 to 80 percent similarity text form a given text.

1. a. The Safety gate combined with one gate.
b. The Safety gate combined with three gates.
c. The Safety gate separated with others gates.

1. Output:
The Safety gate combined with one gate.
The Safety gate combined with three gates.
The Safety gate separated with others gates.


If I search through the text, "The Safety gate combined with one gate" then it will show all the three above text. Because those three text have more than 70 percent similarity in between those above three text.

But,

2. a. Important! save for (new AMII).
b. Important! keep instruction (AMII).

Output:
No match found.


Those couple of text does not have the 50 percent similarity in between that.
So, it will show nothing.

推荐答案

我的最佳镜头:

My best shot:
SELECT *
FROM TableName
WHERE ColumnData Like '%The Safety%'





我在上面的示例中尝试过:



I tried above on below example:

DECLARE @tmp TABLE (SomeText VARCHAR(255))

INSERT INTO @tmp (SomeText)
VALUES('1. a. The Safety gate combined with one gate.'),
('b. The Safety gate combined with three gates.'),
('c. The Safety gate separated with others gates.')

SELECT *
FROM @tmp
WHERE SomeText Like '%The Safety gate%'





请参阅:赞(T-SQL) [< a href =https://msdn.microsoft.com/en-us/library/ms179859.aspxtarget =_ blanktitle =新窗口> ^ ]


这篇关于如何从数据库表中的特定列搜索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆