Answered step by step
Verified Expert Solution
Link Copied!

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 7: 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;

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago