Re: [sqlite] How to design this table?

2011-10-10 Thread Ivan Shmakov
> Simon Slavin writes:
> On 9 Oct 2011, at 3:57am, 张一帆 wrote:

 >> i have some data like "a and b or c ...",there will be a word 'and'
 >> or 'or' which means the Logical relations between each item.

 > If you have "a and b or c" does that mean

 > (a and b) or cOR
 > a and (b or c)?

 > How does your software know ?

The boolean AND and OR operations are often compared to the
usual arithmetics' × and +.  Therefore, a AND b OR c is akin to
a × b + c, and the precedence rules (borrowed from arithmetics)
will make that (a × b) + c.

And SQLite, among many others, behaves just like that:

$ sqlite3 :memory: 'SELECT 0 AND  1 OR 1' 
1
$ sqlite3 :memory: 'SELECT 0 AND (1 OR 1)' 
0
$ 

I guess that it just follows the standard.

-- 
FSF associate member #7257

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


Re: [sqlite] How to design this table?

2011-10-10 Thread Igor Tandetnik
张一帆  wrote:
> i have some data like "a and b or c ...",there will be a word 'and' or
> 'or' which means the Logical relations between each item.So how to design a
> table to store the data in best way?

Best way to achieve which goals? What operations do you need to perform on said 
data?
-- 
Igor Tandetnik

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


Re: [sqlite] How to design this table?

2011-10-10 Thread zyf01234
> > i have some data like "a and b or c ...",there will be a word 'and' or
> > 'or' which means the Logical relations between each item.

> If you have "a and b or c" does that mean

> (a and b) or c OR
> a and (b or c) ?

> How does your software know ?

> Simon.


just a and b or c...,like this.thank you! i am also think about the solution of 
this case.Do you have any ideas?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to design this table?

2011-10-08 Thread Simon Slavin

On 9 Oct 2011, at 3:57am, 张一帆 wrote:

> i have some data like "a and b or c ...",there will be a word 'and' or
> 'or' which means the Logical relations between each item.

If you have "a and b or c" does that mean

(a and b) or cOR
a and (b or c)?

How does your software know ?

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