0% found this document useful (0 votes)
8 views

Dbms Unit Test Notes Till Unit 4

The document provides an overview of Database Management Systems (DBMS), detailing their key features, characteristics, and advantages over traditional file systems. It covers essential concepts such as data abstraction, data independence, and various DBMS architectures, along with the roles and responsibilities of a Database Administrator (DBA). Additionally, it introduces the Entity Relationship (ER) Model, explaining its components and the relationships between entities.

Uploaded by

omkarkera2006
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Dbms Unit Test Notes Till Unit 4

The document provides an overview of Database Management Systems (DBMS), detailing their key features, characteristics, and advantages over traditional file systems. It covers essential concepts such as data abstraction, data independence, and various DBMS architectures, along with the roles and responsibilities of a Database Administrator (DBA). Additionally, it introduces the Entity Relationship (ER) Model, explaining its components and the relationships between entities.

Uploaded by

omkarkera2006
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Unit 1

➢ Introduction of DBMS (Database Management System)


A Database Management System (DBMS) is a software solution designed to
efficiently manage, organize, and retrieve data in a structured manner. It
serves as a critical component in modern computing, enabling organizations
to store, manipulate, and secure their data effectively. From small applications
to enterprise systems, DBMS plays a vital role in supporting data-driven
decision-making and operational efficiency.
Key Features of DBMS
1. Data Modeling: Tools to create and modify data models, defining the
structure and relationships within the database.
2. Data Storage and Retrieval: Efficient mechanisms for storing data and
executing queries to retrieve it quickly.
3. Concurrency Control: Ensures multiple users can access the database
simultaneously without conflicts.
4. Data Integrity and Security: Enforces rules to maintain accurate and
secure data, including access controls and encryption.
5. Backup and Recovery: Protects data with regular backups and enables
recovery in case of system failures.

➢ Characteristics of Database
Overview of the Database Approach
The database approach is a modern way of managing data that replaces
traditional file-based systems. Unlike file systems, where each application
manages its own data separately, a database system stores data in a central
repository, allowing multiple users to access and share it efficiently. This
ensures consistency, reduces redundancy, and improves data management.
Key Characteristics
1. Self-Describing Nature (Metadata Storage)
A database system stores metadata—information about the database
structure, data types, and constraints—in a DBMS catalog. This allows the
DBMS to manage different applications (e.g., banking, university databases)
without modifying the system itself. In contrast, traditional file systems embed
data definitions within programs, making them less flexible.
2. Data Abstraction and Independence
In traditional file systems, changes to data structure require modifying all
dependent programs. In a DBMS, data structure is stored separately, ensuring
program-data independence. Users interact with a logical view of the data,
without worrying about storage details, thanks to data abstraction.
3. Multiple Views of Data
Different users require different views of the database:
• A student may see only their records.
• A professor may access course grades.
• An admin may manage all student data.
A DBMS allows customized views without affecting the actual database
structure.
4. Multi-User Access & Transaction Control
A multi-user DBMS allows multiple users to access and modify data
simultaneously while ensuring ACID properties:
• Atomicity – A transaction is either fully completed or not executed at all.
• Consistency – The database remains in a valid state before and after
transactions.
• Isolation – Transactions do not interfere with each other.
• Durability – Committed changes are permanently saved.
For example, when booking an airline seat, the DBMS ensures that only one
user secures a specific seat, preventing double booking.

➢ File System Vs Database


Basics File System DBMS

The file system is a way of


arranging the files in a DBMS is software for
storage medium within a managing the database.
Structure computer.

Data Redundant data can be In DBMS there is no


Redundancy present in a file system. redundant data.

It doesn’t provide Inbuilt It provides in house tools for


Backup and mechanism for backup and backup and recovery of data
Recovery recovery of data if it is lost. even if it is lost.

There is no efficient query


Efficient query processing is
Query processing in the file
there in DBMS.
processing system.

There is less data There is more data


consistency in the file consistency because of the
Consistency system. process of normalization .

It has more complexity in


It is less complex as
handling as compared to the
compared to DBMS.
Complexity file system.
➢ Data Abstraction and Data Independence

Data Abstraction in DBMS


