Logic Database Design PPTS Group 6
Logic Database Design PPTS Group 6
• 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
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