0% found this document useful (0 votes)
7 views18 pages

Logic Database Design PPTS Group 6

Logical Database Design involves structuring data elements and their relationships to create a logical representation of a database, following conceptual design and preceding physical design. It includes converting ER diagrams into structured schemas with tables, keys, and constraints, while ensuring data integrity through various rules. The process is crucial for creating a scalable and efficient database that enhances understanding and communication among stakeholders.

Uploaded by

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

Logic Database Design PPTS Group 6

Logical Database Design involves structuring data elements and their relationships to create a logical representation of a database, following conceptual design and preceding physical design. It includes converting ER diagrams into structured schemas with tables, keys, and constraints, while ensuring data integrity through various rules. The process is crucial for creating a scalable and efficient database that enhances understanding and communication among stakeholders.

Uploaded by

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

LOGIC DATABASE DESIGN

Logical Database Design is the process of structuring the data


elements and their relationships to form a logical
representation of the database. This step comes after the
conceptual design (ER diagram) and before the physical
design (implementation in a specific DBMS like MySQL or
Oracle).
Logic database design is derived from the ER diagrams
Differences between ER diagrams and
logic database design
Based on definition purpose
• ERD (Entity Relationship Diagram):
- Conceptual model of data and its relationships
- Used in early stages of system design

• Logical Database Design:


- Structured schema of how data is stored logically
- Includes tables, attributes, keys, and constraints
key differences
• Purpose:
- ERD: Conceptual visualization
- Logical Design: Structured implementation

• Detail Level:
- ERD: High-level
- Logical Design: Detailed and technical

• Focus:
- ERD: Entities and relationships
- Logical Design: Data types, keys, constraints
Steps for converting ER diagrams to logic
database design
1. Conversion of each entity to table
Each entity becomes a table and attributes become columns.
2. Define primary keys
Assign a unique identifier for each table (e.g., StudentID).
3. Conversion of relationship to foreign keys
Add primary key of the related table as a foreign key to establish
relationships
4. Specify attributes with data types
Choose appropriate data types (e.g., INT, VARCHAR, DATE).
5. Normalize the tables
Apply normalization (1NF, 2NF, 3NF) to reduce redundancy.
6. Define constraints
e.g. Add NOT NULL, UNIQUE, CHECK, DEFAULT, etc.
7 Define business rules
Implement rules like e.g. ‘No access to results until payments are
complete’.
8. Review for integrity
Ensure referential integrity and consistency in foreign keys.
9. Create logical schema documentation
Document tables, keys, data types, relationships, and constraints.
Logical Schema
 Describes the structure of the database in terms of tables, columns,
and relationships.
Includes constraints like primary keys(, foreign keys, and unique
constraints.
Primary key; A column or a set of columns that uniquely identify
each row in a table.
Role – to enforce integrity; every table must have a primary key
Cont…
For every row the PK
must have a non-null value
 the value must be unique
 the value must not change or become ‘null’ during the table lifetime
NB: Columns with these characteristics are candidate keys
Foreign key; Column(s) in a table that serves as a PK of another table
Enforces referential integrity by completing an association between two
tables.
Data integrity
Refers to the accuracy and consistency of the data by applying integrity
constraints rules
Attributes associate with each instance of an entity a value from a
domain of values for that attribute
Types data integrity rules in database
CONSTRAINT TYPE EXPLANATION

Entity integrity No part of a PK can be NULL

Referential Integrity A FK must match an existing PK value or else be NULL

Column Integrity A column must contain only values consistent with the defined data format of the column

User-defined The data stored in the database must comply with the business rules
Integrity
Example of logical database design by using Aris3
ER DIAGRAM
Student (StudentID, Name, RegistrationNumber, Program, YearOfStudy,
PaymentStatus)
|
| 1 --------< (M) Payments (PaymentID, PaymentDate, Amount, PaymentType,
StudentID FK)
|
| 1 --------< (M) Results (ResultID, CourseCode, CourseName, Grade, AcademicYear,
Semester, StudentID FK)

(Business Rule: Only Students with PaymentStatus = 'Completed' can access Results)
Student
Column Name Data Type Constraints
StudentID INTEGER PRIMARY KEY, NOT NULL
Name VARCHAR(100) NOT NULL
RegistrationNumber VARCHAR(50) UNIQUE, NOT NULL
Program VARCHAR(100) NOT NULL
YearOfStudy INTEGER NOT NULL
PaymentStatus VARCHAR (20) CHECK (PaymentStatus IN
('Pending', 'Completed')),
DEFAULT 'Pending'
Payments
Column Name Data Type Constraints

PaymentID INTEGER PRIMARY KEY, NOT NULL

StudentID INTEGER FOREIGN KEY → Student


(StudentID), NOT NULL
PaymentDate DATE NOT NULL

Amount DECIMAL (10,2) NOT NULL

PaymentType VARCHAR(50) NOT NULL


Results
Column Name Data Type Constraints
ResultID INTEGER PRIMARY KEY, NOT
NULL
StudentID INTEGER FOREIGN KEY →
Student(StudentID), NOT
NULL
CourseCode VARCHAR(20) NOT NULL
CourseName VARCHAR(100) NOT NULL
Grade VARCHAR(2) NOT NULL
AcademicYear VARCHAR(10) NOT NULL
Semester INTEGER NOT NULL
Logical schema that can run in SQL
CREATE TABLE Student (
StudentID INT PRIMARY KEY,
Name VARCHAR(100),
PaymentStatus VARCHAR(20) CHECK (PaymentStatus IN ('Pending',
'Completed'))
);
CREATE TABLE Payments (
PaymentID INT PRIMARY KEY,
Amount DECIMAL(10, 2),
StudentID INT,
FOREIGN KEY (StudentID) REFERENCES Student(StudentID)
);
CREATE TABLE Results (
ResultID INT PRIMARY KEY,
Grade VARCHAR(2),
StudentID INT,
FOREIGN KEY (StudentID) REFERENCES Student(StudentID)
);
Importance of Logical Design:
Ensures a well-structured, scalable, and efficient database.
 Helps in understanding data flows and relationships clearly.
 Facilitates communication between technical and non-technical
stakeholders.

You might also like