The concepts of entities and attributes were briefly touched earlier in Chapter 2, and the preceding paragraph highlighted complexities facing implementations based on relation models.
On the most basic practical level, you could consider entities to be tables and attributes to be columns in these tables. One of the first steps taken when creating a data model is analyzing a particular business environment in need of a database. In our case, we are building a library to keep track of all the books you have, or may have in the future. Therefore, the first entity you'd think of would be BOOK. What are the attributes of a book? A title, an author, a publisher, a price tag, to name but a few; all these could become columns in your BOOKS table. As you will see later in this chapter, taken through a more rigorous normalization process, some of these attributes might become entities of their own, and some would disappear all together. There are but two keys to the proper design of a relational database: primary and foreign.
A primary key is a unique identifier for a row of data in a table. In its most basic form, a primary key would be a column in the table, though it could be a unique combination of the columns. The concept of a key in the relational database is simple yet powerful: It enforces integrity (see later in this chapter), and helps define relationships between the entities in your data model.
A uniquely ...