Answered step by step
Verified Expert Solution
Link Copied!

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.image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

Can someone please help

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago