Professional Documents
Culture Documents
Model
attributes
(or columns)
tuples
(or rows)
• The set of allowed values for each attribute is called the domain of the
attribute
• Attribute values are (normally) required to be atomic; that is, indivisible
• The special value null is a member of every domain. Indicated that the
value is “unknown”
• The null value causes complications in the definition of many operations
Example
EmpSSN EmpNum Empname
In the given table StudID, Roll No, and Email are candidate keys which
help to uniquely identify the student record in the table.
In this example, there are two tables: Teacher and Department in a school. However,
there is no relationship to realize which teachers work in which department.
Thus, in this table, adding the foreign key in DeptCode to the Teacher table, a
relationship can be created between two tables.
• select:
• project:
• union:
• set difference: –
• Cartesian product: x
• rename:
dept_name=“Physics” (instructor)
• Result
• Thus
instructor.id = teaches.id (instructor x teaches ))
• Result
• Query 2
dept_name=“Physics” ( salary > 90.000 (instructor))
• The two queries are not identical; they are, however, equivalent -- they
give the same result on any database.
• Query 2
(dept_name=“Physics” (instructor)) ⋈ instructor.ID = teaches.ID teaches
• The two queries are not identical; they are, however, equivalent -- they
give the same result on any database.
2. Consider the above bank database and give an expression in the relational
algebra for each of the following queries.
a. Find the names of all branches located in “Chicago”.
b. Find the names of all borrowers who have a loan in branch “Downtown”.
Faculty of Information Science, University of Computer
Studies, Yangon (UCSY)
2.37
Assignments