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

Week010 SingleRow LabExer005

This document provides directions and questions for a laboratory exercise on using single row functions in PL/SQL. The directions ask the student to use an Employees table to write PL/SQL code that applies functions like INITCAP, LPAD, RPAD, LOWER, LENGTH, SUBSTR, TRIM, MOD, TRUNC and ROUND. The questions provide examples of queries using these functions and ask the student to write the PL/SQL code for each query in the space provided.

Uploaded by

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

Week010 SingleRow LabExer005

This document provides directions and questions for a laboratory exercise on using single row functions in PL/SQL. The directions ask the student to use an Employees table to write PL/SQL code that applies functions like INITCAP, LPAD, RPAD, LOWER, LENGTH, SUBSTR, TRIM, MOD, TRUNC and ROUND. The questions provide examples of queries using these functions and ask the student to write the PL/SQL code for each query in the space provided.

Uploaded by

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

Course Code Type Course Code Here

Database Management System


Description
1
College / Department:
LabExer No. 005
Online Education
Laboratory Exercise Page 1 of 1

Direction:
 Use the Employees table (copy and paste the code in SQL command line)
 Based on the given table: Employees table as shown below, write the PL/SQL that applies single row
function in order to get the printed output per number. Write your answer in a short bond paper.
 Copy and paste the PL/SQL code on the space provided after each questions.

1.

SELECT INITCAP(LASTNAME||’,’||FIRSTNAME) AS NAME FROM EMPLOYEES


WHERE JOB_ID LIKE ’%PR%’;
2.

SELECT FIRSTNAME, SALARY, LPAD(SALARY,8,'$') AS BONUS FROM EMPLOYEES;

3.

SELECT LASTNAME, SALARY, RPAD(SALARY,4,'@') FROM EMPLOYEES;


WHERE SALARY BETWEEN 4000 AND 9000;

4.

SELECT LOWER(LASTNAME||’with a salary of’||SALARY) as Record, LENGTH(LASTNAME) as Lname


FROM EMPLOYEES
WHERE MANAGER_ID IS NULL
OR SALARY IS NULL;
5.

select Lastname || ‘ Belongs to department ID’ || department_ID, instr(lastname,'a') from employees


6.

SELECT (LASTNAME||FIRSTNAME), JOB_ID FROM EMPLOYEES


WHERE SUBSTR (JOB_ID,4)=’REP’

7.

SELECT TRIM(‘K’ FROM LASTNAME)AS TRIM, LASTNAME, DEPARTMENT_ID, MANAGER_ID FROM


EMPLOYEES
WHERE DEPARTMENT_ID = 50 AND MANAGER_ID = 100;
8.

SELECT MOD(SALARY,10) AS “EXCESS SALARY”


FROM EMPLOYEES
WHERE SALARY < 5000;
9.

SELECT TRUNC(563.396,2), (563.396,1), (563.396,-2), (563.396,-1) FROM DUAL;

10.

SELECT ROUND(563.396,2), (563.396,1), (563.396,-2), (563.396,-1) FROM DUAL;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy