Database Reference
In-Depth Information
11.1 SQL Essentials
A relational database, part of a Relational Database Management System (RDBMS),
organizes data in tables with established relationships between the tables. Figure
11.1 shows the relationships between five tables used to store details about orders
placed at an e-commerce retailer.
Figure 11.1 Relationship diagram
The table orders contains records for each order transaction. Each record contains
data elements such as the product_id ordered, the customer_id for the
customer who placed the order, the order_datetime , and so on. The other four
tables provide additional details about the ordered items and the customer. The
lines between the tables in Figure 11.1 illustrate the relationships between the tables.
For example, a customer's first name, last name, and gender from the customer
table can be associated with an orders record based on equality of the
customer_id in these two tables.
Although it is possible to build one large table to hold all the order and customer
details, the use of five tables has its advantages. The first advantage is disk storage
savings. Instead of storing the product name, which can be several hundred
Search WWH ::




Custom Search