Shaping transformations through relationships
The exercises in previous chapters devoted much attention to relational constraints and how they help ensure data integrity, consistency, and quality while making data management easier. Exactly how much easier will be the recurring theme of this chapter.
Even simple business questions, such as What is the customer and location name for the customer with identifier 775699?, require us to refer to the relational model to find the tables in which these attributes are stored and the foreign key columns that can be used to join them.
Figure 12.1 – Foreign key constraint between location and customer tables
Using the information from the physical model, we can construct a query to obtain customer and location names for customer 775699 as follows:
SELECT c.name AS customer_name , l.name AS location_name FROM customer c JOIN location l ON c.location_id = l.location_id WHERE customer_id = 775699;
And...