Submitted by:
Name: Muhammad Husnain
Reg no: FA22-BBA-129
Class: BBA(c)
Submitted to:
Mam Rimsha Anam
Course: Management Information System
Due date: Nov 26,2024
Exploring & Elaborating the following terms:
Attribute:
An attribute is a property or characteristic of an entity. It represents a column in a table and
holds data about an entity. For example, in a "EMPLOYEE" table, attributes might include
"Name," "Email," and "Employee id."
ATTRIBUTE
Field:
A field is a single unit of data or a specific piece of information within a record.
For example, in a "emplyee" table, a field might contain the employee's name, email address,
depending on the attribute. Each field stores data for one attribute of an entity in a record (row).
FIELD
TUPLE:
A tuple is a single row of data in a table. It represents a complete set of related values for an
entity.
Tuple
In this image we can see a tuple, where employee id is 1, Name Husnain, and Email
[email protected].
RELATION:
A relation in a database is just a table that organizes data into rows and columns.
Rows (also called tuples) represent individual records or entries. For example, in an
employee table, each row represents a different employee.
Columns (also called attributes) represent different pieces of information about each
record. For example, columns might include things like "Name," "Email,".
ROW
COULMN
PRIMARY KEY:
A primary key in a database is a column that uniquely identifies each row (or record) in a table.
Key Points:
1. Uniqueness: The values in the primary key column must be unique for every row in the
table. No two rows can have the same primary key value.
2. Non-null: A primary key cannot have NULL values. Every record must have a valid
value for the primary key.
3. Single or Composite: A primary key can consist of a single column (like an "ID") or
multiple columns (called a composite key) to uniquely identify a record.
In logical view we can
As you can see we assign
assign a primary key to
primary key to “EMPLOYEE ID”
attribute
FOREIGN KEY:
A foreign key in a database is a field (or a collection of fields) in one table that uniquely
identifies a row in another table. It is a way to establish and enforce a link between the data in
two tables. This relationship helps maintain data integrity and ensures that the data across tables
remain consistent.
PRIMARY KEY FOREIGN KEY IN
IN THAT TABLE SECOND TABLE
COMPOSITE KEY:
A composite key is a combination of two or more columns in a database table that are used
together to uniquely identify a record. While a primary key is typically a single column that
uniquely identifies each record in a table, a composite key is used when no single column is
sufficient to guarantee uniqueness. Instead, the combination of columns ensures that the data is
unique. BOTH ARE UNIQUE
SO THAT’S THE
COMPOSITE KEY
CONCEPT OF KEY:
A key is a field in a table that is used to identify records uniquely, establish relationships
between tables, and maintain data integrity. Keys are fundamental to ensuring that the data in a
database is structured, efficient, and consistent. They help to uniquely identify rows, relate
tables, and enforce constraints that keep data accurate.
There are sevral keys like Primary key, foreign key, composite key, serogate key (system
genrated).
REFERENTIAL INTEGRITY:
Referential integrity ensures that a foreign key in one table always matches a primary key or a
unique key in another table, preventing orphaned records and preserving the accuracy and
validity of relationships between tables.
It ensures that
foreign key we
are using is
accurate.
preventing low
Relationships:
Relationships refer to the associations between different tables in a database. Understanding and
defining these relationships correctly is essential for organizing data efficiently and ensuring data
integrity. There are three primary types of relationships in relational databases:
1. One-to-One (1:1) Relationship
In a one-to-one relationship, one record in a table is related to only one record in another table,
and vice versa.
Expample: just like (employee table) one employee have one detail in another table.
2. One-to-Many (1:M) Relationship
In a one-to-many relationship, a single record in one table can be associated with multiple
records in another table, but each record in the second table can be associated with only one
record in the first table.
Example: one employee has many payrolldetails (like payroll of september, october &
november).
3. Many-to-Many (M:M) Relationship
In a many-to-many relationship, multiple records in one table can be associated with multiple
records in another table.
One to one
relationship One to many
relationship
Logical view:
Logical view reffers to view which can be saw by developer of data base, logical view is the
most important view on any database where we describe strucure of the data (validation rules,
input masks) that view is working bhind the main physical view.
Logical view
PHYSICAL VIEW:
Physical view is the main view on any data base. Where we manage our data base, Where we
enter data into records. Physical view shown to the main person who are managing the data base.
Physical view
of database
Schema:
A schema is the organizational blueprint of a database, defining the structure of tables, views,
relationships, and constraints. It outlines how data is logically stored and accessed within a
database system.
Entity Relationship Diagram (ERD):
An ERD is a visual representation of the entities in a system and their relationships. It is used in
database design to map out data structures and show how entities (such as Employees or Payroll
details) interact.
Database:
A database is an organized collection of data stored and accessed electronically. It is designed to
efficiently store, retrieve, and manage large amounts of information.
There are two types of database:
DBMS (Database management system)
RDBMS (Relational database management system)
Database looks like this where we enter and manage the data.
DATA REDUNDANCY:
Data Redundancy refers to the unnecessary duplication of data within a system or database,
often leading to inefficiencies in storage and maintenance.
WE TRY TO ENTER
DUPLICATE DATA
Error of duplication
appear
In this image we adding duplicate data.
We have to remove duplicate data to solve that error (After removing duplicate record
error also removed):
DATA INCONSISTENCY:
Data Inconsistency occurs when multiple copies of the same data hold conflicting or outdated
values, typically due to redundancy, causing errors and confusion. Example: when we don’t
update the record in two or more tables it also causes data inconsistency.
In this image we saw data inconsistency.
Removing data inconsistency:
After updating the both records. Data inconsistency removed.