Tutorials Logic, IN +91 8092939553 info@tutorialslogic.com
FAQs Support
Navigation
Home About Us Contact Us Blogs FAQs
Tutorials
All Tutorials
Services
Academic Projects Resume Writing Interview Questions Website Development
Compiler Tutorials

Relational Model in DBMS

Relational Model Concepts

The Relational Model, proposed by E.F. Codd in 1970, organizes data into relations (tables). It is the foundation of all relational database systems (MySQL, PostgreSQL, Oracle, SQL Server).

Formal TermCommon TermDescription
RelationTableA set of tuples with the same attributes
TupleRow / RecordA single data entry in a relation
AttributeColumn / FieldA named property of a relation
DomainData TypeSet of allowed values for an attribute
DegreeNumber of columnsNumber of attributes in a relation
CardinalityNumber of rowsNumber of tuples in a relation
SchemaTable structureName + list of attributes with domains

Keys in Relational Model

Key TypeDescriptionExample
Super KeyAny set of attributes that uniquely identifies a tuple{Student_ID}, {Student_ID, Name}, {Email}
Candidate KeyMinimal super key (no redundant attributes){Student_ID}, {Email}
Primary KeyChosen candidate key to uniquely identify tuplesStudent_ID
Alternate KeyCandidate keys not chosen as primary keyEmail (if Student_ID is PK)
Foreign KeyAttribute(s) referencing the primary key of another relationDept_ID in Employee references Department
Composite KeyPrimary key made of multiple attributes(Student_ID, Course_ID) in Enrollment

Relational Algebra

Relational Algebra is a procedural query language that provides a set of operations to manipulate relations. It forms the theoretical foundation for SQL.

OperationSymbolDescriptionSQL Equivalent
Selectσ (sigma)Filters rows based on a conditionWHERE clause
Projectπ (pi)Selects specific columnsSELECT columns
UnionCombines tuples from two relations (removes duplicates)UNION
IntersectionReturns tuples in both relationsINTERSECT
DifferenceReturns tuples in first but not secondEXCEPT / MINUS
Cartesian Product×Combines every tuple from both relationsCROSS JOIN
Natural JoinJoins on common attributesNATURAL JOIN
Renameρ (rho)Renames a relation or attributeAS alias

Relational Algebra Examples

Consider two relations:

EMPLOYEE (Emp_ID, Name, Dept_ID, Salary)

Emp_IDNameDept_IDSalary
1AliceD160000
2BobD275000
3CharlieD155000
4DianaD380000
  • Select employees in D1: σDept_ID='D1'(EMPLOYEE) → {Alice, Charlie}
  • Project names and salaries: πName, Salary(EMPLOYEE) → {(Alice,60000), (Bob,75000), ...}
  • Employees with salary > 60000: σSalary>60000(EMPLOYEE) → {Bob, Diana}
  • Employees in D1 with salary > 55000: σDept_ID='D1' AND Salary>55000(EMPLOYEE) → {Alice}

Integrity Constraints

  • Domain Constraint: Each attribute value must be from its defined domain (data type). E.g., Age must be a positive integer.
  • Entity Integrity: Primary key cannot be NULL. Every tuple must be uniquely identifiable.
  • Referential Integrity: A foreign key value must either be NULL or match an existing primary key value in the referenced relation.
  • Key Constraint: No two tuples can have the same primary key value.

Ready to Level Up Your Skills?

Explore 500+ free tutorials across 20+ languages and frameworks.