Data abstraction is a fundamental concept in Database Management Systems
(DBMS) that helps in managing and organizing data efficiently. It refers to the
process of hiding unnecessary details from users while providing only the
relevant information.
For example, when you shop for clothes, you focus on aspects like color, size,
and brand, but you don't need to know where the fabric was sourced or how
the clothes were manufactured. Similarly, in a DBMS, users interact with data
without worrying about how it is stored, structured, or maintained internally.
Levels of Data Abstraction
A DBMS organizes data using three levels of abstraction:
1. Physical Level (Lowest Level)
• Defines how data is actually stored in memory (e.g., data structures, file
organization, indexing, storage format).
• Users do not interact with this level; it is managed by the DBMS and
database administrators.
• Example: Data stored in binary format on a disk.
2. Logical Level (Middle Level)
• Describes what data is stored and its relationships.
• It represents the structure of tables, attributes, constraints, and
relationships in a database.
• Example: A student table with attributes like Student_ID, Name, Age,
Course.
3. View Level (Highest Level)
• Provides a customized view of the database for different users.
• Users only see relevant data without accessing the complete database.
• Example: A student portal shows only the student’s marks, while an
admin panel has access to all student details.
Importance of Data Abstraction
Security – Protects sensitive data from unauthorized users.
Simplicity – Users interact with a simplified version of data.
Flexibility – The database structure can change without affecting users.
Efficiency – Hides complex internal processes while providing relevant data.

Data Independency
Data independence is a property of a database management system by which
we can change the database schema at one level of the database system
without changing the database schema at the next higher level. In this article,
we will learn in full detail about data independence and will also see its types.
If you read it completely, you will understand it easily.
Types of Data Independence in DBMS
Data independence refers to the ability to modify a database schema at one
level without affecting other levels. It ensures flexibility and minimizes the
impact of changes on users and applications. There are two types of data
independence:
1. Logical Data Independence
• Definition: The ability to change the logical schema (conceptual level)
without affecting the external schema (user view level).
• Purpose: Keeps the user’s view of data unchanged even if modifications
are made at the conceptual level.
• Example:
o Adding a new column (e.g., “Email” in a student table) or deleting
an attribute (e.g., “Middle Name”) without affecting user
applications.

2. Physical Data Independence


• Definition: The ability to change the physical storage (internal level)
without altering the logical schema (conceptual level).
• Purpose: Keeps the logical structure of the database intact even if
changes are made to data storage and indexing methods.
• Example:
o Moving the database files from C: drive to D: drive or changing
the storage format from text-based to binary without modifying
tables or relationships.
➢ DBMS Architecture: Overview and Types
A Database Management System (DBMS) architecture defines how databases
are structured, accessed, and maintained. It ensures efficient data
management, secure interactions, and scalability. The architecture determines
how users interact with the database and how data is processed.
There are three major types of DBMS architectures based on system
complexity, user interaction, and deployment requirements:
1. 1-Tier Architecture (Standalone)
2. 2-Tier Architecture (Client-Server)
3. 3-Tier Architecture (Application Layer Model)

1. 1-Tier Architecture
• Definition: In 1-Tier Architecture, the client, database, and application
exist on the same machine. Users can directly access and manage data
without an external server.
• Example: A Microsoft Excel spreadsheet, where users enter, modify, and
store data on their local system without a separate database server.

Advantages:
✔ Simple setup requiring minimal configuration.
✔ Cost-effective as no additional hardware or servers are needed.
✔ Easy deployment and maintenance, making it suitable for small-scale
applications.

Disadvantages:
✖ Limited scalability, making it unsuitable for multi-user applications.
✖ Lower security, as all data is stored locally.
✖ Lack of centralized data management, leading to inconsistency across
multiple users.
2. 2-Tier Architecture (Client-Server Model)
• Definition: 2-Tier Architecture introduces a database server that
manages and processes requests from multiple client applications.
Clients use ODBC/JDBC APIs to interact with the database.
• Example: A Library Management System, where users access a desktop
application to search for books, issue returns, and manage transactions,
while a centralized database server stores and processes the data.

Advantages:
✔ Faster data access due to direct communication between the client and
database.
✔ Improved security by restricting unauthorized access to the database.
✔ Scalable, allowing multiple clients to connect to the same database.
✔ Easy deployment, making it an efficient model for schools, offices, and small
businesses.

Disadvantages:
✖ Increased network load, as all clients directly interact with the database.
✖ Performance bottlenecks, especially when multiple users send simultaneous
requests.
✖ Limited scalability compared to 3-Tier Architecture, as handling a large
number of users can become difficult.
3. 3-Tier Architecture (Application Layer Model)
• Definition: 3-Tier Architecture introduces an intermediate application
server between the client and database server. Instead of directly
communicating with the database, clients send requests to the
application server, which processes the request and interacts with the
database.
• Example: E-commerce platforms (Amazon, Flipkart), where users browse
products, add them to a cart, and place orders. The application server
handles user requests, processes payments, and retrieves data from the
database.

Advantages:
✔ Enhanced scalability, as application servers can distribute user requests
efficiently.
✔ Better security, as users do not have direct access to the database.
✔ Improved data integrity, since the application layer ensures that only valid
data is stored in the database.
✔ Load balancing, as processing is distributed across multiple servers.

Disadvantages:
✖ More complex implementation, requiring multiple servers and additional
maintenance.
✖ Increased latency, as requests must pass through an additional layer before
reaching the database.
✖ Higher cost, as it requires dedicated application servers and networking
infrastructure.

➢ Roles and Responsibilities of DBA

A Database Administrator (DBA) is responsible for managing and maintaining


databases to ensure they run efficiently, securely, and reliably. The DBA plays a
crucial role in ensuring that data is accessible, stored properly, and protected
from unauthorized access or corruption.

1. Database Installation & Configuration


• Installs and configures Database Management Systems (DBMS) such as
Oracle, MySQL, SQL Server, or PostgreSQL.
• Sets up database environments for development, testing, and
production.
• Ensures databases are compatible with the system hardware and
operating system.
2. Database Design & Development
• Designs the database schema by creating tables, relationships, indexes,
and constraints.
• Ensures data normalization to remove redundancy and improve
efficiency.
• Defines database architecture and ensures it meets business needs.
3. Data Security & Access Control
• Manages user authentication and authorization to prevent
unauthorized access.
• Implements security policies such as encryption, firewalls, and role-
based access controls (RBAC).
• Ensures compliance with data privacy laws and regulations (e.g., GDPR,
HIPAA, PCI-DSS).
4. Backup & Recovery Management
• Creates and manages database backup policies to prevent data loss.
• Plans and tests disaster recovery procedures for quick restoration after a
failure.
• Ensures data redundancy and replication for high availability.
5. Performance Monitoring & Optimization
• Monitors database performance, server load, and query execution
times.
• Optimizes SQL queries, indexing strategies, and caching mechanisms to
improve speed.
• Tunes database parameters and memory usage for maximum efficiency.
6. Database Maintenance & Troubleshooting
• Detects and fixes database corruption, deadlocks, and crashes.
• Performs routine maintenance tasks like reorganizing indexes, updating
statistics, and clearing logs.
• Troubleshoots connectivity and performance issues.
7. Data Integrity & Consistency
• Ensures data remains accurate and consistent across different tables
and databases.
• Implements constraints, triggers, and stored procedures to enforce
business rules.
• Prevents data anomalies through referential integrity and ACID
compliance.
8. Database Migration & Upgrades
• Upgrades database versions without affecting application performance.
• Migrates data from old database systems to new ones (e.g., from
MySQL to PostgreSQL).
• Ensures data integrity during migration and minimizes downtime.
9. Capacity Planning & Storage Management
• Plans for future data growth and allocates sufficient storage resources.
• Monitors disk space usage and optimizes storage performance.
• Implements partitioning strategies for managing large datasets.
10. Compliance & Documentation
• Ensures database operations comply with company policies and industry
regulations.
• Maintains detailed documentation on database configurations, security
policies, and performance reports.
• Provides training and support to developers and IT teams on database
best practices.
Unit 2
➢ Introduction of ER Model

