是否有与 SQL:LIKE 条件相同的 Cassandra 查询? [英] Is there any query for Cassandra as same as SQL:LIKE Condition?
问题描述
LIKE
条件允许我们在 SQL 语句的 where 子句中使用通配符.这允许我们执行模式匹配.LIKE
条件可用于任何有效的 SQL 语句 - 选择、插入、更新或删除.像这样
The LIKE
condition allows us to use wildcards in the where clause of an SQL statement. This allows us to perform pattern matching. The LIKE
condition can be used in any valid SQL statement - select, insert, update, or delete. Like this
SELECT * FROM users
WHERE user_name like 'babu%';
与上述操作一样,CLI 中的 Cassandra 可以使用任何查询.
like the same above operation any query is available for Cassandra in CLI.
推荐答案
简单回答:没有LIKE
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlSelect.html
这是 v0.8 的命令参考:
Here is the command reference for v0.8:
http://www.datastax.com/docs/0.8/references/cql#cql-reference
如果您维护另一组包含对用户名的引用的行:
If you maintain another set of rows that hold references to a username:
行:用户名:bab -> col:babu1, col:babar行:用户名:babu -> col:babur
row: username:bab -> col:babu1, col:babar row: username:babu -> col:babur
通过预先填充您通常在 RDBMS 世界中搜索的所有结果,实际上是在作弊.与几年前相比,存储便宜……这就是为什么现在这是一种公认的方法.检索预先填充的信息列表对 CPU 和内存的占用较少.
Effectively you are cheating by pre-populating all of the results that you would normally search with in the RDBMS world. Storage is cheap in comparison to what it was years ago ... which is why this is now an accepted approach. It's less intensive on the CPU and Memory to retrieve a pre-populated list of information.
这篇关于是否有与 SQL:LIKE 条件相同的 Cassandra 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!