Question: Execute the examples given in photo and write an explanation of the workarounds of these queries in your own words. Example 1: CREATE TABLE salaries

Execute the examples given in photo and write an explanation of the workarounds of these queries in your own words.Execute the examples given in photo and write an explanation of the

Example 1: CREATE TABLE salaries ( id INT PRIMARY KEY, valid_from DATE NOT NULL, amount DECIMAL (12 , 2 ) NOT NULL DEFAULT O ); INSERT INTO salaries (id, valid_from, amount) VALUES (1002, '2000-01-01',50000), (1056, '2000-01-01', 60000), (1076, '2000-01-01', 70000); CREATE TABLE salary_archives id INT PRIMARY KEY AUTO_INCREMENT, employee_id INT, valid_from DATE NOT NULL, amount DECIMAL (12 , 2) NOT NULL DEFAULT O, deleted_at TIMESTAMP DEFAULT NOW() DELIMITER $$ CREATE TRIGGER before_salaries_delete BEFORE DELETE ON salaries FOR EACH ROW BEGIN INSERT INTO salary_archives (employee_id, valid_from, amount) VALUES (OLD.id, OLD.valid_from, OLD.amount); END$$ DELIMITER; DELETE FROM salaries WHERE ID = 1002

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!