Which database schema should I use?
If you want to create a voting module you should look into Voting API, it's an API module that offers common functions and database storage for voting modules to use.

However, since this is a learning excercise, you might want to do it all yourself, in this case:


Use hook_schema() to define your database schema (the example on the documentation page is pretty self-explanatory!)
In Drupal 6 you need to manually specify which schema to install so implement hook_install() and hook_uninstall():




function mymodule_install() {
  drupal_install_schema('mymodule');
}

function mymodule_uninstall() {
  drupal_uninstall_schema('mymodule');
}


An example of a hook_schema might look like this:

/**
 * Implementation of hook_schema()
 */
  function mymodule_schema() {
    $schema['mymodule_votes'] = array(
      'description' =&gt; 'Your schema',
      'fields' =&gt; array(
        'vid' =&gt; array(
          'description' =&gt; 'vote id',
          'type'        =&gt; 'serial',
          'unsigned'    =&gt; TRUE,
          'not null'    =&gt; TRUE,
        ),
        'nid' =&gt; array(
          'description' =&gt; 'node id',
          'type'        =&gt; 'int',
          'unsigned'    =&gt; TRUE,
          'not null'    =&gt; TRUE,
        ),
        'vote_up' =&gt; array(
          'description' =&gt; 'number of votes up',
          'type'        =&gt; 'int',
          'unsigned'    =&gt; TRUE,
          'not null'    =&gt; TRUE,
          'default'     =&gt; 0
        ),
        'vote_down' =&gt; array(
          'description' =&gt; 'number of votes down',
          'type'        =&gt; 'int',
          'unsigned'    =&gt; TRUE,
          'not null'    =&gt; TRUE,
          'default'     =&gt; 0
        ),
      ),
      'primary key'     =&gt; array('vid'),
      'indexes'         =&gt; array('node id' =&gt; array('nid'))
    );
    return $schema;
  }