Question: Using MySQL. If I created a table like this : CREATE TABLE Employee ( ID INT(5), name VARCHAR(60), HireDate DATE, Mgr INT(5) NULL, seniority VARCHAR(10),

Using MySQL.

If I created a table like this :

CREATE TABLE Employee ( ID INT(5), name VARCHAR(60), HireDate DATE, Mgr INT(5) NULL, seniority VARCHAR(10), PRIMARY KEY (ID) );

And inserting the data below:

Using MySQL. If I created a table like this : CREATE TABLE

My question is that how to write a trigger to generate an accurate seniority after insert on the table. If the days of CurrentDate - HireDate 1825, then senior.

Employees Hiredate 11/8/84 11/8/94 11/8/04 11/1/08 MgrSeniority: if less than 1 year, newbie ID 10100 10200 10300 10400 10500 10600 10700 10800 Name Employee-1 Employee-2 Employee-3 Employee-4 Employee-5 Employee-6 Employee-7 Employee-8 Seniority: if less than 5 years, junior 10100Seniority: if more than 5 years, senior 10200 10200 10400 10400 10400 10200

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!