Database diagrams

One way we can represent a database is by using a diagram. These look like a set of tables (HTML-style tables, not database tables) containing the database table name and all of its fields, with lines connecting tables by their foreign keys. The "many"-side of the relationship is represented by three small lines (it looks kind of like a bird's foot.) Many-to-many relationships are less obvious this way as both foreign keys from the join table, so you can show them with a label on the connection. (There are other ways to represent this with more advanced drawing techniques, but we're keeping it simple.)

A photo gallery application

Below we have an example of the database for a photo gallery application. In this application, photos are allowed to be in multiple galleries.