*ASSIGNMENT *
Submitted by: Zoha Rehan
Roll no : 10
Class : BS-Computer science _ 3rd semester
Subject : Database management system
Submitted to : Miss Amber
College name : Govt . Graduate college , Pasrur
~Logical view of data ~
The logical view of data focuses on how information is logically organized and related inside a database.
It shows what data is stored and how different pieces of data are connected, without worrying about how it is stored physically on the
computer.
It helps users and designers to understand relationships between tables.
It hides complex physical details like file structure and storage.
📘 Example:
A university database may contain entities like Students, Courses, and Departments.
The logical view will show how these entities are related — e.g., which student studies in which department and which course they
have enrolled in.
~Entities and Attributes ~
Entity:
An entity is any object, person, place, or concept that we want to store information about.
Entities are represented as tables in a relational database.
📘 Examples:
Student (represents each student)
Teacher (represents each teacher)
Department (represents each department)
Attribute :
An attribute is a property or characteristic that describes an entity.
📘 Example:
For the entity Student, attributes can be:
Student ID , Name , Age , Gender, Department etc .,
So, a Student entity can be described as:
Student (Student ID,, Name, Age, Gender, Department)
~Tables and their characteristics~
Tables :
In the relational model, data is stored in tables (relations).
Each table has rows and columns:
Term Meaning
Table (Relation) Represents an entity
Row (Tuple) Represents one record of that entity
Column (Attribute) Represents a property of that entity
📘 Example Table: Student
Student ID Name Age Department
101 Ali Khan 20 CS
102 Sara Noor 21 IT
103 Hamza Raza 19 SE
Characteristics of Tables:
1. Each table has a unique name.
2. Each column has a unique attribute name.
3. Each row is unique (usually identified by a key).
4. The order of rows or columns doesn’t matter logically.
~Keys~
🔑 Keys:
Keys are used to identify records uniquely and to link tables together.
Type. Description Example
Primary Key Uniquely identifies each record in a table. Student ID
Foreign Key. Creates a relationship between two tables. Dept_ID in Student table refers to Department
table
Candidate Key Attributes that can serve as primary keys. Roll no , CNIC
Composite Key A key formed by combining two or more attributes.. (Student ID, Course ID)
Alternate Key Remaining candidate keys after choosing one as primary key. CNIC if Student ID is chosen as PK
📘 Example :
In the Student table, Student ID uniquely identifies each student →
Primary Key.
If there’s a Department table with Dept_ID, then Student. Dept_ID can
be a Foreign Key linking both tables.
~ Relational Data Model ~
Relational Data Model:
The relational data model represents all data in the form of tables
(relations).
Each table consists of rows and columns, and relationships among tables
are maintained using keys.
📘 Example:
Two tables can be related like this:
Student Table
Student ID Name. Dept_ID
101 Ali Khan D1
102 Sara Noor D2
Department Table
Dept_ID. Dept. _ Name
D1. Computer Science
D2 Information Tech
Here, Dept_ID is a Foreign Key in the Student table and a Primary Key in the Department table.
~Attributes, schema, Tuples, Domains~
Attributes, Schemas, Tuples, Domains
Term. Description. Example
Attribute A property of an entity (column in a table). Name, Age
Schema The structure or design of a table. Student(Student ID, Name )
Tuple. A single record or row in a table. (101, Ali Khan, 20, D1)
Domain. Set of valid values an attribute can have. Domain of Age =
[15–30
~Relation Instances~
Relation Instances :
A Relation instance means the actual data present in a table at a given
[Link] changes whenever data is inserted, updated, or deleted.
📘 Example:
Student ID. Name. Age Dept_ID
101 Ali Khan. 20. D1
102 Sara Noor. 21. D2
Here, these two rows are the relation instance of the Student table.
~ Integrity Constraints ~
⚖️ Integrity Constraints:
Integrity constraints are rules that ensure the accuracy and consistency
of data in the databases system.
Constraint. Description Example
Domain Constraint. L Each attribute must have a valid value. Age must
be between 15–30
Entity Integrity Primary key must be unique and not NULL. Each
Student ID must be unique
Referential Integrity Foreign key must refer to a valid record in another table.
Each Dept_ID in Student table must exist in Department table
~Conclusion~
✨ Conclusion
The logical view of data helps in understanding how data is structured, stored, and
related in a database system.
By organizing information into entities, attributes, and tables — and maintaining
relationships through keys and constraints — the relational model ensures data is
consistent, reliable, and easy to access.