0% found this document useful (0 votes)
0 views

LAB_3_dbms

The document outlines a series of SQL lab exercises for a DBMS course, focusing on various queries related to employee data. Tasks include formatting and calculating employee salaries, handling NULL values, and displaying specific employee information with appropriate labels. The exercises aim to enhance understanding of SQL functions and data manipulation techniques.

Uploaded by

noor4601283
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

LAB_3_dbms

The document outlines a series of SQL lab exercises for a DBMS course, focusing on various queries related to employee data. Tasks include formatting and calculating employee salaries, handling NULL values, and displaying specific employee information with appropriate labels. The exercises aim to enhance understanding of SQL functions and data manipulation techniques.

Uploaded by

noor4601283
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Name: Dania Noor

Roll no: CT-23010


Course : DBMS
LAB 3 Exercises:
1. Write a query that displays the employee’s last names all in uppercase and the length of
the last names, for all employees whose name starts with S, A, or M. Give each column an
appropriate label. Sort the results by the employees’ last names.

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.

You might also like