avatar
one question on SQL# Database - 数据库
r*e
1
in SQL standard, if I want to search a table based on an attribute
A1(varchar(100)), I can use
SELECT * FROM TABLE1 WHERE A1=somthing;
if I try to select the records which have at least 3 words in A1, what's the
SQL command?
I tried
SELECT * FROM TABLE1 WHERE A1 LIKE '% % %';
but it does not work, anyone knows the answer?
Actually it is a exercise in Ullman's book: database system: the complete
book, Exercise 6.1.4 f).
Thanks in advance!
avatar
s*e
2
做两次join吧

【在 r***e 的大作中提到】
: in SQL standard, if I want to search a table based on an attribute
: A1(varchar(100)), I can use
: SELECT * FROM TABLE1 WHERE A1=somthing;
: if I try to select the records which have at least 3 words in A1, what's the
: SQL command?
: I tried
: SELECT * FROM TABLE1 WHERE A1 LIKE '% % %';
: but it does not work, anyone knows the answer?
: Actually it is a exercise in Ullman's book: database system: the complete
: book, Exercise 6.1.4 f).

avatar
r*e
3
Maybe I did not describe the problem clearly, the attribute A1 is a string,
how can I find all the records that have the value in A1 has the format "word1
word2 word3".

the

【在 s***e 的大作中提到】
: 做两次join吧
avatar
s*e
4
I see. Your query works in DB2.

【在 r***e 的大作中提到】
: Maybe I did not describe the problem clearly, the attribute A1 is a string,
: how can I find all the records that have the value in A1 has the format "word1
: word2 word3".
:
: the

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。