Help for this page

Select Code to Download


  1. or download this
    respondent_id: response_x, response_y, ...
    
  2. or download this
    respondent_1: 123, 456, 789, 23, 1574, ...
    respondent_2: 65, 1893, 2853, 753, ...
    etc.
    
  3. or download this
    count all respondents who gave response x and response y
    
  4. 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`) )
    
  5. 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`)
        )
    
  6. 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); 
            }
    
  7. or download this
     for $i (1 .. $num_responses) { 
            $file = ">response_".$i; 
            open(FILE, $file) or dienice("cannot open file : $_[0] $!"); 
            }
    
  8. 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);
    
  9. 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);
    
  10. or download this
        $start_1 = new Benchmark;
        for $i (0 .. $iterations) {
    ...
        }
        $end_1 = new Benchmark;
        $diff = timediff($end_1, $start_1);