Attributes / Schemas

Attributes / Schemas

Attributes

Across the top of a relation we see attributes; in the following figure, the attributes are title, year, length, and filmType. Attributes of a relation serve as names for the columns of the relation. Generally, an attribute explains the meaning of entries in the column below. For example, the column with attribute length holds the length in minutes of each movie.

Notice that the attributes of the relation Movies in the following figure are the same as the attributes of the entity set Movies. We shall see that turning one entity set into a relation with the same set of attributes is a common step. However, generally there is no requirement that attributes of a relation correspond to any specific elements of an E/R description of data.

Schemas

The name of a relation and the set of attributes for a relation is called the schema for that relation. We show the schema for the relation with the relation name followed by a parenthesized list of its attributes. Therefore, the schema for relation Movies of the following figure, is

                          Movies(title, year, length, filmType)

The attributes in a relation schema are a set, not a list. However, in order to talk about relations we often must specify a "standard" order for the attributes. In this way, whenever we introduce a relation schema with a list of attributes, we shall take this ordering to be the standard order  whenever we display the relation or any of its rows.

In the relational model, a design comprises one or more relation schemas. The set of schemas for the relations in a design is called a relational database schema, or just a database schema.

The relation Movies



Tags