Welcome to the first of several articles covering generating diagrams in R of Microsoft SQL Server graph databases. A little theoretical background is in order before diving into the mechanics. In relational databases, tables typically connect or join based on a unique value in one table to another table where the same value may appear one or more times. Called a one-to-one or one-to-many relationship, it functions very well for most purposes. Dealing with real world situations with many-to-many relationship representation has been more awkward. As an example, the image above shows a representation of a classic many-to-many situation: class enrollment. A single student may be enrolled in many classes, and a single class may contain many students. In order to model this in a relational database, you would need to use an intermediary table, with one row for each student and each class they are enrolled in. By doing it this way, you can query the tables in either direction to get a list of all the students with the classes they are enrolled in, or all of the classes and which students are enrolled in those classes.