Understanding the Moodle database can be difficult. I have produced an ER (Entity Relationship) showing the relationships between the tables in a fresh install of Moodle. The diagram is mainly "reverse engineered", i.e. automatically generated from the Moodle code that creates the database at install time.
In addition to the relationships in the code, other relationships have been extrapolated from the functionality of the PHP code and a bug tracker item has been created to suggest their inclusion in core Moodle.
The tables have been grouped according to Moodle function, i.e. a group of tables related to the assignments, courses quiz etc.
It is mainly of use to developers and people creating queries (e.g. using the ad-hoc query plugin). It is of little interest to non developers apart from as an illustration of the size and complexity of the database of an installed instance of Moodle.
It is a big diagram representing over 300 tables and the items are legible when printed as an A1 poster. Note that this is the whole core Moodle database not the database activity.
The home of the diagram (and related documents and sub-diagrams)