查询表? [英] Query a table?

查看:60
本文介绍了查询表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我得到了一张桌子的名字。 IT拥有与用户相关的各种信息

。问题是用户没有确切地知道他要搜索的这个值所在的列。


在db2或数据库中是否有任何方法一般我可以提供

只需一个输入栏(浏览器),然后搜索

表的所有栏目?


请建议。


谢谢。


TP。

解决方案

TP写道:



我得到了一张桌子的名字。 IT拥有与用户相关的各种信息。问题是用户并不确切地知道他正在搜索的这个值所在的列。

在db2或数据库中是否有任何方式我可以提供
只需一个输入栏(浏览器),然后搜索
表的所有栏目?

请指教。

谢谢。

TP。




db2描述表xxxx;

db2 select * from xxxxx;


< BLOCKQUOTE>" TP" < TP ****** @ hotmail.com>在消息中写道

news:59 ************************** @ posting.google.c om ...



我被赋予了一张桌子的名字。 IT拥有与用户相关的各种信息。问题是用户并不确切地知道他正在搜索的这个值所在的列。

在db2或数据库中是否有任何方式我可以提供
只需一个输入栏(浏览器),然后搜索
表的所有栏目?

请指教。

谢谢。

TP。




您必须使用OR子句列出谓词中的所有列。


实际上有一个简单的解决方案,只要你想搜索一个

单一模式 - 使用字符串连接并找到:


区分大小写:

SELECT A. *来自MYTAB.SEARCH A COEREES(位置(''模式'',

COL1 || COL2 || COL3),0)> 0;

不区分大小写:

SELECT A. *来自MYTAB.SEARCH A COEREESCE(位置(

UCASE(''pattern'' ),UCASE(COL1 || COL2 || COL3),0)> 0;


在连接时使用COALESCE(COLNAME,''')作为可为空的列 -

以确保连接结果正常。


标记A< ma@switchboard.net>在消息新闻中写道:< xE **************** @ news.uswest.net> ...

" TP"< tp ****** @ hotmail .com>在消息中写道
新闻:59 ************************** @ posting.google.c om ... < blockquote class =post_quotes>

我得到了一张桌子的名字.IT有各种与用户相关的信息。问题在于用户并不确切地知道他要搜索的这个值所在的列。

在db2或数据库中是否有任何方法可以呈现我只能输入一个输入fi eld(浏览器)然后搜索
表的所有列?

请指教。

谢谢。

TP。



您必须使用OR子句列出谓词中的所有列。



Hi,

I have been given the name of a table. IT has all kinds of information
that is relevant to the user. The problem is that the user does not
exactly know which column this value he is searching for resides in.

Is there any way in db2 or databases in general that I can present
just one input field (browser) and then search all columnms of the
table?

Please advice.

Thanks.

TP.

解决方案

TP wrote:

Hi,

I have been given the name of a table. IT has all kinds of information
that is relevant to the user. The problem is that the user does not
exactly know which column this value he is searching for resides in.

Is there any way in db2 or databases in general that I can present
just one input field (browser) and then search all columnms of the
table?

Please advice.

Thanks.

TP.



db2 describe table xxxx;
db2 select * from xxxxx;


"TP" <tp******@hotmail.com> wrote in message
news:59**************************@posting.google.c om...

Hi,

I have been given the name of a table. IT has all kinds of information
that is relevant to the user. The problem is that the user does not
exactly know which column this value he is searching for resides in.

Is there any way in db2 or databases in general that I can present
just one input field (browser) and then search all columnms of the
table?

Please advice.

Thanks.

TP.



You would have to list all the columns in the predicate with an OR clause.


Actually there is a simple solution as long as you want to search a
single pattern - use the string concatenation and locate:

case sensitive:
SELECT A.* FROM MYTAB.SEARCH A WHERE COALESCE( LOCATE ( ''pattern'',
COL1||COL2||COL3 ) , 0) > 0 ;
case insensitive:
SELECT A.* FROM MYTAB.SEARCH A WHERE COALESCE( LOCATE (
UCASE(''pattern''), UCASE(COL1||COL2||COL3), 0 ) > 0;

use COALESCE(COLNAME, '' '') for nullable columns when concatenating -
to make sure the concatenation result is okay.


"Mark A" <ma@switchboard.net> wrote in message news:<xE****************@news.uswest.net>...

"TP" <tp******@hotmail.com> wrote in message
news:59**************************@posting.google.c om...

Hi,

I have been given the name of a table. IT has all kinds of information
that is relevant to the user. The problem is that the user does not
exactly know which column this value he is searching for resides in.

Is there any way in db2 or databases in general that I can present
just one input field (browser) and then search all columnms of the
table?

Please advice.

Thanks.

TP.



You would have to list all the columns in the predicate with an OR clause.



这篇关于查询表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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