We were faced with a situation in one of our clients Drupal sites where we had to add View relationships programmatically with custom database tables. The site was running on Drupal 7. If you are faced with the same situation in your Drupal website and want to know how to add View relationships programmatically with custom database tables in Drupal 7 then read on to know the solution.
Custom Database Table
By default Drupal 7 has two types of views - The Full node view and the Teaser view. This has been the case for all previous versions of Drupal. However if your requirements are different, then you might have to create a custom view that is tailored to meet your specific needs. Check out how to create a simple custom “View mode” for nodes in Drupal 7.