On 10 Nov 2013, at 10:36pm, Igor Korot <ikoro...@gmail.com> wrote:

> On Sun, Nov 10, 2013 at 8:44 AM, Simon Slavin <slav...@bigfraud.org> wrote:
> 
>> On 10 Nov 2013, at 4:26pm, Igor Korot <ikoro...@gmail.com> wrote:
>> 
>>> I'm updating the table when the program exit.
>> 
>> There is not need to update the table.  In fact there's no need to store the 
>> rank values at all.
> 
> There is.
> Consider the fact that the user changes the rank and exit the program
> with the saving. Then he select the option "Reset the league".
> Where can I get the original rank from?

What does 'original' rank depend on ?  The number of points the player had when 
they were added to the league ?  Whatever it is, store that value in the table 
and use that to figure out what rank the player is by counting how many players 
have the same or more points than they do.  It'll be something like

SELECT count(*) FROM league WHERE pointsWhenJoined >= [this player's 
pointsWhenJoined]

You only need to do this when you actually need to know the number.  You don't 
need to keep updating a lot of player's points every time something happens, 
and this saves you a lot of programming and time.

>>> Now, I would expect for the max() function in this case to be
>>> evaluated to 0 and not NULL.
>>> This is plain mathematics: max value of nothing is nothing which
>>> mathematically 0.
>> 
>> No.  Max of nothing is nothing.  And the way you express 'nothing' in SQL is 
>> NULL.  NULL is not 0 or 0.0.  NULL is not the empty string "".  NULL is not 
>> the BLOB x''.  NULL means 'value missing'.
> 
> Well from strictly mathematical point of view maximum or minimum of
> nothing is nothing. And since nothing is 0, than it is zero.

No, nothing is not zero.  Read what I wrote again.  Try this: if I want you to 
be very very quiet do I say to you "I want you to say zero." ?  If you go to a 
bank you don't have an account with and ask "How much money do I have in my 
account ?" do they answer "You have zero dollars in your account, Sir." ?  
Google

difference between nothing and zero

and if it's still not clear, ask someone who teaches maths.

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

Reply via email to