Answered step by step
Verified Expert Solution
Link Copied!

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:
1) 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.
2) 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 1 for associate degree, 2 for bachelor, 3 for master's and 4 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.
3) for each job seeker found in step 2), 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 2, 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:
-- c1 is the first cursor to check condition a and b, c2 is the second cursor to get required skill IDs and minimal skill levels.
for r1 in c1 loop
flag:=1;
for r2 in c2 loop
-- use select count(*) to check whether condition c is satisfied (i.e., whether job seeker r1 has a skill that matches the skill returned in r2 and the skill level >= r2's minimal level.
if the count is zero (not satisfied), set flag to 0 and exit the loop
end for;
if flag =1 then
-- do step 3.
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 =1, timestamp = timestamp 2024-3-210:00:00*
Since JoblD =1 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 =444, timestamp = timestamp 2024-3-210:00:00*
Since JobID =444 does not exist, system will print out "Invalid job ID"
Special case: JobID =1, timestamp = timestamp 2024-3-210:00:00', 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

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

Step: 3

blur-text-image

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

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago