|
如何 create triggers??? table 如下,
----------------------------------------------------------------------------
CREATE TABLE instructor (
instructor_id number(3),
instructor_name varchar2(15),
salary number(6,2),
commission number(6,2),
mentor_id number(3) ,
date_hired date,
CONSTRAINT pk_instructor PRIMARY KEY (instructor_id),
CONSTRAINT fk_mentor
FOREIGN KEY (mentor_id)
REFERENCES instructor(instructor_id)
);
-------------------------------------------------------------------------------
insert into instructor values (
700, 'WAYNE', 4500 , 300, NULL, '16-MAY-81');
insert into instructor values (
628, 'MONROE', 3000 , NULL, 700, '16-JUN-84');
insert into instructor values (
790, 'NEWMAN', 3100 , 300, 700, '16-DEC-82');
insert into instructor values (
795, 'BOGART', 3200 , NULL, 700, '16-DEC-83');
insert into instructor values (
515, 'SHELLEY', 3500 , 200, 700, '20-JAN-91');
insert into instructor values (
222, 'CAINE', 5500 , 350, NULL, '02-NOV-76');
insert into instructor values (
978, 'STEEL', 5000 , 250, 222, '16-JAN-80');
insert into instructor values (
560, 'LAUREL', 5200 , 200, 978, '16-DEC-83');
insert into instructor values (
835, 'SPARKS', 4000 , 200, 978, '16-DEC-84');
insert into instructor values (
243, 'TUCKER', 2000 , NULL, 835, '18-DEC-90');
insert into instructor values (
263, 'JOHNSON', 4000 , NULL, 835, '18-JUL-92');
insert into instructor values (
453, 'LODGE', 2500 , 100, 835, '14-SEP-88');
--------------------------------------------------------------------------------
INSTRUCTOR_ID INSTRUCTOR_NAME SALARY COMMISSION MENTOR_ID DATE_HIRE
------------- --------------- --------- ---------- --------- ---------
700 WAYNE 4500 300 16-MAY-81
628 MONROE 3000 700 16-JUN-84
790 NEWMAN 3100 300 700 16-DEC-82
795 BOGART 3200 700 16-DEC-83
515 SHELLEY 3500 200 700 20-JAN-91
222 CAINE 5500 350 02-NOV-76
978 STEEL 5000 250 222 16-JAN-80
560 LAUREL 5200 200 978 16-DEC-83
835 SPARKS 4000 200 978 16-DEC-84
243 TUCKER 2000 835 18-DEC-90
263 JOHNSON 4000 835 18-JUL-92
453 LODGE 2500 100 835 14-SEP-88
---------------------------------------------------------------------------------
only instrutors who have been with the company for over 21 years or who have a salary greater than 3500 can act as mentors.
有谁可以帮帮忙吗? |
|