Drupal allows you to create multiple sites sharing some or all of the same code and optionally sharing some database tables.
The documentation for the Drupal settings file
http://api.drupal.org/api/file/sites/default/settings.php/5/source
includes the following
<?php
/*
* To have all database names prefixed, set $db_prefix as a string:
*
* $db_prefix = 'main_';
*
* To provide prefixes for specific tables, set $db_prefix as an array.
* The array's keys are the table names and the values are the prefixes.

