Create table while installing my custom module My custom module name is "person" and its .install file has the following code.

&lt;?php
/**
 * Implementation of hook_install().
 */
function person_install() {

  drupal_install_schema('person');
}

/**
 * Implementation of hook_schema.
 */
function person_schema() {

  // Static (meta) tables.

  $schema['person'] = array(
    'fields' =&gt; array(
      'pid'            =&gt; array('type' =&gt; 'int', 'length' =&gt; 11, 'not null' =&gt; TRUE, 'default' =&gt; ''),
      'name' =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 50, 'not null' =&gt; TRUE),
      'city'        =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 50, 'not null' =&gt; TRUE),
      'country'        =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 50, 'not null' =&gt; TRUE)
    ),
    'primary key' =&gt; array('pid'),
  );
return $schema;
}


But when I installed my module the table has not been created.Any thing wrong with this code?
In your schema your setting pid  as primary key. You are setting '' value for primary key. Remove that default value for pid and try.

Then your code should be:

&lt;?php
/**
 * Implementation of hook_install().
 */
function person_install() {

  drupal_install_schema('person');
}

/**
 * Implementation of hook_schema.
 */
function person_schema() {

// Static (meta) tables.

$schema['person'] = array(
  'fields' =&gt; array(
    'pid'            =&gt; array('type' =&gt; 'int', 'length' =&gt; 11, 'not null' =&gt; TRUE),
    'name' =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 50, 'not null' =&gt; TRUE),
    'city'        =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 50, 'not null' =&gt; TRUE),
    'country'        =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 50, 'not null' =&gt; TRUE)
  ),
  'primary key' =&gt; array('pid'),
  );
return $schema;
}


After edit the code don't disable and enable the module, hook_install will only call at module install process, so you should first disable the module, unistall the module and then install the module again.