For stackoverflow.com there is a stat for how many views for a question.
How is it tracked? Registered and unregistered user can view any question.
What is the database relation schema for that counting?
Should i just increment the column value for a specific question in database table?
Or should i add a new record/row when an user views that question, then to display the count echo the result of sum(thatcolumn) of that table?
There are numerous approaches to this. there’s the two you mentioned but there are others that will depending on your situation suit you better.
if you have a lot of hits to your site like stackoverflow does, incrementing the counter on a database table when one person views the question can be quite expensive (depending how their db is set up i’m not sure).
another approach which I’ve use before is to store the views in a cache engine like memcache/xcache/eaccelerator (each of these have their own merits) and have a cron that will run hourly/nightly/etc. that will clean up the views and insert into a database table that is referenced by the unique id in SO.com’s case the question id, and reset the counters in the cache.
If you want total reliability a noSQL engine like mongoDB would be excellent at quick and efficient key value data storage.