Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: voltdb-1.3.3rc2
Fetching contributors…

Cannot retrieve contributors at this time

executable file 36 lines (27 sloc) 0.941 kb
-- contestants table holds the contestants numbers (for voting) and names
create table contestants (
contestant_number tinyint not null,
contestant_name varchar(50) not null,
primary key (contestant_number));
-- votes table holds every valid vote.
-- voters are not allowed to submit more than <x> votes, x is passed to client application
create table votes (
phone_number bigint not null,
contestant_number tinyint not null);
create index idx_votes on votes (phone_number);
-- rollup of votes by phone number, used to reject excessive voting
create view v_votes_by_phone_number
(phone_number,
num_votes)
as select phone_number,
count(*)
from votes
group by phone_number;
-- rollup of votes by contestant, used to determine winner
create view v_votes_by_contestant_number
(contestant_number,
num_votes)
as select contestant_number,
count(*)
from votes
group by contestant_number;
Jump to Line
Something went wrong with that request. Please try again.