Structure of Relational Databases




A relational database consists of a collection of tables, each of which is assigned a
unique name. For example, consider the instructor table of Figure 2.1, which stores
information about instructors. The table has four column headers: ID, name, dept_
name,
and salary. Each row of this table records information about an instructor,
consisting of the instructor’s ID, name, dept_name, and salary. Similarly, the course
table of Figure 2.2 stores information about courses, consisting of a course_id, title,
dept_name
, and credits, for each course. Note that each instructor is identified by
the value of the column ID, while each course is identified by the value of the
column course_id.


Figure 2.3 shows a third table, prereq,which stores the prerequisite courses for
each course. The table has two columns, course_id and prereq_id. Each row consists
of a pair of course identifiers such that the second course is a prerequisite for the
first course.


Thus, a row in the prereq table indicates that two courses are related in the
sense that one course is a prerequisite for the other. As another example, we
consider the table instructor, a row in the table can be thought of as representing
the relationship between a specified ID and the corresponding values for name,
dept_name
, and salary values.

Structure of Relational Databases
In general, a row in a table represents a relationship among a set of values.
Since a table is a collection of such relationships, there is a close correspondence
between the concept of table and the mathematical concept of relation, fromwhich
the relational data model takes its name. In mathematical terminology, a tuple is
simply a sequence (or list) of values. A relationship between n values is represented
mathematically by an n-tuple of values, i.e., a tuple with n values, which
corresponds to a row in a table.

Structure of Relational Databases

Structure of Relational Databases
Thus, in the relational model the term relation is used to refer to a table, while
the term tuple is used to refer to a row. Similarly, the term attribute refers to a
column of a table.


Examining Figure 2.1,we can see that the relation instructor has four attributes:
ID, name, dept_name, and salary.


We use the term relation instance to refer to a specific instance of a relation,
i.e., containing a specific set of rows. The instance of instructor shown in Figure 2.1
has 12 tuples, corresponding to 12 instructors.


The order in which tuples appear in a relation is irrelevant, since a relation
is a set of tuples. Thus, whether the tuples of a relation are listed in sorted order,
as in Figure 2.1, or are unsorted, as in Figure 2.4, does not matter; the relations in
the two figures are the same, since both contain the same set of tuples. For ease
of exposition, we will mostly show the relations sorted by their first attribute.

Structure of Relational Databases


For each attribute of a relation, there is a set of permitted values, called the
domain of that attribute. Thus, the domain of the salary attribute of the instructor
relation is the set of all possible salary values, while the domain of the name
attribute is the set of all possible instructor names.


We require that, for all relations r, the domains of all attributes of r be atomic.
A domain is atomic if elements of the domain are considered to be indivisible
units. For example, suppose the table instructor had an attribute phone_number,
which can store a set of phone numbers corresponding to the instructor. Then the
domain of phone_number would not be atomic, since an element of the domain is a
set of phone numbers, and it has subparts, namely the individual phone numbers
in the set.


The important issue is not what the domain itself is, but rather how we use
domain elements in our database. Suppose now that the phone number attribute
stores a single phone_number. Even then, if we split the value from the phone
number attribute into a country code, an area code and a local number, we would
be treating it as a nonatomic value. If we treat each phone number as a single
indivisible unit, then the attribute phone_number would have an atomic domain.


The null value is a special value that signifies that the value is unknown or
does not exist. For example, suppose as before that we include the attribute phone_
number
in the instructor relation. It may be that an instructor does not have a
phone number at all, or that the telephone number is unlisted. We would then
have to use the null value to signify that the value is unknown or does not exist.
We shall see later that null values cause a number of difficulties when we access
or update the database, and thus should be eliminated if at all possible.



Frequently Asked Questions

+
Ans: Information processing drives the growth of computers, as it has from the earliest days of commercial computers. In fact, automation of data processing tasks predates computers. view more..
+
Ans: A primary goal of a database system is to retrieve information from and store new information into the database. People who work with a database can be categorized as database users or database administrators. view more..
+
Ans: Researchers have developed several data-models to deal with these application domains, including object-based data models and semi-structured data models. view more..
+
Ans: A relational database consists of a collection of tables, each of which is assigned a unique name. view more..
+
Ans: The database schema is the logical design of the database. view more..
+
Ans: A super-key is a set of one or more attributes that, taken collectively, allow us to identify uniquely a tuple in the relation. view more..
+
Ans: DBMS typically includes a database security and authorization subsystem that is responsible for ensuring the security of portions of a database against unauthorized access view more..
+
Ans: The typical method of enforcing discretionary access control in a database system is based on the granting and revoking of privileges. Let us consider privileges in the context of a relational DBMS. view more..
+
Ans: This chapter discusses techniques for securing databases against a variety of threats. It also presents schemes of providing access privileges to authorized users. view more..
+
Ans: This chapter discusses techniques for securing databases against a variety of threats. It also presents schemes of providing access privileges to authorized users. view more..
+
Ans: Object databases is the power they give the designer to specify both the structure of complex objects and the operations that can be applied to these objects view more..
+
Ans: XML (Extensible Markup Language)—has emerged as the standard for structuring and exchanging data over the Web. XML can be used to provide information about the structure and meaning of the data in the Web pages rather than just specifying how the Web pages are formatted for display on the screen view more..
+
Ans: A database schema, along with primary key and foreign key dependencies, can be depicted by schema diagrams. view more..
+
Ans: A query language is a language in which a user requests information from the database. view more..
+
Ans: All procedural relational query languages provide a set of operations that can be applied to either a single relation or a pair of relations. view more..
+
Ans: An object database is a database management system in which information is represented in the form of objects as used in object-oriented programming. Object databases are different from relational databases which are table-oriented. Object-relational databases are a hybrid of both approaches. view more..
+
Ans: IBM developed the original version of SQL, originally called Sequel, as part of the System R project in the early 1970s. view more..
+
Ans: The set of relations in a database must be specified to the system by means of a data-definition language (DDL). view more..




Rating - 3/5
475 views

Advertisements