The Entity Relationship Model is a model for identifying entities (like student,
car or company) to be represented in the database and representation of how
those entities are related. The ER data model specifies enterprise schema that
represents the overall logical structure of a database graphically.
Symbols Used in ER Model
ER Model is used to model the logical view of the system from a data
perspective which consists of these symbols:
• Rectangles: Rectangles represent Entities in the ER Model.
• Ellipses: Ellipses represent Attributes in the ER Model.
• Diamond: Diamonds represent Relationships among Entities.
• Lines: Lines represent attributes to entities and entity sets with other
relationship types.
• Double Ellipse: Double Ellipses represent Multi-Valued Attributes.
• Double Rectangle: Double Rectangle represents a Weak Entity.
Components of ER Diagram
ER Model consists of Entities, Attributes, and Relationships among Entities in a
Database System.

What is Entity Set?


An Entity is an object of Entity Type and a set of all entities is called an entity
set. For Example, E1 is an entity having Entity Type Student and the set of all
students is called Entity Set. In ER diagram, Entity Type is represented as:
Types of Entity
There are two types of entity:
1. Strong Entity
A Strong Entity is a type of entity that has a key Attribute. Strong Entity does
not depend on other Entity in the Schema. It has a primary key, that helps in
identifying it uniquely, and it is represented by a rectangle. These are called
Strong Entity Types.
2. Weak Entity
An Entity type has a key attribute that uniquely identifies each entity in the
entity set. But some entity type exists for which key attributes can’t be defined.
These are called Weak Entity types .
For Example, A company may store the information of dependents (Parents,
Children, Spouse) of an Employee. But the dependents can’t exist without the
employee. So Dependent will be a Weak Entity Type and Employee will be
Identifying Entity type for Dependent, which means it is Strong Entity Type .

Types of Attributes
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the
key attribute. For example, Roll_No will be unique for each student. In ER
diagram, the key attribute is represented by an oval with underlying lines.
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute.
For example, the Address attribute of the student Entity type consists of Street,
City, State, and Country. In ER diagram, the composite attribute is represented
by an oval comprising of ovals.

3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram, a
multivalued attribute is represented by a double oval.

4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is
known as a derived attribute. e.g.; Age (can be derived from DOB). In ER
diagram, the derived attribute is represented by a dashed oval.
➢ Cardinality and Participation in DBMS
In a Database Management System (DBMS), Cardinality and Participation
define the relationships between entities in an Entity-Relationship (ER) Model.
These concepts help in designing how data is structured and connected within
a database.

1. Cardinality
Cardinality refers to the number of instances of an entity that can be
associated with another entity in a relationship. It specifies how many times an
entity in one table can be related to entities in another table.
Types of Cardinality:
1. One-to-One (1:1)
o Each entity in Entity A is related to only one entity in Entity B, and
vice versa.
o Example: A country has one capital city, and each capital city
belongs to only one country.
o Representation:
2. One-to-Many (1:M)
o An entity in Entity A can be related to multiple entities in Entity B,
but each entity in Entity B is related to only one entity in Entity A.
o Example: A teacher can teach multiple students, but each student
is taught by only one teacher.
o Representation:

3. Many-to-Many (M:N)
o Multiple entities in Entity A can be related to multiple entities in
Entity B.
o Example: A student can enroll in multiple courses, and a course
can have multiple students.
o Representation:
2. Participation
Participation defines whether all instances of an entity must be involved in a
relationship or not. It determines if the relationship is mandatory or optional.
Types of Participation:
1. Total Participation
o Every entity in the set must be involved in the relationship.
o Example: Every employee in a company must be assigned to a
department.
o Representation: A double line between entity and relationship.
2. Partial Participation
o Some entities may not be involved in the relationship.
o Example: Not every student in a school is enrolled in a sports
team.
o Representation: A single line between entity and relationship.
➢ Extended Entity-Relationship (EER) Model: Generalization,
Specialization, and Aggregation
The Extended Entity-Relationship (EER) model is an enhancement of the
traditional Entity-Relationship (ER) model. It includes new concepts like
Generalization, Specialization, and Aggregation, which help in designing
complex database schemas.

1. Generalization
Generalization is the process of combining multiple lower-level entities into a
higher-level entity. It is a bottom-up approach, where common attributes
from different entities are grouped into a single superclass.
Example:
• Car and Bike are specific entities.
• Both share common attributes like engine number, company name, and
model.
• They can be generalized into a Vehicle entity.
2. Specialization
Specialization is the opposite of generalization. It is a top-down approach,
where a higher-level entity is divided into multiple lower-level entities based
on specific attributes.
Example:
• The Employee entity can be specialized into two sub-entities:
o Manager (having additional attributes like department managed).
o Technician (having additional attributes like skill set).
Diagram Representation:

3. Aggregation
Aggregation is the process of treating a relationship as an entity itself. It
allows relationships to participate in other relationships.
Example:
• A Professor guides Students in a Research Project.
• Instead of creating two separate relationships, the "Guides" relationship
can be treated as an entity, which then forms another relationship with
Funding.
Diagram Representation:
Unit 3
1. Overview of SQL
Structured Query Language (SQL) is a standardized, declarative language
designed for managing and manipulating relational databases. It allows users to
create, modify, query, and control access to data. SQL’s power lies in its ability
to work at a high level—specifying what data you need rather than how to
retrieve it. Key areas include:

Data Definition: Creating and altering database schemas.

Data Manipulation: Inserting, updating, deleting, and querying data.

Data Control: Managing permissions and security.

Transactions: Ensuring data consistency through ACID-compliant


operations.

SQL has evolved over decades and, while standards (like SQL-92, SQL:1999,
SQL:2016) exist, many implementations extend the core language to include
additional features.

2. Data Definition Commands (DDL) and Integrity


Constraints
Data Definition Commands (DDL)
DDL commands define and modify the structure of database objects. Common
DDL statements include:

CREATE:

Example:

CREATE TABLE Employees (


EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Department VARCHAR(50)
);

Unit 3 1
ALTER: Modify an existing object (e.g., add or change a column).

Example:

ALTER TABLE Employees ADD Email VARCHAR(100);

DROP: Remove an object (e.g., table, view).

Example:

DROP TABLE Employees;

TRUNCATE: Delete all data in a table quickly without logging individual row
deletions.

Integrity Constraints
These rules ensure data accuracy and consistency:

Key Constraints:

Primary Key: Uniquely identifies each record in a table.

Unique Key: Ensures all values in a column are unique.

Domain Constraints:

Define the valid range, type, or format for a column’s data (e.g.,
INTEGER, VARCHAR(50)).

Referential Integrity:

Enforced using foreign keys, it ensures that a value in one table (child)
must match a primary key in another (parent).

Example:

CREATE TABLE Orders (


OrderID INT PRIMARY KEY,
CustomerID INT,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerI
D)
);

Check Constraints:

Unit 3 2
Define a condition that must be true for each row in a table.

Example:

CREATE TABLE Products (


ProductID INT PRIMARY KEY,
Price DECIMAL(10,2),
CHECK (Price > 0)
);

3. Data Manipulation Commands (DML)


DML commands are used for managing data within schema objects:

SELECT: Retrieve data from one or more tables.

Example:

SELECT FirstName, LastName FROM Employees WHERE Departme


nt = 'Sales';

INSERT: Add new records.

Example:

INSERT INTO Employees (FirstName, LastName, Department)


VALUES ('John', 'Doe', 'HR');

UPDATE: Modify existing records.

Example:

UPDATE Employees
SET Department = 'Marketing'
WHERE EmployeeID = 101;

DELETE: Remove records.

Example:

Unit 3 3
DELETE FROM Employees
WHERE EmployeeID = 101;

4. Data Control Commands (DCL)


DCL commands control access to data and database objects:

GRANT: Gives specific privileges (e.g., SELECT, INSERT) to users or roles.

Example:

GRANT SELECT, INSERT ON Employees TO HR_Manager;

REVOKE: Removes granted privileges.

Example:

REVOKE INSERT ON Employees FROM HR_Manager;

5. Set and String Operations


Set Operations
SQL supports operations that treat query results as sets:

UNION: Combines results from two queries and removes duplicates.

UNION ALL: Combines results and retains duplicates.

INTERSECT: Returns common records between two queries.

EXCEPT (or MINUS): Returns records from one query that are not in the
other.

String Operations
SQL includes functions for manipulating text:

Concatenation:

Use || (standard) or + (SQL Server) or CONCAT() in MySQL.

Example:

Unit 3 4
SELECT FirstName || ' ' || LastName AS FullName FROM Employee
s;

