I am attempting to write a query that runs as fast as humanly possible... to
be honest, I'm having a really hard time even getting started with it.  I'm
generally decent with SQL but for some reason this one is eluding me in
terms of doing it within a single query, which would help my application's
speed.

The situation is this: there are two tables, one called "objects" (fields:
object_id[int] and object_name) and properties (fields: object_id[int] and
property_name and score[int]).  Objects have one or more properties.

The objective of the query is to return an object who has all of the given
properties scored above or below the given value.

For example, I might look for the object_id of an object who has the
property "green" scored above 3, the property "hot" scored below 2, and the
property "bright" scored above 0.  It might have other properties, too, but
it must have these 3.

And then, for the second part, I need a query that will select properties
which are NOT in this set of given properties but are relevant to the
returned set of objects.  In this part, I'm not concerned with the
property's score - just that it is relevant to the objects.  In other words,
I might now find that the property "hard" is relevant to 3/4 objects (even
though one of them had a very low score for the hard property, another had a
very high one, etc).  Basically I want to know which property, once I can
determine the score, will help narrow down the object-set the most, so that
I can collect data for the most relevant property to narrow down the object
set.

Thanks so much for your help!
-- 
View this message in context: 
http://www.nabble.com/Query---finding-objects-with-given-properties-tp22312313p22312313.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to