CREATE TABLE employees (
last_name CHAR NOT NULL,
first_name CHAR NOT NULL,
email VARCHAR(20),
phone_number INT,
job_id VARCHAR,
salary FLOAT,
manager_id INT,
manager_name CHAR,
department_id VARCHAR
);
CREATE VIEW aryan AS
SELECT last_name, first_name, phone_number, salary
FROM employees;
INSERT INTO employees (last_name, first_name, email, phone_number, job_id, salary, manager_id, manager_name, department_id) VALUES
('Smith', 'John', 'john.smith@example.com', 1234567890, 'J001', 50000, NULL, NULL, 'D001'),
('Johnson', 'Mary', 'mary.johnson@example.com', 2345678901, 'J002', 60000, 1, 'John Smith', 'D001'),
('Williams', 'David', 'david.williams@example.com', 3456789012, 'J003', 70000, 1, 'John Smith', 'D002'),
('Brown', 'Linda', 'linda.brown@example.com', 4567890123, 'J004', 80000, 1, 'John Smith', 'D002'),
('Jones', 'Robert', 'robert.jones@example.com', 5678901234, 'J005', 90000, 1, 'John Smith', 'D003');
CREATE VIEW aryan AS
SELECT last_name, first_name, phone_number, salary, department_id
FROM employees;
CREATE TRIGGER employees_trigger1
AFTER INSERT ON employees
FOR EACH ROW
BEGIN
INSERT INTO employees (last_name, first_name, email, phone_number, job_id, salary, manager_id, manager_name, department_id) VALUES
('Garcia', 'Maria', 'maria.garcia@example.com', 6789012345, 'J006', 100000, 1, 'John Smith', 'D003'),
('Miller', 'James', 'james.miller@example.com', 7890123456, 'J007', 110000, 1, 'John Smith', 'D003'),
('Davis', 'Sarah', 'sarah.davis@example.com', 8901234567, 'J008', 120000, 1, 'John Smith', 'D004'),
('Rodriguez', 'Jose', 'jose.rodriguez@example.com', 9012345678, 'J009', 130000, 1, 'John Smith', 'D004'),
('Martinez', 'Maria', 'maria.martinez@example.com', 1234567890, 'J010', 140000, 1, 'John Smith', 'D004');
print 'recorded'
END;
CREATE TRIGGER employees_trigger2
AFTER UPDATE ON employees
FOR EACH ROW
BEGIN
INSERT INTO employees (last_name, first_name, email, phone_number, job_id, salary, manager_id, manager_name, department_id) VALUES
('Garcia', 'Maria', 'maria.garcia@example.com', 6789012345, 'J006', 100000, 1, 'John Smith', 'D003'),
('Miller', 'James', 'james.miller@example.com', 7890123456, 'J007', 110000, 1, 'John Smith', 'D003'),
('Davis', 'Sarah', 'sarah.davis@example.com', 8901234567, 'J008', 120000, 1, 'John Smith', 'D004'),
('Rodriguez', 'Jose', 'jose.rodriguez@example.com', 9012345678, 'J009', 130000, 1, 'John Smith', 'D004'),
('Martinez', 'Maria', 'maria.martinez@example.com', 1234567890, 'J010', 140000, 1, 'John Smith', 'D004');
print ' recorded'
END;
CREATE TRIGGER employees_trigger3
AFTER DELETE ON employees
FOR EACH ROW
BEGIN
INSERT INTO employees (last_name, first_name, email, phone_number, job_id, salary, manager_id, manager_name, department_id) VALUES
('Garcia', 'Maria', 'maria.garcia@example.com', 6789012345, 'J006', 100000, 1, 'John Smith', 'D003'),
('Miller', 'James', 'james.miller@example.com', 7890123456, 'J007', 110000, 1, 'John Smith', 'D003'),
('Davis', 'Sarah', 'sarah.davis@example.com', 8901234567, 'J008', 120000, 1, 'John Smith', 'D004'),
('Rodriguez', 'Jose', 'jose.rodriguez@example.com', 9012345678, 'J009', 130000, 1, 'John Smith', 'D004'),
('Martinez', 'Maria', 'maria.martinez@example.com', 1234567890, 'J010', 140000, 1, 'John Smith', 'D004');
print ' recorded'
END;
To embed this project on your website, copy the following code and paste it into your website's HTML: