In which file should I write db_add_field function I am writing a module for which I have to add a field to my database. So I need to use  db_add_filed function, So in which file I should use this function? I mean should it be in .module file or .inc file?
I think you should write your code for adding new field in DB in your .module file.
Here is the code for you :

function xyz_schema_alter(&amp;$schema) {
  // Add field to existing schema.
  $schema['node']['fields']['show_in_inbox'] = array(
    'type' =&gt; 'int',
    'length' =&gt; '4',
    'default' =&gt; '1',
    'not null' =&gt; TRUE,
    'unsigned' =&gt; TRUE,  
    'description' =&gt; 'Field added by xyz module',
  ); 
}

function xyz_enable(){
    if (!db_field_exists('node', 'show_in_inbox')) {
        $schema = drupal_get_schema('node');
        db_add_field('node', 'show_in_inbox', $schema['fields']['show_in_inbox']);
    }
}


The new field will be added in your existing database on enabling this module.