Substring Extraction:

Example:

SELECT SUBSTRING(FirstName, 1, 3) FROM Employees;

Case Conversion:

Example:

SELECT UPPER(LastName), LOWER(FirstName) FROM Employees;

6. Aggregate Functions, GROUP BY, and HAVING


Aggregate Functions
These functions compute a single value from a set of values:

SUM(), AVG(), COUNT(), MIN(), MAX()

Example:

SELECT AVG(Salary) FROM Employees;

GROUP BY
Groups rows that share a common attribute so that aggregate functions can be
applied to each group:

Example:

SELECT Department, COUNT(*) AS NumEmployees


FROM Employees
GROUP BY Department;

HAVING

Unit 3 5
Filters groups created by GROUP BY based on aggregate conditions:

Example:

SELECT Department, AVG(Salary) AS AvgSalary


FROM Employees
GROUP BY Department
HAVING AVG(Salary) > 50000;

7. Views in SQL
A view is a virtual table defined by a SQL query. It simplifies complex queries
and can provide a layer of security by exposing only specific data.

Creating a View:

Example:

CREATE VIEW SalesSummary AS


SELECT Department, SUM(Sales) AS TotalSales
FROM SalesData
GROUP BY Department;

Using a View:

Example:

SELECT * FROM SalesSummary;

8. Joins in SQL
Joins combine rows from two or more tables based on a related column:

INNER JOIN: Returns rows with matching values in both tables.

Example:

SELECT A.FirstName, B.OrderDate


FROM Customers A
INNER JOIN Orders B ON A.CustomerID = B.CustomerID;

Unit 3 6
LEFT (OUTER) JOIN: Returns all rows from the left table and matched rows
from the right table; unmatched right table rows yield NULLs.

RIGHT (OUTER) JOIN: Returns all rows from the right table and matched
rows from the left.

FULL (OUTER) JOIN: Returns rows when there is a match in either left or
right table.

CROSS JOIN: Returns the Cartesian product of both tables.

Self JOIN: A table is joined with itself to compare rows within the same
table.

9. Nested and Complex Queries


Nested Queries (Subqueries)
A subquery is a query embedded within another SQL query. They can be used
in SELECT, FROM, WHERE, or HAVING clauses:

Example (Simple Subquery):

SELECT FirstName, LastName


FROM Employees
WHERE DepartmentID = (SELECT DepartmentID FROM Departments W
HERE DepartmentName = 'Sales');

Correlated Subqueries:
Subqueries that refer to columns from the outer query.

Example:

SELECT e1.EmployeeID, e1.Salary


FROM Employees e1
WHERE e1.Salary > (SELECT AVG(e2.Salary) FROM Employees e2
WHERE e2.DepartmentID = e1.DepartmentID);

Derived Tables and Common Table Expressions (CTEs)


Derived Tables: Subqueries in the FROM clause treated as temporary
tables.

Unit 3 7
CTEs: Named temporary result sets defined with a WITH clause.

Example:

WITH DeptAvg AS (
SELECT DepartmentID, AVG(Salary) AS AvgSalary
FROM Employees
GROUP BY DepartmentID
)
SELECT e.FirstName, e.LastName, e.Salary, d.AvgSalary
FROM Employees e
JOIN DeptAvg d ON e.DepartmentID = d.DepartmentID
WHERE e.Salary > d.AvgSalary;

10. Triggers in SQL


Triggers are special procedures that automatically execute (or “fire”) in
response to certain events on a table or view:

Types of Triggers:

BEFORE Triggers: Execute before an insert, update, or delete operation.

AFTER Triggers: Execute after the operation has occurred.

INSTEAD OF Triggers: Often used on views to perform the action


instead of the trigger event.

Purpose:

Enforce complex business rules.

Maintain audit trails.

Automatically update related data.

Example (AFTER INSERT Trigger):

CREATE TRIGGER trg_AuditEmployee


AFTER INSERT ON Employees
FOR EACH ROW
BEGIN
INSERT INTO EmployeeAudit (EmployeeID, Action, ActionDate)

Unit 3 8
VALUES (NEW.EmployeeID, 'INSERT', NOW());
END;

Unit 3 9

You might also like