Spread the word.

Share the link on social media.

Share
  • Facebook
Have an account? Sign In Now

Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

SIKSHAPATH

SIKSHAPATH Navigation

  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Home/ Questions/Q 2082
Next
In Process

SIKSHAPATH Latest Questions

Harshdalal15
  • 0
  • 0
Harshdalal15
Asked: October 31, 20212021-10-31T19:42:05+05:30 2021-10-31T19:42:05+05:30In: DBMS

update the salary of a specific employee by 10% if the salary exceeds themid range of the salary against this job

  • 0
  • 0

Write a program in PL/SQLto update the salary of a specific employee by 10% if the salary exceeds themid range of the salary against this job and update up to mid range if thesalary is less than the mid range of the salary, and display a suitable messagefor users.

  • 2 2 Answers
  • 336 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. Saurav kumar
      Saurav kumar
      2022-02-22T10:23:11+05:30Added an answer on February 22, 2022 at 10:23 am

      DECLARE

      emp_min_salary NUMBER(6,0);

      emp_max_salary NUMBER(6,0);

      emp_mid_salary NUMBER(6,2);

      tmp_salary EMPLOYEES.SALARY%TYPE;

      tmp_emp_id EMPLOYEES.EMPLOYEE_ID%TYPE := 167;

      tmp_emp_name EMPLOYEES.FIRST_NAME%TYPE;

      BEGIN

      SELECT  min_salary, max_salary

      INTO emp_min_salary, emp_max_salary

      FROM JOBS

      WHERE

      JOB_ID = (SELECT JOB_ID FROM EMPLOYEES WHERE EMPLOYEE_ID = tmp_emp_id);

      emp_mid_salary := (emp_min_salary + emp_max_salary) / 2;

      SELECT salary,first_name INTO tmp_salary,tmp_emp_name

      FROM employees

      WHERE employee_id = tmp_emp_id;

       IF tmp_salary < emp_mid_salary

      THEN UPDATE employees SET salary = emp_mid_salary

      WHERE employee_id = tmp_emp_id;

      ELSE UPDATE employees SET salary = salary + salary * 10 /100

      WHERE employee_id = tmp_emp_id;

      END IF;

      IF tmp_salary > emp_mid_salary

      THEN DBMS_OUTPUT.PUT_LINE(‘The employee ‘||tmp_emp_name||‘ ID ‘ || TO_CHAR(tmp_emp_id) || ‘ works in salary ‘ || TO_CHAR(tmp_salary) || ‘ which is higher than mid-range of salary ‘ || TO_CHAR(emp_mid_salary));

      ELSIF tmp_salary < emp_mid_salary THEN DBMS_OUTPUT.PUT_LINE(‘The employee ‘||tmp_emp_name||‘ ID ‘ || TO_CHAR(tmp_emp_id) || ‘ works in salary ‘ || TO_CHAR(tmp_salary) || ‘ which is lower than mid-range of salary ‘ || TO_CHAR(emp_mid_salary));

      ELSE DBMS_OUTPUT.PUT_LINE(‘The employee ‘||tmp_emp_name||‘ ID ‘ || TO_CHAR(tmp_emp_id) || ‘ works in salary ‘ || TO_CHAR(tmp_salary) || ‘ which is equal to the mid-range of salary ‘ || TO_CHAR(emp_mid_salary));

      END IF;

      END;

        • 0
      • Reply
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    2. Professor
      Professor
      2021-10-31T19:56:35+05:30Added an answer on October 31, 2021 at 7:56 pm

      CREATE AN ACCOUNT TO GET NOTIFICATIONS ABOUT

      NEW QUESTIONS AND ANSWERS.

       

       

      DOWNLOAD ATTACHMENT FOR ANSWER:

      Attachment

        • 0
      • Reply
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    store ads

    Stats

    • Questions 1k
    • Answers 1k
    • Posts 149
    • Best Answers 89
    • This Free AI Tool Translates Entire Books in Minute !
    • AI News: 🎬 Hollywood’s AI Studios, 🎓 OpenAI’s Latest Gift to Educators, 🚚 Class8 Bags $22M, 🧠 Google Gemini’s Memory Upgrade
    • AI NEWS: Legal Action Against OpenAI, $16M Paid, & Elon Musk’s Praise from Investor 🤖💰📑 | AI Boosts Cloud Seeding for Water Security 🌱💧
    • AI News: 🎬AI Video Tool Scam Exposed🤯, 🛰️ AI-Powered Drones to Ukraine 😱, Google’s $20M AI Push, Sam Altman Joins SF’s Leadership Team
    • AI News: 🤝 Biden Meets Xi on AI Talks, 💡 Xavier Niel’s Advice for Europe, ♻️ Hong Kong’s Smart Bin Revolution, 🚀 AI x Huawei

    Explore

    • Recent Questions
    • Questions For You
    • Answers With Time
    • Most Visited
    • New Questions
    • Recent Questions With Time

    Footer

    SIKSHAPATH

    Helpful Links

    • Contact
    • Disclaimer
    • Privacy Policy Notice
    • TERMS OF USE
    • FAQs
    • Refund/Cancellation Policy
    • Delivery Policy for Sikshapath

    Follow Us

    © 2021-24 Sikshapath. All Rights Reserved

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.