0% found this document useful (0 votes)
63 views4 pages

SELECT INITCAP (Lastname - ',' - Firstname) AS "NAME" FROM Employees WHERE Job - Id 'AD - PRES' OR Job - Id 'IT - PROG'

This document provides instructions and questions for a database management systems laboratory exercise. Students are asked to use the provided Employees table to write PL/SQL code that applies single row functions to retrieve specific data based on the questions. The questions involve functions like INITCAP, LPAD, RPAD, LOWER, LENGTH, INSTR, CONCAT, TRIM, TRUNC, and ROUND to manipulate and extract data from the Employees table.

Uploaded by

PaulAbibCamano
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)
63 views4 pages

SELECT INITCAP (Lastname - ',' - Firstname) AS "NAME" FROM Employees WHERE Job - Id 'AD - PRES' OR Job - Id 'IT - PROG'

This document provides instructions and questions for a database management systems laboratory exercise. Students are asked to use the provided Employees table to write PL/SQL code that applies single row functions to retrieve specific data based on the questions. The questions involve functions like INITCAP, LPAD, RPAD, LOWER, LENGTH, INSTR, CONCAT, TRIM, TRUNC, and ROUND to manipulate and extract data from the Employees table.

Uploaded by

PaulAbibCamano
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/ 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 = 'AD_PRES' OR job_id = 'IT_PROG';


2.
SELECT firstname, salary,

LPAD(salary*1.1-100,8,'$') AS "BONUS"

FROM employees

WHERE department_id IN (90,60,80,20);

3.

SELECT lastname, salary,

RPAD(salary,4,'@')

FROM employees

WHERE salary BETWEEN 4000 AND 9000;

4.

SELECT
LOWER(lastname || ’with a salary of’ || salary)),
LENGTH(lastname) AS “LNAME”
FROM employees
WHERE manager_id IS NULL OR salary IS NULL;
5.

SELECT
INITCAP(lastname) || 'that Belongs To Department Id Number' || department_id
AS "NAME",
INSTR(lastname,'A')
FROM employees
WHERE lastname LIKE '%S' AND MOD(salary,2) = 0;

6.
SELECT CONCAT(lastname,firstname), job_id

FROM employees

WHERE job_id LIKE '%REP';

7.

SELECT TRIM('O' FROM lastname) AS "TRIM", lastname, department_id, manager_id


FROM employees
WHERE lastname LIKE '__U%';

8.

SELECT salary*0 AS "EXCESS SALARY" FROM employees;


9.

SELECT TRUNC(563.396,2), TRUNC(563.396,1), TRUNC(563.396,-2), TRUNC(563.396,-1)

FROM dual;

10.

SELECT ROUND(563.396,2), ROUND(563.396,1), ROUND(563.396,-2), ROUND(563.396,-1)

FROM dual;

You might also like