Unfortunately WHMCS documentation does not give enough information about database management.
On WHMCS 7 (actually from previous versions already) they implemented they take advantage of Laravel framework’s database component.
You can find some info on the WHMCS documentation that is probably useful if you don't need example to understand what to do. I think in this case is mandatory to include a link to Laravel query builder, for reference on how to create your queries.
First of all, to use it it's necessary to initialize Capsule, including this row of code at the beginning of your php file
use Illuminate\Database\Capsule\Manager as Capsule;
Now we can make queries, for example if we want to get all records from a table we can use:
$users = Capsule::table('users')->get();
Or if you want to retrieve a single column from a row:
$name = Capsule::table('users')->where('name', 'John')->pluck('name');
Update values in your database
Capsule::table('users')->where('id', 1)->update(array('votes' => 1));
Or insert a new row in the database
Capsule::table('users')->insert( array('email' => 'email@example.com', 'votes' => 0));