LAB_3_dbms
LAB_3_dbms
2. For each employee, display the employee’s last name, and calculate the number of weeks
between today and the date the employee was hired. Label the column
WEEKS_WORKED . Order your results by the number of WEEKs employed. Round the
number of weeks up to the closest whole number.
3. Study the NULLIF Function and solve the following question:
Write a query to display: employee_id, salary, commission_pct, total_earnings, which is
calculated as:
total_earnings = salary + (salary×commission_pct)
If commission_pct is NULL, it should be treated as 0 to prevent calculation errors.
4. Display each employee’s last name, hire date, and salary review date, which is the first
Monday after six months of service. Label the column REVIEW. Format the dates to
appear similar to “Monday, the Thirty-First of July, 2000.
5. Create a query to display the first name and salary for all employees. Format the salary to
be 15 characters long, right-padded with &. Label the column SALARY.
6.
7. Write a query that produces the following for each employee:
<employee last name> earns <salary> monthly but wants <3 times salary>. Label the
column Dream Salaries.
8. Create a query that displays the employees’ last names and indicates the amounts of their
annual salaries with asterisks. Each asterisk signifies a thousand dollars. Sort the data in
descending order of salary. Label the column EMPLOYEES_AND_THEIR_SALARIES.
9. Solve first 2 questions of “Advanced String Functions / Regex / Clause” section of SQL
50 Badge on leetcode.