Core Data iOS Essentials
上QQ阅读APP看书,第一时间看更新

Entity Relationship Diagram

Our application consists of three entities:

  • Customer
  • Product
  • MasterProduct

The Entity Relationship Diagram (ERD) of the application is as shown in the following figure:

Let's have a quick look at the usage of the three entities displayed in the preceding figure:

  • The Product table is used to store information about products sold to the selected customer. The table has three fields: itemname, price, and quantity. This table is related to the Customer table via a many-to-one relationship because many customers may purchase the same product.
  • The Customer table is used to store information about the customer and has three data fields: name, e-mail ID, and contact number. This table is related to the Product table via a one-to-many relationship because a customer can purchase more than one product.
  • The MasterProduct table is used to store information about the vendor's products. This table also shows the quantity on hand for each product. The table has four fields: itemname, price, quantity, and image (photo). This table is not related to any other table and works independently.