Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

A New Database

We are about to build a new database for order processing. A greatly simplified version of the database will look as shown in Figure 1.

Figure 1 Database schema for a simplified database for order processing.

As you can see in Figure 1, ordermaster.id and orderdetail.id are primary keys. There are also several foreign keys: namely, ordermaster.customer_id, orderdetail.ordermaster_id, and orderdetail.product_id.

NOTE

In this simplified model, I skipped adding the product and the customer tables, so ordermaster.customer_id and orderdetail.product_id aren't implemented as physical foreign keys.

We should take into consideration all of these primary and foreign keys when deciding on the datatype to use.

  • + Share This
  • 🔖 Save To Your Account