0% found this document useful (0 votes)
0 views7 pages

Unit2-Relational Database Model

The relational database model organizes data into tables (relations) with rows (tuples) and columns (attributes), ensuring data accuracy and integrity through the use of keys. It supports SQL for efficient data management and querying, and provides a logical view that abstracts the physical storage details. Key types include super keys, candidate keys, primary keys, alternate keys, and foreign keys, which help maintain relationships and data integrity across tables.

Uploaded by

Priya Suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views7 pages

Unit2-Relational Database Model

The relational database model organizes data into tables (relations) with rows (tuples) and columns (attributes), ensuring data accuracy and integrity through the use of keys. It supports SQL for efficient data management and querying, and provides a logical view that abstracts the physical storage details. Key types include super keys, candidate keys, primary keys, alternate keys, and foreign keys, which help maintain relationships and data integrity across tables.

Uploaded by

Priya Suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

RELATIONAL DATABASE MODEL

The relational database model in DBMS represents data in tables with rows
and columns, where each table is called a relation.
This model simplifies database management and ensures data accuracy by
organizing information into structured, inter-related tables.
It uses SQL to manage and query the data, and is widely used due to its
consistency and efficiency, especially for complex queries.

Core Concepts:
 Relations (Tables):
Data is stored in tables, also known as relations. Each table represents an entity or a
relationship between entities.
 Rows (Tuples):
Each row in a table represents a single instance or record of the entity.
 Columns (Attributes):
Each column represents a specific characteristic or attribute of the entity.
 Relationships:
Tables can be linked to each other through primary and foreign keys, establishing
relationships between different entities
.

Advantages:

 Data Integrity:
The relational model enforces data integrity through constraints like primary keys and
foreign keys, ensuring data accuracy and consistency.
 Data Independence:
The logical structure of the data (tables, views, etc.) is separate from the physical
storage, allowing changes to the physical storage without affecting how users access
the data.
 SQL Support:
The standard query language, SQL, provides a consistent and efficient way to interact
with relational databases.
 Flexibility and Scalability:
Relational databases are designed to handle a wide range of data sizes and can be
scaled to accommodate growing data needs.
Example:

Imagine a database for a library. It might have tables for:


 Books: Columns for book ID, title, author, ISBN, etc.
 Members: Columns for member ID, name, address, etc.

Popular Relational DBMS:


MySQL, PostgreSQL, Microsoft SQL Server, Oracle Database, and MariaDB.
logical View of Data
A logical view in a DBMS (Database Management System) is a representation
of the database's structure and organization as perceived by users or
applications, without revealing the underlying physical storage details.

The major purpose of the DBMS is to provide users with an abstract view of the data,
which hides the details of how the system stores and maintains the data.

Data Abstraction
 Physical level

This describes where the data physically resides and the specifics of how the
data is stored.

 Logical level

This the schema of the database, describes the data and its relationships

 View level

This level describes the data that is presented to the user and can present only a
portion of a database, or can be a composite from more than one database.
 Abstraction:
It hides the complexities of how data is physically stored (e.g., file structures, indexing
methods) from users and applications.
 Data independence:
Changes to the physical storage of data (e.g., moving data to a different server,
adding a new index) should not affect the logical view or require changes to
applications that use it.
 Conceptual representation:
It defines the data elements, their attributes, and the relationships between them.
 User-specific:
Logical views can be tailored to the specific needs of different users or applications,
providing them with a customized view of the data.
Example:
Imagine a database with employee information. A logical view might present
the data as a table with columns like "Employee ID", "Name", "Department",
and "Salary". The user of this view doesn't need to know how the data is
physically stored (e.g., whether it's in a single table or split across multiple
tables, how the data is indexed).

Keys
A key is an attribute or set of attributes that help to uniquely identify a record or a row of
data in a table(relation).
Why do we need Keys?
1. Keys are used to establish and identify relationships between tables/relations.
2. They uniquely identify any record/row inside a table/relation.
3. They also ensure that data integrity is maintained.
Types keys in DBMS/RDBMS
The different types of keys in DBMS/RDBMS are:
 Super Key
 Candidate Key
 Primary Key
 Alternate Key
 Foreign Key

For understanding the different types of keys better, let us consider the below table. In
this ‘Student’ table, ID, Registration_No. and Name of students are given.
Super Key

If a set of one or more attributes can uniquely identify the entities of an entity set, then it
is called a super key.

Example: In the above table the super keys are


{ ID }
{Registration_No.}
{ ID, Registration_No.}
{ID, Name}
{Registration_No. ,Name}
{ID, Registration_No., Name}

NOTE: {Name} is not a super key as there is more than one record/row with the same
name.

Candidate Key
Candidate keys are selected from a set of super keys. If a super key has no
unnecessary attributes, then such a minimal super key is called a candidate key. It is
also termed as ‘Minimal Super Key’.

Example: In the student entity set {ID}, {Registration_No.}, {ID,


Registration_No.} etc. are candidate keys. But {ID, Name} is not a candidate key,
because {Name} is a redundant attribute.

Primary Key
Primary keys are selected from a set of candidate keys. It is a candidate key selected
by the database designer to uniquely identify the records of a table.
 The primary key field of a table must be unique and cannot be null.
 A table does not contain more than one primary key.

Alternate Key
If a candidate key is not selected as a primary key then it is called an alternate key.

Example: If {ID} is selected as primary key, then {Registration_No.} can be selected


as an alternate key

Foreign Key
If two relations or tables have a common attribute, which is the primary key in one table
and a non-key attribute in another table, then such a non-key attribute is called a foreign
key.
 A table can contain zero or more foreign keys.
 It helps to combine the tuples of two tables during the join operation.

You might also like