Step 1) Create module info file " mymodule_views_table.info ".
name = mymodule_views_table
description = Create external table view.
package = Custom Drupal 7 Development
core = 7.x
Step 2) Create module file " mymodule_views_table.module ".
<?php
function mymodule_views_table_views_api(){ // Register view API information
$view = array();
$view = array('api'=>3,
'path'=>drupa_get_path('module','mymodule_views_table')
);
return $view;
}
function mymodule_views_table_views_data(){ //Describes data tables
$table = array();
$table['custom table']['table']['group'] => t('custom table');
$table['custom table']['table']['base'] =>array(
'title'=>t('Courses'), //Courses is Custom external table
'field'=>'id',
'help'=>t('Contains courses, departments, and descriptions'));
$table['custom table']['title']=>array(
'title'=>t('Course name'), //Custom external table field
'help'=>t('Course name'),
'field'=> array(
'handler'=> 'views_handler_field',
'click sortable'=> TRUE,),
'sort'=>array(handler=>'views_handler_sort',),