0% found this document useful (0 votes)
36 views3 pages

Advanced Database Design Scenarios

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)
36 views3 pages

Advanced Database Design Scenarios

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

Advanced Scenario-Based Questions for

Database Design and Normalization


1. Advanced Library Management System
• **Scenario:**

You are tasked with designing a comprehensive Library Management System.


The system must manage books, members, borrowings, staff, and reservations.

• **Requirements:**

• Books can have multiple authors and editions.


• Each member can borrow up to 5 books at a time.
• Track borrowing history with dates, due dates, return dates, and overdue fines.
• Members can reserve books; if a book is returned, it's allocated to the next
reservation.
• Staff manage borrowings, returns, fines, and reservations.
• Include login credentials and roles (Admin, Librarian, Member).

• **Tasks:**

• Draw an extended ER Diagram with weak entities, multi-valued attributes, and role-
based relationships.
• Convert to a normalized relational schema (3NF).
• Identify candidate keys and foreign keys.

2. School/University Management System with Exams


• **Scenario:**

Build a system for a university to manage students, courses, instructors, enrollments,


exams, and grades.

• **Requirements:**

• Each student belongs to a department and enrolls in multiple courses.


• Each course can have multiple instructors (e.g., theory and lab).
• The system must handle midterms, finals, quizzes, and assignments separately.
• Grades must be weighted (e.g., 30% midterm, 50% final, 20% assignments).
• Include attendance tracking and student warnings for low attendance.
• Each instructor logs into the system with credentials.
• **Tasks:**

• Design a detailed ER Diagram.


• Build a normalized schema to 3NF.

3. Hospital Management System with Billing and History


• **Scenario:**

Design a robust Hospital Management System for a general hospital.

• **Requirements:**

• Patients, Doctors, Appointments, and Medical Records as before.


• Add support for:
- Room Assignments: Patients can be admitted and assigned rooms (with room
type and charges).
• - Billing System: Each bill includes consultation, lab tests, medicines, and room
charges.
• - Discharge Summary: With diagnosis, procedures, follow-ups.
• - Staff roles: Admin, Nurse, Receptionist, Doctor.

• **Tasks:**

• Draw a comprehensive ER Diagram.


• Convert it to a 3NF relational schema.
• Define relationships among staff, patients, and departments.
• SQL queries:
- Generate a bill for a patient.
- List doctors with the most number of admitted patients.

4. Online Shopping & Inventory Management System


• **Scenario:**

Build a full-featured E-Commerce Platform database.

• **Requirements:**

• Customers can place multiple orders.


• Each order has order date, status, shipping details, and payment method.
• Products belong to categories and are supplied by vendors.
• Track inventory with stock levels and re-order thresholds.
• Add a product rating/review system.
• Support multiple payment modes and order cancellation/refund logic.
• Admin users can manage products, categories, and vendors.

• **Tasks:**

• Create an ER diagram with complex relationships (many-to-many with attributes).


• Normalize to 3NF.
• Include integrity constraints (e.g., quantity >= 0).

Common questions

Powered by AI

Designing an extended ER diagram involves challenges like incorporating weak entities, managing multi-valued attributes, and implementing role-based relationships. Weak entities, such as a 'Reservation', depend on a 'Book' entity for their primary key and need a well-defined relationship and participation constraints. Multi-valued attributes can be resolved by creating separate entities with relationships back to the parent, such as representing 'Authors' for a 'Book'. Role-based relationships require entities like 'Users', with a role attribute and separate relationships defined based on roles like 'Admin', 'Librarian', and 'Member', each linking to tasks they manage. These complexities necessitate clear foreign keys and proper normalization to 3NF to maintain consistency.

In a Library Management System, the database must support the concept of multiple authors and editions for books. The ER diagram should include entities for 'Books', 'Authors', and 'Editions'. A many-to-many relationship should be established between the 'Books' and 'Authors' entities to handle the multiple authors scenario, while a one-to-many relationship connects 'Books' to 'Editions' to handle various editions. The relational schema should normalize these entities to reach 3NF, ensuring 'BookID' acts as the primary key in the 'Books' table, and composite keys consisting of 'BookID' and 'EditionID' uniquely identifying records in the 'Editions' table. Foreign keys in the 'Editions' entity should reference 'Books', while the association table for authors links 'Books' and 'Authors' together using their primary keys.

When designing a school management system that handles weighted grading, incorporate entities for 'Students', 'Courses', 'Exams', and 'Assignments'. The 'CourseGrades' entity, with foreign keys linking back to 'Students' and 'Courses', should store grades for each exam and assignment along with their respective weightings. The grading system should implement business logic (e.g., stored procedures or triggers) to calculate final grades by applying the weights to each component. Ensuring data integrity involves consistent weighting percentages and seamless handling of grade entries and updates across exams and assignments.

A normalized schema for a Library Management System should include an 'Borrowings' entity that records the interaction between 'Members' and 'Books'. This entity should include attributes for 'BorrowDate', 'DueDate', and 'ReturnDate', allowing the calculation of the overdue duration if 'ReturnDate' falls after 'DueDate'. Overdue fines can be calculated based on this period and stored as another attribute within 'Borrowings' or managed through a separate 'Fines' entity linked with foreign keys to 'Borrowings'. Normalization ensures redundant data is minimized and borrowing records accurately reflect all necessary details for fine calculations.

An effective design for tracking student attendance within a university management system requires a 'Students' entity linked to a 'Courses' entity through an 'Enrollments' table. The 'Enrollments' table should include an 'Attendance' attribute that records attendance data for each enrolled course. To manage warnings for low attendance, a database trigger or stored procedure can be implemented to automatically check attendance levels and issue warnings to students and instructors when attendance falls below a certain threshold. These warnings can be stored in a 'Warnings' table, referencing the student and enrollment information via foreign keys.

Setting up access controls and permissions involves defining clear roles such as 'Admin', 'Doctor', 'Nurse', and 'Receptionist', each with distinct levels of data access. Critical factors include adhering to privacy regulations by ensuring sensitive information (e.g., patient records) is only accessible by authorized roles, such as doctors or nurses. This can be achieved using role-based access control mechanisms in the database management system to restrict read/write permissions accordingly. Regular auditing and logging mechanisms should be implemented to monitor access and modifications to data. Clear role definitions and duty segregation are crucial for maintaining integrity and ensuring compliance with health information standards.

Normalization to 3NF in an Online Shopping & Inventory Management System eliminates redundancy by ensuring no transitive dependencies exist across order and product data. This involves organizing data into entities like 'Orders', 'OrderItems', and 'Products'. Each 'OrderItem', which represents an instance of a product purchased, includes references to 'Orders' and 'Products' via foreign keys. By storing product details only in 'Products', and leveraging associative tables to manage their purchase associations, data duplication is minimized. Additionally, 3NF ensures that attributes in a table are only dependent on the primary key, securing both dataset integrity and update efficiency.

To optimize SQL queries for listing doctors with the most admitted patients, employ aggregate functions such as COUNT() along with GROUP BY on the 'Admissions' table, where patients are associated with 'Doctors'. Using an INNER JOIN, relating 'Admissions' to the 'Doctors' table by 'DoctorID', then ordering the resul...s of the query in descending order using ORDER BY COUNT(PatientID) DESC will identify the count of admissions per doctor. Adding an INDEX on 'DoctorID' can significantly improve query performance by reducing the time it takes to aggregate and sort data across potentially large tables.

Room assignments in a hospital management database should be handled by creating an entity 'Rooms' with attributes capturing 'RoomType' and 'Charges'. The 'Patients' entity connects to 'Rooms' through an associative entity, 'RoomAssignments', that contains foreign keys pointing to both 'Patients' and 'Rooms'. This association should also capture the dates of admission and discharge to track the duration of room usage. By normalizing these entities, the system ensures that each room type has consistent charge values, and the room allocation can change as a patient's requirements change without data integrity issues.

In an e-commerce platform, products can belong to multiple categories and be supplied by multiple vendors, creating complex relationship schemas. The ER diagram should include entities for 'Products', 'Categories', and 'Vendors'. A many-to-many relationship can be drawn between 'Products' and 'Categories' using an associative entity, which allows for records that define a product's association with multiple categories. Similarly, an association table between 'Products' and 'Vendors' will help manage the multiple suppliers scenario. This setup, when converted into a normalized schema, efficiently supports operations like category-based filtering and supplier management. Foreign keys link associations to the respective 'Products', 'Categories', and 'Vendors' entities.

You might also like