Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 = 1002Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started