Datasheet
Part I SQL Basic Concepts and Principles
FIGURE 1-6
Primary/foreign key relationship between tables
CUSTOMER
CUST_ID_N
CUST_NAME_S
ADDRESS
ADDR_ID_N
ADDR_CUSTID_FN
ADDR_ADDRESS_S
ADDR_TYPE_S
ADDR_CITY_S
ADDR_STATE_S
ADDR_ZIP_S
ADDR_COUNTRY_S
FIGURE 1-7
Resolving the problem of multiple customer addresses within a relational model
7
7
7
7
7
7
7
7
7
7
7
ADDR_CUSTID_FN
411 S LONDON AVE.
454 OAK ST.
678 MAPLE AVE.
999 ELK AVE.
777 SITKA AVE.
911 MYRTLE ST.
865 CEDAR AVE.
531 DEER ST.
332 WALNUT ST.
456 WILLOW ST.
232 EEL ST.
ADDR_ADDRESS_S
BILLING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
SHIPPING
ADDR_TYPE_S
WILE ELECTRONICS INC.
CUST_NAME_S
7
CUST_ID_N
Another advantage of the relational schema is simplified logic for the applications that work with
data. For example, assume the nonrelational
CUSTOMER dataset has fields for a maximum of five
customer orders. (That easily could be a couple of fields per order, by the way.) If you want to
display all orders for a specific customer, a program will have to scroll through all these fields,
determine which ones are not empty, and display their contents. In the relational case, all you
need to do is display all records in the
ORDER HEADER table that have the
required customer number. This relational schema made ad hoc query languages relatively easy
to write, which eventually led to the appearance of SQL.
The concept of a relational database, and thus SQL, was first introduced in 1970 by IBM
researcher Dr. Edward Frank Codd in a paper titled ‘‘A Relational Model of Data for Large
Shared Data Banks.’’ In simple words, his idea of a relational database model was based on
data independence from hardware and storage implementation and a nonprocedural high-level
22