T3-TECHNICAL - RubickMid (Cruz, Hernaez, Sumagui)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

CCS0021 LABORATORY

TECHNICAL ASSESSMENT 3
Part A:

Write a series of scripts that would create a new user, grant at least four system and at least four object
privileges. Each script should have a comment statement what is statement is doing and its purpose.
Save the script as Tech9_fullname. Save this file as Tech3Document_fullname.

Write your answers below:

Part B:

Answer the following using SQL developer. Use the schema of HR to answer this. Copy and paste your
answer below each number. And also paste the result of your answers.

Save the sql script as TechSumm10_fullname

1. Create a sequence that starts with 1, an interval of 2 and the biggest number is 999999. Name the
sequence as Sequence1.

CREATE SEQUENCE Sequence1

START WITH 1

INCREMENT BY 2

MAXVALUE 999999;
2. Create a view that will show all the salaries and names of employees in the Administration
department.

create view addep

as select first_name , last_name , salary

from Administration_department

3. Create a synonym of the job_history table. Name the synonym as JHistory.

create synonym JHistory

for job_history;
4. Create an anonymous block that would output your complete name of the screen.

DECLARE
v_name VARCHAR(30);
BEGIN
DBMS_OUTPUT.put_line ('Mervin Kim E. Sumagui');
DBMS_OUTPUT.put_line ('Jose Mari E. Hernaez');
DBMS_OUTPUT.put_line ('Cruz, Gabriel John P.');
END;
5. Create an anonymous block to get the average of 5 numbers. Each number should come from the
input of the user.

declare num1 NUMBER;


num2 NUMBER;
num3 NUMBER;
num4 NUMBER;
num5 NUMBER;
c_avg NUMBER;
begin
num1 := &num1;
num2 := &num2;
num3 := &num3;
num4 := &num4;
num5 := &num5;
c_avg := (num1 + num2 + num3 + num4 + num5)/5;
DBMS_OUTPUT.put_line (c_avg);
end;

6. Create an anonymous block that will input the name of an employee, birthday, address and age. The
name of the employee, birthday and address should come from the input of the user, while the age
should be calculated based on his/her birthday.
declare ename VARCHAR2(50);
bdate DATE;
eaddress VARCHAR2(50);
eage NUMBER;
begin
ename := '&empname';
bdate := TO_DATE('&birthdate','DD-MON-YY');
eaddress := '&empaddress';
eage := &empage;
DBMS_OUTPUT.put_line (ename);
DBMS_OUTPUT.put_line (bdate);
DBMS_OUTPUT.put_line (eaddress);
DBMS_OUTPUT.put_line (eage);
end;
Part C:

Given the question below:

Save your scripts as Tech11_fullname

Write your answers below:

A. The value of v_weight at position 1 is 2 NUMBER (3).

B. The value of v_new_locn at position 1 is Western Europe.

C. The value of v_weight at position 2 is 601.

D. The value of v_message at position 2 is product 10012 is in stock.

E. The value of v_new_locn at position 2 is Western.

You might also like