Sep 13 2006

Database tables

Posted by admin under Old ASP applications

Regarding the tables: the database might not be all that normalized, just a single poll table allowing for 8 different answers (one should maybe have used a relation table for "article") but it was once done this way and I have no intention in breaking old installations by changing the database structure.

 

Poll

id

int

Autonumber field, just an unique id for each poll

question

varchar(255)

the question, for example "What do you like ASPCode.net?"

answer1

varchar(255)

The first answer alternative, for example "Great"

count1

int

Counter - how many have voted on this alternative

answer2...8

varchar(255)

The first answer alternative, for example "Great". If blank not used

count2...8

int

Counter - how many have voted on this alternative

Created when

datetime

Datetime of creation

Active

bool in Access, bit (0 or 1) in SQL Server

Only one will be active at a time

To ensure you can't vote multiple times on the same poll this table logs each voters ip address.
Votelog

id

int

Autonumber field, just an unique id

poll_id

int

the poll id

ip

varchar(20)

The ip address

datum

datetime

Cate when this ip address voted