Relational Model Concept: Hassan Khan
Relational Model Concept: Hassan Khan
Relational Model Concept: Hassan Khan
Hassan Khan
Things to Remind
• Tables − In relational data model, relations are saved in the format of Tables. This format
stores the relation among entities. A table has rows and columns, where rows represents
records and columns represent the attributes.
• Tuple − A single row of a table, which contains a single record for that relation is called a tuple.
• Relation instance − A finite set of tuples in the relational database system represents relation
instance. Relation instances do not have duplicate tuples.
• Relation schema − A relation schema describes the relation name (table name), attributes, and
their names.
• Attribute domain − Every attribute has some pre-defined value scope, known as attribute
domain.
Properties of Relations
• Foreign keys are the column of the table which is used to point to the
primary key of another table.
• In a company, every employee works in a specific department, and
employee and department are two different entities. So we can't
store the information of the department in the employee table. That's
why we link these two tables through the primary key of one table.
• We add the primary key of the DEPARTMENT table, Department_Id as
a new attribute in the EMPLOYEE table.
• Now in the EMPLOYEE table, Department_Id is the foreign key, and
both the tables are related.
Relational Algebra
Hassan Khan
Relational Algebra
• Relational algebra is a procedural query language. It gives a step by
step process to obtain the result of the query. It uses operators to
perform queries.
• Types of Relational operation
Select Operation:
• Suppose there are two tuples R and S. The union operation contains
all the tuples that are either in R or S or both in R & S.
• It eliminates the duplicate tuples. It is denoted by ∪.
• Notation: R ∪ S
• A union operation must hold the following condition:
• The Cartesian product is used to combine each row in one table with
each row in the other table. It is also known as a cross product.
• It is denoted by X.
• Notation: E X D
• Example:
Rename Operation:
• ρ(STUDENT1, STUDENT)