Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please give me the right answer for this sql code. Thank You. Feature 7 : Generate job alerts. The input is a job post ID
Please give me the right answer for this sql code. Thank You.
Feature : Generate job alerts. The input is a job post ID and a timestamp. The procedure does the following:
it first checks whether there is a job post with the input ID and is still active. If there is no such a job post, print a message 'Invalid job post ID and stop.
it then finds all job seekers who satisfy ALL of the following conditions:
a the job seeker's highest degree meets the minimal degree requirement of the job post if you use for associate degree, for bachelor, for master's and for doctoral degree, then the highest degree minimal degree of the job post;
b the job seeker's number of years of work experience is greater or equal to the minimal experience of the job post;
c for each skill required by the job post, the job seeker has that skill and the skill level is greater or equal to required level.
for each job seeker found in step print out the name of the job seeker and insert a row into the message table with a newly generated message ID account ID as the job seeker's account ID message time as the input time, and body of the message is 'A job post X is available and you are qualified to apply' where X is the input job post ID
Hint: to check condition c in step you can use an explicit cursor to return job seeker who satisfies condition a and b and another explicit cursor to return the required skill ID and minimal level for the job post. A nested loop can then be used to check condition c using the following pseudo code:
c is the first cursor to check condition a and b c is the second cursor to get required skill IDs and minimal skill levels.
for r in c loop
flag:;
for r in c loop
use select count to check whether condition c is satisfied ie whether job seeker r has a skill that matches the skill returned in r and the skill level rs minimal level.
if the count is zero not satisfied set flag to and exit the loop
end for;
if flag then
do step
end if;
end for;
Step 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