Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write function named get_tax() that takes one argument: salaryof typedecimal . The function should return the tax for the given salary rounded to 2 decimal

Write function namedget_tax()that takes one argument:salaryof typedecimal. The function should return the tax for the given salary rounded to2 decimal places(as adecimaltype). The tax rate is 20%. In the function, define and use thetaxvariable with a value of0.2.

b.) Return all the columns as well as the computed tax number of each record from the salary table.


2. a.)Write function namedfemale_percent()that computes the percentage of female employees in a given department. The function should take one argument:dep_idof typeinteger. Return the value rounded to 2 decimal digits (the result should be of anumerictype).

b.) Return all the columns as well as the computed female percentage of each department from the department table.


3. a.)Write function namedget_training_funding(emp_idinteger)that computes the training funding for an employee. The training funding for employees hiredbefore 2014 is 2000.00; the funding for employees hiredin 2014 is 6000.00, andthe funding fornew employees is 1000.00. (Hint: use If.. else...statement)

b.) Return all the columns as well as computed training funding for each employee from the salary table.


4.Create functionnamedget_users_with_no_posts()that returnsSETOFuser_accountfor users who have no posts in theposttable. The function should takeno arguments.


5.Create new function named get_users_of_three_best_answers() thatreturns a tablewith thetop three userswith the best answers. The result should contain the following columns:

user_id int, user_name varchar, count_of_answers bigint

The final table returned by the function should be sorted by the number of best answers in descending order.

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

Intermediate Accounting

Authors: Donald E. Kieso, Jerry J. Weygandt, Terry D. Warfield, Nicola M. Young, Irene M. Wiecek, Bruce J. McConomy

11th Canadian edition Volume 2

1119048540, 978-1119048541

More Books

Students also viewed these Databases questions