SQLite和范围查询 [英] SQLite and range query

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

问题描述

如何在SQLite中有效地执行简单的范围查询?

How could I perform a simple range query in SQLite efficiently?

说,我有保存个人信息的数据,我想找到年龄在20〜45,体重在50〜80kg之间?

Say, I have data that saves a person information and I want to find the people with age between 20~45, and weight between 50~80kg?

我应该怎么做(例如设置某些索引?)以提高搜索效率?

What should I do (like setting certain index?) to make the searching more efficient?

推荐答案

我会尝试类似的

SELECT PersonName FROM Persons WHERE (Age BETWEEN 20 AND 45) AND (Weight BETWEEN 50 AND 80)






索引年龄和体重字段将有助于加快查询速度。


Indexing the fields Age and Weight would help speeding up the query.

以下是有关在SQLite中建立索引的很好的概述: http://www.tutorialspoint.com/sqlite/sqlite_indexes.htm

Here's a nice overview about indexing in SQLite: http://www.tutorialspoint.com/sqlite/sqlite_indexes.htm

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

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