r***e 发帖数: 31 | 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! | s***e 发帖数: 284 | 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).
| r***e 发帖数: 31 | 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吧
| s***e 发帖数: 284 | 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
|
|