Datadog integrates with many different databases, for this example we'll use Postgres though the steps taken will generally be applicable to most other DB's as well.
By default there are certain metrics we collect from Postgres, but you can easily edit the Postgres check to submit additional metrics. You can find the location of the check files to make changes by running the Agent info command for your OS, as described here.
You can also submit custom metrics via a separate Agent Check, or through DogStatsD. We also have an API through which metrics can be submitted. Any metric that you send to Datadog via those avenues can be graphed: