Advanced Database · Unit 5 · 8 hrs
Advanced Database Models, Systems, and Applications
Exam-focused notes for Advanced Database Models, Systems, and Applications (Advanced Database, CSC475): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.
Advanced Database Models, Systems, and Applications in short
This unit surveys database models built for specialized needs that a plain relational schema does not address well: databases that react to events on their own, databases that remember the past, databases of geometric and multimedia data, databases that can infer new facts, and the retrieval techniques behind web search.
What this unit covers
- Active Database Concepts and Triggers
- Temporal Database Concepts
- Spatial Database Concepts
- Multimedia Database Concepts
- Deductive Database Concepts
- Introduction to Information Retrieval and Web Search
Active Database Concepts and Triggers
2081 · 5 marks
What are triggers? What are the uses of triggers? [5]
Show solved answerHide answer
Triggers in Database Systems
Definition of Triggers
A trigger is a special type of stored procedure (or rule) in a database that is automatically executed (fired) in response to certain events occurring on a specified table or view. Triggers are a core component of active databases, where the database itself can react to changes without requiring explicit user commands.
A trigger is defined using the general form:
Event --> Condition --> Action (ECA Model)
- Event: An operation that fires the trigger (INSERT, UPDATE, DELETE)
- Condition: An optional check that must be satisfied
- Action: The procedure that executes when the trigger fires
Uses of Triggers
1. Enforcing Business Rules
Triggers automatically enforce complex business rules that cannot be handled by simple constraints. For example, ensuring that a bank account balance never goes below zero after a withdrawal.
2. Fraud Detection and Security Monitoring
In a banking system, triggers can monitor customer transactions and detect potential fraud activities, such as:
- A high-value transaction exceeding a threshold
- A series of unusual transactions from the same account at different locations within a short period
- The trigger fires automatically and can alert the system or block the transaction.
3. Maintaining Data Integrity
Triggers ensure referential integrity and consistency across related tables, especially in situations where foreign key constraints alone are insufficient.
4. Automatic Auditing and Logging
Triggers can automatically record changes (INSERT, UPDATE, DELETE) made to sensitive tables into an audit log table, keeping a history of all modifications for accountability.
5. Derived Data Maintenance
Triggers can automatically update derived or summary data. For example, when a new sale is recorded, a trigger can automatically update the total sales figure in a summary table.
6. Replication and Synchronization
Triggers can be used to keep multiple copies of data synchronized by propagating changes from one table to related tables automatically.
Summary Table
| Use | Description |
|---|---|
| Business Rules | Enforce complex constraints automatically |
| Fraud Detection | Monitor and react to suspicious transactions |
| Data Integrity | Maintain consistency across tables |
| Auditing | Log all changes for tracking |
| Derived Data | Auto-update computed/summary values |
| Synchronization | Keep related data consistent |
Triggers make the database active rather than passive, enabling it to respond intelligently to data changes without manual intervention.
2080 · 5 marks
What is the concept of active database? What are triggers? [5]
Spatial Database Concepts
2081 · 5 marks
Why do we need spatial databases? What are common types of analysis for spatial data? [5]
2079 · 5 marks
What is spatial database? Explain the concept of trigger with an example. [5]
Make Unit 5 stick
Practice CSC475 with flashcards & quizzes