SQLite的高级搜索 [英] Sqlite advanced search
问题描述
我开发了一个商店,它提供了许多功能的Android应用程序。其中之一是一个功能,允许用户搜索一些标准(价格,大小,类型......像图片)的产品。
I'm developing an android application for a store, which provides many functions. One of these is a function that allows the customer to search a product with some criteria (price,size,type... like in the picture ).
我想我应该用 SqliteDatabase
工作,但我不知道我怎么能做出这种多标准搜索界面,使用户可以查询数据库。
I guess I should work with SqliteDatabase
, but I have no idea how I can make this multi-criteria search interface , so the user can query the database.
推荐答案
这很简单。建立数据库后,您可以使用SQL查询和WHERE critaria终于achive正确的数据,使用Cursor类结果通过迭代JOIN类型。
It's simple. after setup your database, you can use SQL queries and JOIN types with WHERE critaria and finally achive proper data, use Cursor class to iterate through results.
请参阅:
的http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html
http://www.w3schools.com/sql/sql_where.asp
http://www.w3schools.com/sql/sql_and_or.asp
http://www.w3schools.com/sql/sql_join_inner.asp
这篇关于SQLite的高级搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!