Appendix A. ER Diagram for Example Database

Figure A-1 is an entity-relationship (ER) diagram for the example database used in this book. As the name suggests, the diagram depicts the entities, or tables, in the database along with the foreign-key relationships between the tables. Here are a few tips to help you understand the notation:

  • Each rectangle represents a table, with the table name above the upper-left corner of the rectangle. The primary-key column(s) are listed first and are separated from nonkey columns by a line. Nonkey columns are listed below the line, and foreign key columns are marked with “(FK).”

  • Lines between tables represent foreign key relationships. The markings at either end of the lines represents the allowable quantity, which can be zero (0), one (1), or many (). For example, if you look at the relationship between the account and product tables, you would say that an account must belong to exactly one product, but a product may have zero, one, or many accounts.

For more information on database modeling and modeling tools, see Appendix D.

ER diagram
Figure A-1. ER diagram

Get Learning SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.