Hey guys.

If I wish to log how often a user does action x, I'm assuming I would be 
best off doing something like:

/SELECT whatever FROM actionPerfomedTable WHERE user = y, action = x 
LIMIT 1/

If a record is returned, perform

/UPDATE actionPerfomedTable SET number = incremented number WHERE user = 
y, action = x/

Otherwise, perform

/INSERT INTO actionPerfomedTable yada yada yada./

Then, to find out how often user y had performed action x I would just 
need to do a SELECT and read the number column.

But it strikes me that an alternative is to have one row for each time 
the user performs action x, and to take the row count on the select 
rather than the number column.  This seems more "database-ey" (or normal 
form-ey or whatever), but it also seems kind of a waste of space that I 
might have 100 rows rather than one.

Can you guys advise me on this?

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

Reply via email to