Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write me a sql code based on the requirement and output I posted, Thank You. Generate job alerts. The input is a job post
Please write me a sql code based on the requirement and output I posted, Thank You.
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;
Output: Checks if the job ID exists and checks if Job is still active. If not, print "Invalid Job Post ID Then find all Job seekers who meet the minimum degree requirement for that job post, the minimal experience for the job post, and the minimal skill required for the job post. For each job seeker found, print out the name of the job seeker and insert a row into the massage table with a newly generated message ID Account ID message time and input time, and body of the message is "A job post xxx is available and you are qualified to apply" where xx is the input job post ID
Test cases:
Regular case: JobID timestamp timestamp ::
Since JoblD exists, it checks whether the job post is still active. then proceeds to
find all applicants for the job who satisfy the requirements. Then print out Job seeker name and insert message into message table
Special case: JobID timestamp timestamp ::
Since JobID does not exist, system will print out "Invalid job ID
Special case: JobID timestamp timestamp :: job status not active
Since JobID exists but job status closed, system will print out "Job is not currently active"
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