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

LAB 03 single row & multiple row functions

SQL queries

Uploaded by

fizzambn.9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

LAB 03 single row & multiple row functions

SQL queries

Uploaded by

fizzambn.9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

23SP-070-CS LAB 03 Fizza Mubeen (B)

1. Write down the result of the function calls in the first column to the second column

Function Call Result


SUBSTR(CONCAT(‘HIGH’, ‘SALARY’), 4, 6) HSALAR
CONCAT(SUBSTR(‘INFORMATION’, 3, 4), ‘TECH’) FORMTECH
INSTR(CONCAT(‘GET’, ‘ING’), ‘TIN’) 3
ROUND(69.476, 1) 69.5
TRUNC(’13-MAR-90’, ‘MONTH’) 1-MAR-90
TRUNC(’13-MAR-90’, ‘YEAR’) 1-JAN-90
MOD(90, LENGTH(‘SEVENTY’)) 6
MONTHS_BETWEEN(’14-AUG-96’, ’23-MAR-95’) 16.7096

2. To show the current date. Label the column Current Date

3. To display the employee number, name, salary, salary increase by 15% expressed as a whole number
(labeled as New Salary), the difference between old salary and new salary (labeled as Increment).
23SP-070-CS LAB 03 Fizza Mubeen (B)

4. To display the employee name and calculate the number of months between today and the date the
employee was hired (Labeled as Months_Worked). Order the results by the number of months employed
and round the number of months up to the closest whole number.

5. Write a query that produces the following for each employee:


<employee name> earns <salary> monthly
23SP-070-CS LAB 03 Fizza Mubeen (B)

6. To display the employee’s name (labeled name) with the first letter capitalized and all other letters
lowercase and the length of their name (labeled length), for all employees whose name starts with J, A or
M.

7. To list the name, hiredate, and day of the week (labeled DAY) on which job was started. Order the result
by day of week starting with Monday.
23SP-070-CS LAB 03 Fizza Mubeen (B)

8. To display the job-wise count of employees in each department as follows:-


DEPTNO JOB NUM_EMP

9. To display the department name, location name, number of employees and the average salary for all
employees in that department. Label the columns DNAME, LOC, NUMBER OF PEOPLE and SALARY,
respectively. Round the average salary to two decimal places.
23SP-070-CS LAB 03 Fizza Mubeen (B)

10. To display the employee name, department number and job title for all employees whose department
location is Dallas.

11. To display the difference between the highest and lowest salaries (Labeled as
DIFFERENCE)

12. To show the manager name, MANAGER, and the number of employees, NUM, working under him.

You might also like