Question

In: Computer Science

Create following table. CREATE TABLE Registration (Reg_ID number(5), Name Varchar2(20), Address Varchar2(20), create_date date, created_by varchar2(10)...

Create following table.

CREATE TABLE Registration

(Reg_ID number(5),

Name Varchar2(20),

Address Varchar2(20),

create_date date,

created_by varchar2(10)

);

Create an audit trial report on Employee table for all insert, update and delete operations on given table. You have to create audit table first with Current Date, Operation and User to record the information.

Solutions

Expert Solution

Answer :

To setup the audit table, we need to create a trigger for all of these operations in the main table. This is done by following.

Trigger for Inser operation.

create trigger employeeTriggerAuditRecord on Employee
after insert
as
begin
insert into EmployeeAudit
(CurrentDate, Operation, User) select i.created_date, "INSERTED", i.created_by from Employee e
inner join INSERTED i where e.REG_Id = i.REG_Id
end
go

Similarly for Delete operation.

create trigger employeeTriggerAuditRecord on Employee
after update
as
begin
insert into EmployeeAudit
(CurrentDate, Operation, User) select i.created_date, "UPDATED", i.created_by from Employee e
inner join INSERTED i where e.REG_Id = i.REG_Id
end
go

and Delete

create trigger employeeTriggerAuditRecord on Employee
after DELETE
as
begin
insert into EmployeeAudit
(CurrentDate, Operation, User) select i.created_date, "DELETE", i.created_by from Employee e
inner join DELETED i where e.REG_Id = i.REG_Id
end
go

NOTE : PLEASE GIVE ME UP VOTE .THANK YOU.


Related Solutions

Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth Create a table ‘ClassInfo’ table: ID Class Name Class Description Create a table ‘RegisteredClasses’ table: StudentID ClassID The RegisteredClasses table should have a foreign key relationship to StudentInfo and ClassInfo tables for the respective IDs. Also the IDs in StudentInfo and ClassInfo need to be primary keys. When you submit the file your email should also contain the following SQL Queries: Query to show...
Create a student class that stores name, registration number and percentage, grade. Add member functions -...
Create a student class that stores name, registration number and percentage, grade. Add member functions - Read( string n, int r, float p): Read function that accepts parameter - Display(): To display student’s information - CalculateGrade()
-- Creating table ProjDept: create table ProjDept ( ProjDeptID NUMBER(10) primary key, ProjDeptName varchar2(20), OfficeLocation varchar2(20),...
-- Creating table ProjDept: create table ProjDept ( ProjDeptID NUMBER(10) primary key, ProjDeptName varchar2(20), OfficeLocation varchar2(20), PhoneNumber varchar2(20) ); INSERT INTO ProjDept (ProjDeptID, ProjDeptName, OfficeLocation, PhoneNumber) VALUES (1001, 'Accounting','ITCC01-400','888-285-8100'); (2001, 'Human Resources','ITCC01-200','888-285-8100'); (3001, 'Marketing','ITCC02-300','888-285-8100'); (4001, 'Information Techn','ITCC02-100','888-285-8100'); (5001, 'Legal','ITCC01-100','888-285-8100'); -- Creating table Employee: create table Employee( EmployeeID NUMBER(10) primary key, FirstName varchar2(20), LastName varchar2(20), ProjDeptID NUMBER(10), PhoneNumber varchar2(20) ); INSERT INTO Employee (EmployeeID, FirstName, LastName, ProjDeptID, PhoneNumber, Email) VALUES (10, 'Mark','Columbus',1001, '888-285-8101', '[email protected]'); (29, 'Elvin','Wahl', 2001, '888-285-8201', '[email protected]'); (38, 'Taylor','Noel',...
Create a table called product containing a product number, company name, model number, product name. What...
Create a table called product containing a product number, company name, model number, product name. What is my primary key? Which datatypes should I use? Please submit a printout of the commands used for creating the above table and the results of your queries/commands. PLEASE USE JAVA & H2DATABASE
HTML 5 (Website Registration Form with Optional Survey) Create a website registration form to obtain a...
HTML 5 (Website Registration Form with Optional Survey) Create a website registration form to obtain a user’s first name, last name and e-mail address. In addition, include an optional survey question that asks the user’s year in college (e.g., Freshman). Place the optional survey question in a details element that the user can expand to see the question.
Please Use JavaScript and HTML 5) Number guesser (easier) Create a number guessing name, using an...
Please Use JavaScript and HTML 5) Number guesser (easier) Create a number guessing name, using an input and a button to gather a number. The number to be guessed should be a hard-coded whole number between 1 and 20. Tell the user if the number is too high, equal to, or too low than a number you have hard-coded in your application. Remove the text in the input when the user clicks the button.
Create a class called Student. Include the following instance variables: name, address, phone, gpa Create all...
Create a class called Student. Include the following instance variables: name, address, phone, gpa Create all of the methods required for a standard user defined class: constructors, accessors, mutators, toString, equals Create the client for testing the Student class Create another class called CourseSection Include instance variables for: course name, days and times course meets (String), description of course, student a, student b, student c (all of type Student) Create all of the methods required for a standard user defined...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is 2,...
python Create a new file name condition_quiz.py. Add a comment with your name and the date....
python Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is...
Create a table with name “S_YOURStudentID” with the following fields with required constraints. Screenshots are to...
Create a table with name “S_YOURStudentID” with the following fields with required constraints. Screenshots are to be attached.                                                                                               For example, if your botho student id is 1212121, your table name should be “S_1212121”.                                   Student id Student Name Age Gender City Course name Module Name Internal mark 1 Internal mark 2 Internal mark 3 Total internal mark Insert minimum 10 records/rows to the table. Input the data based on Question 5. Screenshots are to be attached.                                                                                                                              Create two users...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT