- or download this
respondent_id: response_x, response_y, ...
- or download this
respondent_1: 123, 456, 789, 23, 1574, ...
respondent_2: 65, 1893, 2853, 753, ...
etc.
- or download this
count all respondents who gave response x and response y
- or download this
CREATE TABLE `theTable` (
`response` smallint(5) unsigned NOT NULL default '0',
`respondent` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`response`,`respondent`) )
- or download this
CREATE TABLE `theTable` ( `respondent` smallint(5) unsigned NOT NULL
default '0', `response` smallint(5) unsigned NOT NULL default
+'0', PRIMARY
KEY (`respondent`,`response`), KEY `respondent` (`respondent`)
+, KEY `response`
(`response`)
)
- or download this
for $i (1 .. $num_responses) {
$sql = "CREATE TABLE r".$i." (respondent smalli
+nt unsigned, PRIMARY KEY (respondent))
$sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh-
+>errstr);
$sth->execute() or die("Could not execute!" . $sth->errstr);
}
- or download this
for $i (1 .. $num_responses) {
$file = ">response_".$i;
open(FILE, $file) or dienice("cannot open file : $_[0] $!");
}
- or download this
$sql = "appropriate select statement";
$sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh->err
+str);
...
$count = $sth->fetchrow_array();
$end_2 = new Benchmark;
$diff_2 = timediff($end_2, $start_2);
- or download this
$sql = "appropriate select for response_id_1"
$sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh->err
+str);
...
}
$end_1 = new Benchmark;
$diff = timediff($end_1, $start_1);
- or download this
$start_1 = new Benchmark;
for $i (0 .. $iterations) {
...
}
$end_1 = new Benchmark;
$diff = timediff($end_1, $start_1);