Week010 SingleRow LabExer005

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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