0% found this document useful (0 votes)
2 views22 pages

Dbms - II Unit

The document provides an overview of the relational model in database management systems (DBMS), explaining its structure, components, and operations. It discusses key concepts such as attributes, tables, tuples, and integrity constraints, as well as basic operations like insert, update, delete, and select. Additionally, it covers relational algebra, including fundamental operations and derived operations like joins, highlighting the advantages of the relational database model.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views22 pages

Dbms - II Unit

The document provides an overview of the relational model in database management systems (DBMS), explaining its structure, components, and operations. It discusses key concepts such as attributes, tables, tuples, and integrity constraints, as well as basic operations like insert, update, delete, and select. Additionally, it covers relational algebra, including fundamental operations and derived operations like joins, highlighting the advantages of the relational database model.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

UNIT-II
 The Relational Model
The relational model in DBMS is an abstract model used to organize and manage
the data stored in a database. It stores data in two-dimensional inter-related tables, also
known as relations in which each row represents an entity and each column represents
the properties of the entity.
 Introduction to the Relational Model

Relational Model (RM) represents the database as a collection of relations. A


relation is nothing but a table of values. Every row in the table represents a collection of
related data values. These rows in the table denote a real-world entity or relationship.
Relational Model Concepts in DBMS

 Attribute: Each column in a Table. Attributes are the properties which define a
relation. e.g., Student_Rollno, NAME,etc.
 Tables – In the Relational model the, relations are saved in the table format. It is
stored along with its entities. A table has two properties rows and columns. Rows
represent records and columns represent attributes.
 Tuple – It is nothing but a single row of a table, which contains a single record.
 Relation Schema: A relation schema represents the name of the relation with its
attributes.
 Degree: The total number of attributes which in the relation is called the degree
of the relation.

 Cardinality: Total number of rows present in the Table.


 Column: The column represents the set of values for a specific attribute.
 Relation instance – Relation instance is a finite set of tuples in the RDBMS system.
Relation instances never have duplicate tuples.
 Relation key – Every row has one, two or multiple attributes, which is called
relation key.
 Attribute domain – Every attribute has some pre-defined value and scope which
is known as attribute domain

[Link] Chakravarthi (ASIT CSE)


2

Relational Integrity Constraints

Relational Integrity constraints in DBMS are referred to conditions which must be


present for a valid relation. These Relational constraints in DBMS are derived from the
rules in the mini-world that the database represents.
1. Domain Constraints
2. Key Constraints
3. Referential Integrity Constraints
Domain Constraints: These are attribute level constraints. An attribute can only take
values which lie inside the domain range. e.g,; If a constrains AGE>0 is applied on
STUDENT relation, inserting negative value of AGE will result in failure.
Key Integrity: Every relation in the database should have at least one set of attributes
which defines a tuple uniquely. Those set of attributes is called key. e.g.; ROLL_NO in
STUDENT is a key. No two students can have same roll number. So a key has two
properties:
1. It should be unique for all tuples.
2. It can’t have NULL values.

Referential Integrity: When one attribute of a relation can only take values from other
attribute of same relation or any other relation, it is called referential integrity. Let us
suppose we have 2 relations

In the above example, we have 2 relations, Customer and Billing.


Tuple for CustomerID =1 is referenced twice in the relation Billing. So we know
CustomerName=Google has billing amount $300
Operations in Relational Model
Four basic update operations performed on relational database model are
Insert, update, delete and select.

[Link] Chakravarthi (ASIT CSE)


3

1. Insert is used to insert data into the relation


2. Delete is used to delete tuples from the table.
3. Modify allows you to change the values of some attributes in existing tuples.
4. Select allows you to choose a specific range of data.

Whenever one of these operations are applied, integrity constraints specified on the
relational database schema must never be violated.
Insert Operation
The insert operation gives values of the attribute for a new tuple which should be
inserted into a relation.

Update Operation
You can see that in the below-given relation table CustomerName= ‘Apple’ is updated
from Inactive to Active.

Delete Operation
To specify deletion, a condition on the attributes of the relation selects the tuple to be
deleted.

In the above-given example, CustomerName= “Apple” is deleted from the table.

The Delete operation could violate referential integrity if the tuple which is deleted is
referenced by foreign keys from other tuples in the same database.

Select Operation

[Link] Chakravarthi (ASIT CSE)


4

In the above-given example, CustomerName=”Amazon” is selected

Advantages of Relational Database Model

 Simplicity: A Relational data model in DBMS is simpler than the hierarchical and
network model.
 Structural Independence: The relational database is only concerned with data
and not with a structure. This can improve the performance of the model.
 Easy to use: The Relational model in DBMS is easy as tables consisting of rows
and columns are quite natural and simple to understand
 Query capability: It makes possible for a high-level query language like SQL to
avoid complex database navigation.
 Data independence: The Structure of Relational database can be changed without
having to change any application.
 Scalable: Regarding a number of records, or rows, and the number of fields, a
database should be enlarged to enhance its usability.
 Structure of Relational Databases
A relational database consists of a collection of tables, each of which is assigned a
unique name.
For example, consider the instructor table, which stores information about
instructors. The table has four column headers: ID, name, dept name, and salary. Each row
of this table records information about an instructor, consisting of the instructor’s ID,
name, dept name, and salary.

Similarly, the course table stores information about courses, consisting of a


course_id, title, dept name, and credits, for each course. Note that each instructor is

[Link] Chakravarthi (ASIT CSE)


5

identified by the value of the column ID, while each course is identified by the value of the
column course_id.

The third table, prereq, which stores the prerequisite courses for each course. The
table has two columns, course_id and prereq id. Each row consists of a pair of course
identifiers such that the second course is a prerequisite for the first course.
Thus, a row in the prereq table indicates that two courses are related in the sense that
one course is a prerequisite for the other. As another example, we consider the table
instructor, a row in the table can be thought of as representing.

the relational model the term relation is used to refer to a table,


 while the term tuple is used to refer to a row.
 The attribute refers to a column of a table.
 the relation instructor has four attributes: ID, name, dept name, and salary.
 We use the term relation instance to refer to a specific instance of a relation.
 For each attribute of a relation, there is a set of permitted values, called the
domain of that attribute.

 Relational Algebra
Relational Algebra came in 1970 and was given by Edgar F. Codd (Father of DBMS).
It is also known as Procedural Query Language (PQL) as in PQL, a programmer/user
has to mention two things, "What to Do" and "How to Do".
Suppose our data is stored in a database, then relational algebra is used to access the
data from the database.

[Link] Chakravarthi (ASIT CSE)


6

The First thing is we have to Access the data, this needs to be specified in the
query as "What to Do", but we have to also specify the method/procedure in the query
that is "How to Do" or how to access the data from the database.

Types of Relational Operations


In Relation Algebra, we have two types of Operations.

 Basic Operations
 Derived Operations

Basic Operations
Six fundamental operations are mentioned below. The majority of data retrieval
operations are carried out by these. Let's know them one by one.

But, before moving in detail, let's have two tables or we can say relations STUDENT(ROLL,
NAME, AGE) and EMPLOYEE(EMPLOYEE_NO, NAME, AGE) which will be used in the
below examples.

STUDENT

ROLL NAME AGE


1 Aman 20
2 Atul 18
3 Baljeet 19
4 Harsh 20
5 Prateek 21

[Link] Chakravarthi (ASIT CSE)


7

ROLL NAME AGE


6 Prateek 23

EMPLOYEE

EMPLOYEE_NO NAME AGE


E-1 Anant 20
E-2 Ashish 23
E-3 Baljeet 25
E-4 Harsh 20
E-5 Pranav 22
Select (σ)

Select operation is done by Selection Operator which is represented by "sigma"(σ). It is


used to retrieve tuples(rows) from the table where the given condition is satisfied.

Notation : σ p(R)

 Where σ is used to represent SELECTION


 R is used to represent RELATION
 p is the logic formula
 Suppose we want the row(s) from STUDENT Relation where "AGE" is 20

Syntax:-

σ AGE=20 (STUDENT)

will return the following output:

ROLL NAME AGE


1 Aman 20
4 Harsh 20

Project (∏)

Project operation is done by Projection Operator which is represented by "pi"(∏). It is


used to retrieve certain attributes(columns) from the table.

Notation : ∏ a(r)
 Where ∏ is used to represent PROJECTION
 r is used to represent RELATION
 a is the attribute list
Syntax:
∏ NAME(STUDENT)

[Link] Chakravarthi (ASIT CSE)


8

NAME
Aman
Atul
Baljeet
Harsh
Prateek

∏ ROLL,NAME(STUDENT)

Above code will return two columns, ROLL and NAME.

ROLL NAME
1 Aman
2 Atul
3 Baljeet
4 Harsh
5 Prateek
6 Prateek

Union (𝖴)

Union operation is done by Union Operator which is represented by "union"(∪). It is the


same as the union operator from set theory, i.e., it selects all tuples from both relations
but with the exception that for the union of two relations/tables both relations must
have the same set of Attributes. It is a binary operator as it requires two
operands. Notation: R ∪ S
Where R is the first relation
S is the second relation

Suppose we want all the names from STUDENT and EMPLOYEE relation.

∏ NAME(STUDENT) U ∏ NAME(EMPLOYEE)

NAME
Aman
Anant
Ashish
Atul
Baljeet
Harsh
Pranav
Prateek

[Link] Chakravarthi (ASIT CSE)


9

As we can see from above output it also eliminates duplicates.

Set Difference (-)

Set Difference as its name indicates is the difference of two relations (R-S). It is denoted
by a "Hyphen"(-) and it returns all the tuples(rows) which are in relation R but not in
relation S. It is also a binary operator.

Notation : R - S

Where R is the first relation

S is the second relation

Let's take an example where we would like to know the names of students who are in
STUDENT Relation but not in EMPLOYEE Relation.

∏ NAME(STUDENT) - ∏ NAME(EMPLOYEE)

This will give us the following output:

NAME

Aman

Atul

Prateek

Cartesian product (X)

Cartesian product is denoted by the "X" symbol. Let's say we have two relations R and S.
Cartesian product will combine every tuple(row) from R with all the tuples from S.

Notation: R X S

Where R is the first relation

S is the second relation

STUDENT X EMPLOYEE

ROLL NAME AGE EMPLOYEE_NO NAME AGE


1 Aman 20 E-1 Anant 20
1 Aman 20 E-2 Ashish 23
1 Aman 20 E-3 Baljeet 25
1 Aman 20 E-4 Harsh 20
1 Aman 20 E-5 Pranav 22

[Link] Chakravarthi (ASIT CSE)


10

ROLL NAME AGE EMPLOYEE_NO NAME AGE


2 Atul 18 E-1 Anant 20
2 Atul 18 E-2 Ashish 23
2 Atul 18 E-3 Baljeet 25
2 Atul 18 E-4 Harsh 20
2 Atul 18 E-5 Pranav 22

Rename (ρ)

Rename operation is denoted by "Rho"(ρ). As its name suggests it is used to rename the
output relation. Rename operator too is a binary operator. Notation: ρ(R,S) Where R is
the new relation name

S is the old relation name

ρ(STUDENT_NAME,∏ NAME(STUDENT))

STUDENT_NAME

NAME
Aman
Atul
Baljeet
Harsh
Prateek

Derived Operations

Also known as extended operations, these operations can be derived from basic
operations hence named Derived Operations. These include three operations: Join
Operations, Intersection operation, and Division operation.

1. Inner Join
Inner Join is used to return rows from both tables which satisfy the given condition. It
is the most widely used join operation and can be considered as a default join-type

An Inner join or equijoin is a comparator-based join which uses equality comparisons in


the join-predicate. However, if they use other comparison operators like “>” it can’t be
called equijoin.
Inner Join further divided into three subtypes:

 Theta join
 Natural join
 EQUI join

[Link] Chakravarthi (ASIT CSE)


11

Theta Join
Theta Join allows to merge two tables based on the condition represented by theta.
Theta joins work for all comparison operators such as >,<,>=,<=, etc. It is denoted by
symbol θ. The general case of JOIN operation is called a Theta join.
Syntax:

A ⋈θ B
Theta join can use any conditions in the selection criteria.

Consider the following tables.

Table A Table B
column 1 column 2 column 1 column 2
1 1 1 1
1 2 1 3
For example:

A ⋈ [Link] 2 > [Link] 2 (B)


A ⋈ [Link] 2 > [Link] 2 (B)
column 1 column 2
1 2

EQUI Join
EQUI Join is done when a Theta join uses only the equivalence condition. EQUI join is
the most difficult operation to implement efficiently in an RDBMS, and one reason why
RDBMS have essential performance problems.
For example:

Table A Table B
column 1 column 2 column 1 column 2
1 1 1 1
1 2 1 3

A ⋈ [Link] 2 = [Link] 2 (B)


A ⋈ [Link] 2 = [Link] 2 (B)
column 1 column 2
1 1

Natural Join (⋈)


Natural Join In this type of join, the attributes should have the same name and domain.
In Natural Join, there should be at least one common attribute between two relations.
It performs selection forming equality on those attributes which appear in both
relations and eliminates the duplicate attributes.

[Link] Chakravarthi(ASIT CSE)

[Link] Chakravarthi (ASIT CSE)


12

Example:
Consider the following two tables

C
Num Square
2 4
3 9

D
Num Cube
2 8
3 18

C⋈D
C⋈D
Num Square Cube
2 4 8
3 9 18

Outer Join
An Outer Join doesn’t require each record in the two join tables to have a matching
record. In this type of join, the table retains each record even if no other matching
record exists.

Three types of Outer Joins are:

 Left Outer Join


 Right Outer Join
 Full Outer Join

Left Outer Join (A B)


Left Outer Join returns all the rows from the table on the left even if no matching rows
have been found in the table on the right. When no matching record is found in the table
on the right, NULL is returned.

Consider the following 2 Tables

[Link] Chakravarthi
(ASICSE)CSECSE) CSE)
13

A B
Num Square Num Cube
2 4 2 8
3 9 3 18
4 16 5 75

A B
A B
Num Square Cube
2 4 8
3 9 18
4 16 –

Right Outer Join ( A B)


Right Outer Join returns all the columns from the table on the right even if no matching
rows have been found in the table on the left. Where no matches have been found in the
table on the left, NULL is returned. RIGHT outer JOIN is the opposite of LEFT JOIN
In our example, let’s assume that you need to get the names of members and movies
rented by them. Now we have a new member who has not rented any movie yet.

A
Num Square
2 4
3 9
4 16

B
Num Cube
2 8
3 18
5 75

[Link] Chakravarthi
(ASICSE)CSECSE) CSE)
14

A B
A B
Num Cube Square
2 8 4
3 18 9
5 75 –

Full Outer Join ( A B)


In a Full Outer Join , all tuples from both relations are included in the result, irrespective of the
matching condition.
Example:

A B
A B
Num Square Cube
2 4 8
3 9 18
4 16 –
5 – 75

Intersection (∩)

Intersection operation is done by Intersection Operator which is represented by


"intersection"(∩).It is the same as the intersection operator from set theory, i.e., it selects all the
tuples which are present in both relations. It is a binary operator as it requires two operands.
Also, it eliminate duplicates.

STUDENT

ROLL NAME AGE


1 Aman 20
2 Atul 18
3 Baljeet 19
4 Harsh 20
5 Prateek 21
6 Prateek 23

EMPLOYEE

EMPLOYEE_NO NAME AGE


E-1 Anant 20
E-2 Ashish 23
E-3 Baljeet 25

[Link] Chakravarthi(ASIT CSE)


15

EMPLOYEE_NO NAME AGE


E-4 Harsh 20
E-5 Pranav 22
∏ NAME(STUDENT) ∩ ∏ NAME(EMPLOYEE)

NAME
Baljeet
Harsh

 Relational Calculus

Relational Calculus in DBMS is all about "What you want?". Relational calculus does not tell
us how to get the results from the Database, but it just cares about what we want.

The theory of Relational calculus was introduced by computer scientist and mathematician
Edgar Codd. Let's deep dive and try to understand Relational calculus.

What is Relational Calculus?


Before understanding Relational calculus in DBMS, we need to understand Procedural
Language and Declarative Language.

Procedural Language - Those Languages which clearly define how to get the required
results from the Database are called Procedural Language. Relational algebra is a Procedural
Language.
Declarative Language - Those Language that only cares about What to get from the
database without getting into how to get the results are called Declarative Language.
Relational Calculus is a Declarative Language.

Types of Relational Calculus in DBMS


Relational Calculus is of Two Types:
1. Tuple Relational Calculus (TRC)
2. Domain Relational Calculus (DRC)
Tuple Relational Calculus (TRC)
Tuple Relational Calculus in DBMS uses a tuple variable (t) that goes to each row of the
table and checks if the predicate is true or false for the given row. Depending on the given
predicate condition, it returns the row or part of the row.

[Link] Chakravarthi(ASIT CSE)


16

The Tuple Relational Calculus expression Syntax

{t \| P(t)}
Where t is the tuple variable that runs over every Row, and P(t) is the predicate logic
expression or condition.

Customer Table
Customer_id Name Zip code

1 Rohit 12345

2 Rahul 13245

3 Rohit 56789

4 Amit 12345.

Example 1: Write a TRC query to get all the data of customers whose zip code is 12345.
TRC Query:
{t \| t ∈ Customer ∧ [Link] = 12345}
Workflow of query - The tuple variable "t" will go through every tuple of the Customer table.
Each row will check whether the Cust_Zipcode is 12345 or not and only return those rows that
satisfies the Predicate expression condition.

Result of the TRC expression above:

Customer_id Name Zip code


1 Rohit 12345
4. Amit 12345

 Domain Relational Calculus (DRC)


Domain Relational Calculus uses domain Variables to get the column values required from the
database based on the predicate expression or condition.
The Domain relational calculus expression syntax:
{<x1,x2,x3,x4...> \| P(x1,x2,x3,x4...)}

where,
<x1,x2,x3,x4...> are domain variables used to get the column values required, and P(x1,x2,x3...)
is predicate expression or condition.

Take the example of Customer Database and try to understand DRC queries with some
examples.
[Link] Chakravarthi(ASIT CSE)
17

Customer Table

Customer_id Name Zip code


1 Rohit 12345
2 Rahul 13245
3 Rohit 56789
4 Amit 12345

Example 1: Write a DRC query to get the data of all customers with Zip code 12345.

DRC query: {<x1,x2,x3> \| <x1,x2> ∈ Customer ∧ x3 = 12345 }

Workflow of Query: In the above query x1,x2,x3 (ordered) refers to the attribute or
column which we need in the result, and the predicate condition is that the first two domain
variables x1 and x2 should be present while matching the condition for each row and the third
domain variable x3 should be equal to 12345.

Result of the DRC query will be:

Customer_id Name Zip code


1 Rohit 12345
4 Amit 12345

 Integrity Constraints over Relations


In Database Management Systems, integrity constraints are pre-defined set of rules that
are applied on the table fields(columns) or relations to ensure that the overall validity, integrity,
and consistency of the data present in the database table is maintained. Evaluation of all the
conditions or rules mentioned in the integrity constraint is done every time a table insert, update,
delete, or alter operation is performed. The data can be inserted, updated, deleted, or altered only
if the result of the constraint comes out to be True.
Thus, integrity constraints are useful in preventing any accidental damage to the database
by an authorized user.
Types of Integrity Constraints

[Link] Chakravarthi(ASIT CSE)


18

There are four types of integrity constraints in DBMS:


1. Domain Constraint
2. Entity Constraint
3. Referential Integrity Constraint
4. Key Constraint

Domain Constraint

Domain integrity constraint contains a certain set of rules or conditions to restrict the kind of
attributes or values a column can hold in the database table. The data type of a domain can be
string, integer, character, DateTime, currency, etc.

Example:

Consider a Student's table having Roll No, Name, Age, Class of students.

Roll No Name Age Class


101 Adam 14 6
102 Steve 16 8
103 David 8 4
104 Bruce 18 12
105 Tim 6 A

In the above student's table, the value A in the last row last column violates the domain
integrity constraint because the Class attribute contains only integer values while A is a
character.

Entity Integrity Constraint

Entity Integrity Constraint is used to ensure that the primary key cannot be null. A primary key
is used to identify individual records in a table and if the primary key has a null value, then we
can't identify those records.

Example:

Consider Employees table having Id, Name, and salary of employees

ID Name Salary
1101 Jackson 40000
1102 Harry 60000
1103 Steve 80000
1104 Ash 1800000
James 36000

[Link] Chakravarthi(ASIT CSE)


19

In the above employee's table, we can see that the ID column is the primary key and contains a
null value in the last row which violates the entity integrity constraint.

Referential Integrity Constraint

Referential Integrity Constraint ensures that there must always exist a valid relationship
between two relational database tables. This valid relationship between the two tables confirms
that a foreign key exists in a table. It should always reference a corresponding value or attribute
in the other table or be null.

Example:

Consider an Employee and a Department table where Dept_ID acts as a foreign key between the
two tables

Employees Table

ID Name Salary Dept_ID


1101 Jackson 40000 3
1102 Harry 60000 2
1103 Steve 80000 4
1104 Ash 1800000 3
1105 James 36000 1

Department Table

Dept_ID Dept_Name
1 Sales
2 HR
3 Technical

In the above example, Dept_ID acts as a foreign key in the Employees table and a primary key in
the Department table. Row having Dept_ID=4 violates the referential integrity constraint since
Dept_ID 4 is not defined as a primary key column in the Departments table.

Key constraint

Keys are the set of entities that are used to identify an entity within its entity set uniquely.
There could be multiple keys in a single entity set, but out of these multiple keys, only one key
will be the primary key. A primary key can only contain unique and not null values in the
relational database table.

Example:

Consider a student's table

[Link] Chakravarthi(ASIT CSE)


20

Roll No Name Age Class


101 Adam 14 6
102 Steve 16 8
103 David 8 4
104 Bruce 18 12
102 Tim 6 2

The last row of the student's table violates the key integrity constraint since Roll No 102 is
repeated twice in the primary key column. A primary key must be unique and not null therefore
duplicate values are not allowed in the Roll No column of the above student's table.

 Logical Database Design


Logical design is the second stage in the database design process. The logical design goal
is to design an enterprise-wide database that is based on a specific data model but independent
of physical-level details. Logical design requires that all objects in the conceptual model be
mapped to the specific constructs used by the selected database model. For example, the logical
design for a relational DBMS includes the specifications for the relations (tables), relationships,
and constraints (in other words, domain definitions, data validations, and security views).

Logical Design Steps

1 Map the conceptual model to logical model components.


2 Validate the logical model using normalization.
3 Validate the logical model integrity constraints.
4 Validate the logical model against user requirements.

1. Map The Conceptual Model To The Logical Model


The first step in creating the logical design is to map the conceptual model to the chosen
database constructs. logical design generally involves translating the ER model into a set of
relations (tables), columns, and constraint definitions. The process of translating the conceptual
model into a set of relations is depicted.

1 Map strong entities.


2 Map supertype/subtype relationships.
3 Map weak entities.
4 Map binary relationships.
5 Map higher-degree relationships.

Simple College ER model

[Link] Chakravarthi(ASIT CSE)


21

First step in the logical design stage is to map strong entities to tables. That a strong entity
is one that resides in the “1” side of all its relationships— that is, an entity that does not have a
mandatory attribute that is a foreign key to another table. Therefore, the first entities to be
translated into tables would be the EMPLOYEE and COURSE entities.
In this case, they define the table name, its columns, and their characteristics. For example,
the relation definitions for the strong entities of Simple College would be:
COURSE (CRS_CODE, CRS_TITLE, CRS_DESCRIPT, CRS_CREDIT)
PRIMARY KEY: CRS_CODE
EMPLOYEE (EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_E_MAIL)
PRIMARY KEY: EMP_NUM

Once all strong entities are mapped, they are ready to map any entities involved in a
supertype/subtype relationship or any weak entities.
In the case of Simple College, the PROFESSOR entity is a subtype of the EMPLOYEE entity.
PROFESSOR is also a weak entity because it inherits its primary key from EMPLOYEE and is
existence-dependent on EMPLOYEE.

PROFESSOR (EMP_NUM, PROF_SPECIALTY, PROF_RANK)


PRIMARY KEY: EMP_NUM
FOREIGN KEY: EMP_NUM REFERENCES EMPLOYEE

Next, mapping all binary relationships. In the previous example you defined the
supertype/subtype relationship between EMPLOYEE and PROFESSOR.

CLASS (CLASS_CODE, EMP_NUM, CLASS_TIME, CLASS_DAYS, CRS_CODE)


PRIMARY KEY: CLASS_CODE
FOREIGN KEYS: EMP_NUM REFERENCES PROFESSOR
CRS_CODE REFERENCES COURSE

Next, proceed with all relationships between three or more entities until all relationships in the
model are clearly defined. The logical design’s tables must correspond to the entities
(EMPLOYEE, PROFESSOR, COURSE, and CLASS), and the table columns must correspond to the
attributes specified in the conceptual design. The final outcome of this process is a list of relations,
attributes, and relationships that will be the basis for the next step.

2. Validate the Logical Model Using Normalization

[Link] Chakravarthi(ASIT CSE)


22

Activities such as normalization take place at different stages in the design process. Each
time they reiterate a step, the model is further refined and better documented. New attributes
may be created and assigned to the proper entities. Functional dependencies among determinant
and dependent attributes are evaluated and data anomalies are prevented via normalization.

3. Validate Logical Model Integrity Constraints


The translation of the conceptual model into a logical model also requires definition of the
attribute domains and appropriate constraints.
For example, the domain definitions for the CLASS_CODE, CLASS_DAYS, and CLASS_ TIME
attributes displayed in the CLASS entity
CLASS_CODE is a valid class code.
Type: numeric
Range: low value = 1000 high value = 9999
Display format: 9999
Length: 4
CLASS_DAYS is a valid day code.
Type: character
Display format: XXX
Valid entries: MWF, TR, M, T, W, R, F, S
Length: 3
CLASS_TIME is a valid time.
Type: character
Display format: 99:99 (24-hour clock)
Display range: 06:00 to 22:00
Length: 5

4. Validate the Logical Model Against User Requirements


The logical design translates the software-independent conceptual model into a software-
dependent model. The final step in the logical design process is to validate all logical model
definitions against all end-user data, transaction, and security requirements.

[Link] Chakravarthi(ASIT CSE)

You might also like