Вы находитесь на странице: 1из 47

DATABASE MGT.

SYSTEM 1(ORACLE)

Given the output below. Which of the following is the correct PL/SQL to be used

Select one:

a. SELECT WAREHOUSE, CLASS FROM PARTS WHERE CLASS IN (‘AP’,’SG’,’HW’);

b. SELECT WAREHOUSE, CLASS FROM PARTS;

c. SELECT DISTINCT WAREHOUSE FROM PARTS;

d. SELECT DICTINCT WAREHOUSE, CLASS FROM PARTS WHERE WAREHOUSE >=1;

Question 2

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

This is used to test for values in a specified set of values.

Ans: IN

It is a value that is unavailable, unassigned, unknown, or inapplicable.

Ans: NULL

True/False Character values are format sensitive and date values are case sensitive-sensitive.

Ans: False

A system used to concatenate one column to another column.

Ans: ||
Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column DESCRIPTION, ONHAND and
WAREHOUSE of all PARTS where ONHAND is greater than or equal to 21.

Ans: SELECT DESCRIPTION, ONHAND, WAREHOUSE FROM PARTS WHERE ONHAND >=21;

Given the output below. Which of the following is the correct PL/SQL to be used?

Ans: SELECT DESCRIPTION, PRICE *.5 +PRICE-100 FROM PARTS WHERE PRICE >10000;

Which of the following is not true about writing SQL statements?

Select one:

a. Keywords cannot be split across lines or abbreviated.

b. Indents should be used to make code more readable.

c. SQL statements are not case sensitive.

d. Clauses are usually placed on separate lines for readability and ease of editing.

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report that will merge the column DESCRIPTION and PRICE put a
literal character string of = “ with a price of ” in between the two columns. Limit the rows returned by
getting only the partnum that starts with letter ‘K’.

Ans: SELECT (DESCRIPTION|| ‘WITH A PRICE OF’ || PRICE) FROM PARTS WHERE PARTNUM LIKE ‘K%’;

This is used to test for values in a specified set of values.

Ans: IN

Given the output below. Which of the following is the correct PL/SQL to be used?

Select one:

a. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS
WHERE CLASS = ‘AP’ OR ONHAND BETWEEEN 8 AND 12

b. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ AND DESCRIPTION LIKE ‘__S%’;

c. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ OR ONHAND >=8;

d. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ OR DESCRIPTION LIKE ‘__S%’;

Given the output below. Which of the following is the correct PL/SQL to be used?

Select one:

a. SELECT (PARTNUM|| ‘belong to’||DESCRIPTION) FROM PARTS WHERE CLASS = ‘SG’;

b. SELECT (PARTNUM|| belong to||DESCRIPTION) FROM PARTS WHERE CLASS = ‘SG’;

c. SELECT (PARTNUM|| ‘belong to’||DESCRIPTION) FROM PARTS WHERE PARTNUM IN (‘BV06,’KV29’)

d. SELECT (PARTNUM|| ‘belong to’||DESCRIPTION) FROM PARTS WHERE CLASS = SG;

Feedback
This is use to create expression with number and date values.

Ans: Arithmetic expression

Given the output below. Which of the following is the correct PL/SQL to be used?

Select one:

a. SELECT DISTINCT WAREHOUSE, CLASS FROM PARTS;

b. SELECT WAREHOUSE, CLASS FROM PARTS;

c. SELECT WAREHOUSE, CLASS FROM PARTS WHERE CLASS IN (‘AP’,’SG’,’HW’);

d. SELECT DISTINCT WAREHOUSE, CLASS FROM PARTS WHERE WAREHOUSE >=1;

This is used to perform wildcard searches of valid search string values.

Ans: Like

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column DESCRIPTION, PARTNUM, CLASS and
PRICE of all parts where the description fourth letter starting from the first is equal to ‘D’.

SELECT DESCRIPTION, PARTNUM, CLASS, PRICES FROM PARTS WHERE DESCRIPTION LIKE ‘___D%’;

SELECT DESCRIPTION, PARTNUM, CLASS, PRICES FROM PARTS WHERE DESCRIPTION LIKE ‘%D___’;

SELECT DESCRIPTION, PARTNUM, CLASS, PRICES FROM PARTS WHERE DESCRIPTION LIKE ‘D%’;

SELECT DESCRIPTION, PARTNUM, CLASS, PRICES FROM PARTS WHERE DESCRIPTION LIKE ‘%D’;

This is use to Selects the columns in a table that are returned by a query. Selects a few or as many of the
columns as required.

Ans: Projection

Choose the letter of the correct answer based on table PARTS as shown below
Which of the following is the correct report listing the column PARTNO, DESCRIPTION and WAREHOUSE.
Get only that description that does not ends with ‘ER’. Note that you have to merge the said three
columns, rename the merge column as “Parts Record”. Below is the sample output for column.

Parts Record

AT94is the part number ofIRONwhich belong to warehouse3

Ans: SELECT (PARTNUM || ‘is the part number of’|| DESCRIPTION || ‘which belongs to’ || WAREHOUSE
FROM PARTS WHERE PARTNUM NOT LIKE ‘%ER’;

This is used to restrict the rows that are returned by a query.

Ans: Where

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column PARTNUM, DESCRIPTION and PRICE
of all PARTS where price is less than 500. Sort the PRICE in ascending order.

SELECT PARTNUN, DESCRIPTION, PRICE FROM PARTS WHERE PRICE < 500;

What Given the output below. Which of the following is the correct PL/SQL to be used?

Ans: SELECT DESCRIPTION, ONHAND,CLASS

FROM PARTS

WHERE CLASS = ‘HW’;


Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report that will display the DESCRIPTION, WAREHOUSE AND distinct
value for CLASS.

SELECT DESCRIPTION, WAREHOUSE, DISTINCT (CLASS) FROM PARTS;

SELECT DESCRIPTION, WAREHOUSE, CLASS FROM PARTS;

SELECT DISTINCT DESCRIPTION, WAREHOUSE, CLASS FROM PARTS;

SELECT DESCRIPTION, WAREHOUSE, DISTINCT ‘CLASS ‘ FROM PARTS;

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column DESCRIPTION, CLASS and PRICE of all
PARTS where class is not equal to AP.

SELECT DESCRIPTION, CLASS, PRICE FROM PARTS WHERE CLASS NOT LIKE ‘%AP%’;

SELECT DESCRIPTION, CLASS, PRICE FROM PARTS WHERE CLASS NOT LIKE ‘%AP’;

SELECT DESCRIPTION, CLASS, PRICE FROM PARTS WHERE CLASS != AP;

SELECT DESCRIPTION, CLASS, PRICE FROM PARTS WHERE CLASS <> AP;

Given the output below. Which of the following is the correct PL/SQL to be used?

Ans: SELECT * FROM PARTS;

Supposed that the user uses the ff SELECT statement: what will be the possible output.
SELECT GRADE AS STUDENT MARK FROM GRADE_REPORT;

Ans: Error because of the keyword AS.

It is a character, a number, or a date that is included in the SELECT statement.

Ans: Literal

Given the output below. Which of the following is the correct PL/SQL to be used?

Select one:

a. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ OR DESCRIPTION LIKE ‘%ER’;

b. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ OR ONHAND BETWEEN 8 AND 12;

c. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ AND DESCRIPTION LIKE ‘%ER’;

d. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS
WHERE CLASS = ‘AP’ AND ONHAND BETWEEN 8 AND 12;

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report that will list only the column DESCRIPTION, PARTNUM,
CLASS, and PRICE of all PART whose CLASS is equal to HW.

Ans: SELECT DESCRIPTION, PARTNUM, CLASS, PRICE FROM PARTS WHERE CLASS=’HW’;

True/False. Character strings and date values are enclosed with double quotation marks.

Ans:False

This is used to in conditions that compare one expression with another value or expression.

Ans: Comparison

Given the output below. Which of the following is the correct PL/SQL to be used?

Ans: SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column DESCRIPTION, ONHAND, CLASS and
PRICE of all price where the description ends with letter ‘N’.

SELECT DESCRIPTION, ONHAND, CLASSS FROM PARTS WHERE DESCRIPTION LIKE ‘%N’;
SELECT DESCRIPTION, ONHAND, CLASSS FROM PARTS WHERE DESCRIPTION LIKE ‘N%’;

SELECT DESCRIPTION, ONHAND, CLASSS FROM PARTS WHERE DESCRIPTION LIKE ‘%N%’;

SELECT DESCRIPTION, ONHAND, CLASSS FROM PARTS WHERE DESCRIPTION NOT LIKE ‘%N’;

This is used to brings together data that is stored in different tables by specifying the link between them.

Ans: Joins

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column PARTNUM, CLASS and ONHAND of all
parts where partnum is equal to AT94, DR93 and KV29. (Note 1 query only and do not use logical
condition)

Ans: SELECT PARTNUM, CLASS, ONHAND FROM PARTS WHERE PARTNUM IN (‘AT94’,’DR93’,’KV29’);

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report that will display the distinct value for CLASS and
WAREHOUSE limit the rows by getting only the parts under WAREHOUSE 3?

SELECT CLASS, WAREHOUSE FROM PARTS WHERE WAREHOUSE = 3;

SELECT CLASS, WAREHOUSE FROM PARTS WHERE WAREHOUSE = ‘3’;

SELECT CLASS, WAREHOUSE FROM PARTS WHERE WAREHOUSE = =3;

SELECT CLASS, WAREHOUSE =3 FROM PARTS WHERE WAREHOUSE = 3;

Given the output below. Which of the following is the correct PL/SQL to be used?

Select one:

a. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE DESCRIPTION LIKE ‘R%’;

b. SELECT DESCRIPTION, ONHAND, CLASS


FROM PARTS

WHERE DESCRIPTION LIKE ‘%R’;

c. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS IN (‘HW’,’AP’);

d. SELECT DESCRIPTION, ONHAND, CLASS

FROM PARTS

WHERE CLASS = ‘AP’ OR CLASS = ‘HW’;

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report listing only the column DESCRIPTION, WAREHOUSE, CLASS
and PRICE of all parts where the description contains keyword ‘SHE’.

SELECT DESCRIPTION, WAREHOUSE, CLASS, PRICE FROM PARTS WHERE DESCRIPTION LIKE ‘%SHE%’;

SELECT DESCRIPTION, WAREHOUSE, CLASS, PRICE FROM PARTS WHERE DESCRIPTION LIKE ‘SHE%’;

SELECT DESCRIPTION, WAREHOUSE, CLASS, PRICE FROM PARTS WHERE DESCRIPTION LIKE ‘%SHE’;

SELECT DESCRIPTION, WAREHOUSE, CLASS, PRICE FROM PARTS WHERE DESCRIPTION LIKE ‘SHE’;

True/False. The != not equal to symbol is also equal to this symbol<>.

Ans: True

This is used to display rows based on a range of values.

Ans: Between

True/False. A null value means that the value is unavailable, unassigned, unknown, or inapplicable.

Ans: True

Choose the letter of the correct answer based on table PARTS as shown below
Which of the following is the correct report listing only the column CLASS, DESCRIPTION and PRICE of all
PARTS where price range is between 200 to 500. Sort the Price in descending order.

SELECT CLASS, DESCRIPTION, PRICE FROM PARTS WHERE PRICE BETWEEN 200 AND 500;

This is used to in conditions that compare one expression with another value or expression.

Ans: Comparison

Choose the letter of the correct answer based on table PARTS as shown below

Which of the following is the correct report showing all rows and columns sort the description in
ascending order.

SELECT * FROM PARTS ORDER BY DESCRIPTION DESC;

SELECT * FROM PARTS ORDER BY DESCRIPTION;

SELECT * FROM PARTS ORDER BY DESCRIPTION ASC;

SELECT * FROM PARTS ORDER BY DESC;

This is used to perform wildcard searches of valid search string values.

Ans: Like

This is used to selects the rows in a table that are returned by a query. Various criteria can be used to
restrict the rows that are retrieved.

Ans: Selection

True/False. This symbol % denotes zero or many characters.

Ans: True

Choose the letter of the correct answer based on table PARTS as shown below
Which of the following is the correct report listing the DESCRIPTION and Price (Note that in column
PRICE add ADDITIONAL 10000). Get only the prices with no digit that is equal to ‘5’. Note that you have
to concatenate the said column and rename the merge column as “New Price Lists”. Sort the data in
DESC order by Price.

SELECT DESCRIPTION, PRICE + 10000 AS “NEW PRICE LISTS” FROM PARTS ORDER BY PRICE DESC;

This is used to display rows based on a range of values.

Ans: Between

This is used to restrict the rows that are returned by a query.

Ans: Where

This character is used to override the default precedence or to clarify the statement.

Ans: ( )

-----------

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

What query should be used in order todisplay the firstname and length of firstname rename the column
length of firstname as Number of Character of all employees whose salary is between 4400 and 8300

Select one:

a. SELECT FIRSTNAME, LENGTH(FIRSTNAME) AS "NUMBER OF CHARACTER"

FROM EMPLOYEES

WHERE SALARY BETWEEN 8300 AND 4400;

b. SELECT FIRSTNAME, LENGTH(FIRSTNAME) AS NUMBER OF CHARACTER


FROM EMPLOYEES

WHERE SALARY BETWEEN 4400 AND 8300;

c. SELECT FIRSTNAME, INSTR(FIRSTNAME) AS "NUMBER OF CHARACTER"

FROM EMPLOYEES

WHERE SALARY BETWEEN 4400 AND 8300;

d. SELECT FIRSTNAME, LENGTH(FIRSTNAME) AS "NUMBER OF CHARACTER"

FROM EMPLOYEES

WHERE SALARY BETWEEN 4400 AND 8300;

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

What query should be used in order to display the employees lastname concatenated to salary. Format
the salary column to 6 character long left padded with ‘*’ as special character for all employees whose
manager_id is null or salary between 4000 and 6000 Rename the column as employees and their
Salaries

Select one:

a. SELECT (FIRSTNAME||RPAD(SALARY,6,'*')) AS "EMPLOYEES AND THEIR SALARIES"

FROM EMPLOYEES

WHERE MANAGER_ID IS NULL

OR SALARY BETWEEN 4000 OR 6000;

b. SELECT (FIRSTNAME||RPAD(SALARY,6,'*')) AS "EMPLOYEES AND THEIR SALARIES"

FROM EMPLOYEES

WHERE MANAGER_ID IS NULL

OR SALARY BETWEEN 4000 AND 6000;

c. SELECT (FIRSTNAME||RPAD(SALARY,6,'*')) AS "EMPLOYEES AND THEIR SALARIES"

FROM EMPLOYEES

WHERE MANAGER_ID = NULL


OR SALARY BETWEEN 4000 AND 6000;

d. SELECT (FIRSTNAME||(SALARY,6,'*')) AS "EMPLOYEES AND THEIR SALARIES"

FROM EMPLOYEES

WHERE MANAGER_ID IS NULL

OR SALARY BETWEEN 4000 AND 6000;

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

What query should be used in order to display the employees lastname concatenated with firstname and
with a ‘, (comma)’ in between. A rename on the concatenated column as Complete Name. Note all
values in Complete Name column should be in lowercase plus display the length of employees lastname
for all employees whose lastname starts with letter M sort the lastname in its default order.

Select one:

a. SELECT LOWER(LASTNAME,FIRSTNAME) AS COMPLETE NAME,

LENGTH(LASTNAME)

FROM EMPLOYEES

WHERE LASTNAME LIKE 'M%';

b. SELECT LOWER(LASTNAME||','||FIRSTNAME) AS COMPLETE NAME,

LENGTH(LASTNAME)

FROM EMPLOYEES

WHERE LASTNAME LIKE 'M%';

c. SELECT LOWER(LASTNAME||','||FIRSTNAME) AS "COMPLETE NAME",

LENGTH(LASTNAME)

FROM EMPLOYEES

WHERE LASTNAME LIKE 'M%';

d. SELECT LOWER(LASTNAME||','||FIRSTNAME) AS COMPLETE NAME,

LENGTH(LASTNAME)
FROM EMPLOYEES

WHERE LASTNAME LIKE '%M';

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

What query should be used in order to display the firstname concatenated to salary with additional
column salary that provides a computation of salary * 2. Rename the column as Increase of all
employees whose lastname ends with N.

Select one:

a. SELECT lower(FIRSTNAME || 'SALARY OF' || SALARY || 'IF MULITPLY BY TWO THEN HE/SHE WLL GOT
A NEW SALARY OF' || SALARY * 2)AS INCREASE FROM EMPLOYEES WHERE LASTNAME LIKE 'N%';

b. SELECT (FIRSTNAME || 'SALARY OF' || SALARY || 'IF MULITPLY BY TWO THEN HE/SHE WLL GOT A NEW
SALARY OF' || SALARY * 2)AS INCREASE FROM EMPLOYEES WHERE LASTNAME LIKE '%N';

c. SELECT (FIRSTNAME || 'SALARY OF' SALARY 'IF MULITPLY BY TWO THEN HE/SHE WLL GOT A NEW
SALARY OF' || SALARY * 2)AS INCREASE FROM EMPLOYEES WHERE LASTNAME LIKE 'N%';

d. SELECT (FIRSTNAME || 'SALARY OF' || SALARY || 'IF MULITPLY BY TWO THEN HE/SHE WLL GOT A NEW
SALARY OF' || SALARY * 2)AS INCREASE FROM EMPLOYEES WHERE LASTNAME LIKE 'N%';

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

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

FROM EMPLOYEES

WHERE SALARY < 5000;

d. 0

0
0

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

SELECT TRUNC(563.396,2)FROM DUAL;

Select one:

a. 563.3

b. 563.39

c. 563

d. 500

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

What query should be used in order toget theSUBSTR function that returns the job_id = ‘REP’.

Select one:

a. SELECT JOB_ID FROM EMPLOYEES

WHERE SUBSTR(JOB_ID,4)='%REP%';

b. SELECT JOB_ID FROM EMPLOYEES

WHERE SUBSTR='REP';

c. SELECT JOB_ID FROM EMPLOYEES

WHERE JOB_ID LIKE ‘%REP%’;

d. SELECT JOB_ID FROM EMPLOYEES

WHERE SUBSTR(JOB_ID,4)='REP';
Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

What query should be used in order todisplay the Firstname concatenated to employees original salary
plus concatenate again a new column salary that multiplies the original salary into three. Rename the
column as Dream Salaries.Note sort the salary in descending order.

Select one:

a. SELECT (FIRSTNAME||' EARNS MONTHLY BUT WANTS' || SALARY * 3)

AS "DREAM SALARIES"

FROM EMPLOYEES

ORDER BY SALARY DESC;

b. SELECT (FIRSTNAME||' EARNS MONTHLY BUT WANTS' || SALARY * 3)

AS "DREAM SALARIES"

FROM EMPLOYEES

ORDER BY SALARY;

c. SELECT (FIRSTNAME||' EARNS '|| SALARY || 'MONTHLY BUT WANTS' || SALARY * 3)

AS "DREAM SALARIES"

FROM EMPLOYEES

ORDER BY SALARY;

d. SELECT (FIRSTNAME||' EARNS '|| SALARY || 'MONTHLY BUT WANTS' || SALARY * 3)

AS "DREAM SALARIES"

FROM EMPLOYEES

ORDER BY SALARY DESC;

What is the return value if the user try to do the following:

SELECT TRUNC (65.73,-2) FROM DUAL;

Select one:
a. 00

b. 60

c. 0

d. 600

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

SELECT TRUNC(563.396,1)FROM DUAL;

Select one:

a. 563.39

b. 563

c. 563.3

d. 500

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

SELECT FIRSTNAME, SALARY, LPAD(SALARY * 0.10 + SALARY – 100, 8, ‘$’) AS BONUS


FROM EMPLOYEES

WHERE DEPARTMENT_ID NOT IN (10, 110, 50

AND SALARY=17000;

Select one:

a. NENA 17000 18600$$$

LEX 17000 18600$$$

b. NENA 17000 17000$$$

LEX 17000 17000$$$

c. NENA 17000 $$$17000

LEX 17000 $$$17000

d. NENA 17000 $$$18600

LEX 17000 $$$18600

Feedback

Your answer is correct.

Question 2

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.
Table 1.0 EMPLOYEES

What query should be used in order to display the salary leftpadded with 15 character long and ‘$’ as
special character and another column salary right padded with 10 character long with ‘@’ as special
character used of all employees in 201, 176 and 144.

Select one:

a. SELECT LPAD(SALARY,15,'$'), RPAD(SALARY,10,'@')

FROM EMPLOYEES

WHERE EMPLOYEE_ID = (201,176,144);

b. SELECT LPAD(SALARY,15,'@'), RPAD(SALARY,10,'$')

FROM EMPLOYEES

WHERE EMPLOYEE_ID IN (201,176,144);

c. SELECT RPAD(SALARY,15,'$'), LPAD(SALARY,10,'@')

FROM EMPLOYEES

WHERE EMPLOYEE_ID IN (201,176,144);

d. SELECT LPAD(SALARY,15,'$'), RPAD(SALARY,10,'@')

FROM EMPLOYEES
WHERE EMPLOYEE_ID IN (201,176,144);

Feedback

Your answer is correct.

Question 3

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

It is use to accept numeric input and return numeric values.

Select one:

a. Multiple row function

b. Character function

c. Number function

d. Case manipulation function

Question 4

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES


What query should be used in order todisplay the firstname in capitalized format rename the column as
pangalan whose job_id is equal to ‘SA_REP’.

Select one:

a. SELECT UPPER(FIRSTNAME) PANGALAN

FROM EMPLOYEES

WHERE JOB_ID = 'SA_REP';

b. SELECT UPPER(FIRSTNAME) AS PANGALAN

FROM EMPLOYEES

WHERE JOB_ID = 'SA_REP';

c. SELECT FIRSTNAME AS PANGALAN

FROM EMPLOYEES

WHERE JOB_ID = 'SA_REP';

d. SELECT UPPER(FIRSTNAME) AS PANGALAN

FROM EMPLOYEES

WHERE JOB_ID IS 'SA_REP';


Feedback

Your answer is incorrect.

Question 5

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

SELECT TRUNC(563.396,-2) FROM DUAL;

Select one:

a. 563

b. 563.39

c. 563.3

d. 500

Feedback
Your answer is incorrect.

Question 6

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

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

FROM EMPLOYEES

WHERE JOB_ID LIKE ’%PR%’;

Select one:

a. king,steven

hunold,alexander

Ernst,bruce
lorentz,Diana

b. King,Steven

Hunold,Alexander

Ernst,Bruce

Lorentz,Diana

c. KING,STEVEN

HUNOLD,ALEXANDER

ERNST,BRUCE

LORENTZ,DIANA

d. King’,’Steven

Hunold’,’Alexander

Ernst’,’Bruce

Lorentz’,’Diana

Feedback

Your answer is correct.

Question 7

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES


What query should be used in order todisplay a report that trim the letter ‘A’ from lastname of all
employees whose department_id between 60 and 90.

Select one:

a. SELECT TRIM('A' FROM LASTNAME)

FROM EMPLOYEES

WHERE DEPARTMENT_ID BETWEEN 60 OR 90;

b. SELECT TRIM(LASTNAME,’A’)

FROM EMPLOYEES

WHERE DEPARTMENT_ID BETWEEN 60 AND 90;

c. SELECT TRIM('A' FROM LASTNAME)

FROM EMPLOYEES

WHERE DEPARTMENT_ID BETWEEN 60 AND 90;

d. SELECT TRIM('A' FROM LASTNAME)

FROM EMPLOYEES

WHERE DEPARTMENT_ID BETWEEN 90 AND 60;


Feedback

Your answer is incorrect.

Question 8

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

Trims leading or trailing characters (or both) from a character string.

Select one:

a. INSTR

b. Length

c. SUBSTR

d. Trim

Question 9

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES


Based on the given SELECT statement below what would be the possible output?

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

FROM EMPLOYEES

WHERE DEPARTMENT_ID = 50

AND MANAGER_ID = 100;

Select one:

a. ZLOTKEY ZLOTKEY 80 100

b. RAJS RAJS 50 124

c. ZLOYEY TRINA 80 200

d. MOURGOS MOURGOS 50 100

Feedback

Your answer is incorrect.

Question 10

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.
Table 1.0 EMPLOYEES

What query should be used in order to display the lastname and salary of all employees whose
department_id = 60 or job_id like ‘_T%’. Format the salary to be 15 character long, left padded with ‘$’
as special character. Label the column Salary.

Select one:

a. SELECT LASTNAME, LPAD(SALARY,15,'$') AS SALARY

FROM EMPLOYEES

WHERE DEPARTMENT_ID = 60 OR JOB_ID LIKE 'T';

b. SELECT LASTNAME, RPAD(SALARY,15,'$') AS SALARY

FROM EMPLOYEES

WHERE DEPARTMENT_ID = 60 OR JOB_ID LIKE '_T';

c. SELECT LASTNAME, LPAD(SALARY,15,'$')

FROM EMPLOYEES

WHERE DEPARTMENT_ID = 60 OR JOB_ID LIKE '_T';

d. SELECT LASTNAME, LPAD(SALARY,15,'$') AS SALARY

FROM EMPLOYEES
WHERE DEPARTMENT_ID = 60 OR JOB_ID LIKE '_T';

----------

SELECT SUM(QTY) FROM STOCKS WHERE WAREHOUSE IN (1,5) GROUP BY WAREHOUSE HAVING
MAX(WAREHOUSE) >=5;

Answer:

FROM INVENTORY;

Question 2

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Which of the following query is correct which will display the same output as shown below?

Select one:

a. SELECT COUNT ALL FROM EMPLOYEES;

b. SELECT * FROM EMPLOYEES;

c. SELECT COUNT(*) FROM EMPLOYEES;

Feedback

Your answer is incorrect.

Question 3

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question


Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Which of the following is the correct report that display the smallest (minimum) Surname.. and apply the
ff. functions:

Get the average salary; Group the data per job_id; Get only job_id with a keyword “REP”; and Apply
having clause, which the max salary per job_id is greater than 5000.

Select one:

a. SELECT CONCAT(DEPARTMENT_ID,JOB_ID),MIN(SALARY), MAX(SALARY)

FROM EMPLOYEES

GROUP BY JOB_ID;

b. SELECT MIN(LASTNAME), AVG(SALARY)

FROM EMPLOYEES

WHERE JOB_ID LIKE ‘%REP%’

GROUP BY JOB_ID

HAVING MAX(SALARY)>500;
c. SELECT MIN(LASTNAME), AVG(SALARY)

FROM EMPLOYEES

GROUP BY JOB_ID

WHERE JOB_ID LIKE ‘%REP%’

HAVING MAX(SALARY)>500;

d. SELECT MIN(LASTNAME), AVG(SALARY)

FROM EMPLOYEES

WHERE JOB_ID NOT LIKE ‘%REP%’

GROUP BY JOB_ID

HAVING MAX(SALARY)>500;

Feedback

Your answer is incorrect.

Question 4

Correct

Mark 1.00 out of 1.00


Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Which of the following is the correct query that display the maximum lastname concatenated to
firstname and rename the column as “Employees Name”, Job_id and apply the ff. functions:

Count the Job_id; Apply where condition whose lastname ends with letter ‘N’; Group the job_id; and
Apply having clause of employees having average salary that is greater than 10000.

Select one:

a. SELECT MAX(LASTNAME||FIRSTNAME) AS "EMPLOYEES NAME", JOB_ID, COUNT(JOB_ID)

FROM EMPLOYEES

WHERE LASTNAME LIKE '%N'

GROUP BY JOB_ID

HAVING AVG(SALARY)>10000;

b. SELECT MAX(LASTNAME||FIRSTNAME) AS EMPLOYEES NAME, JOB_ID, COUNT(JOB_ID)

FROM EMPLOYEES
WHERE LASTNAME LIKE '%N'

GROUP BY JOB_ID

HAVING AVG(SALARY)>10000;

c. SELECT MAX(LASTNAME||FIRSTNAME) AS "EMPLOYEES NAME", JOB_ID, COUNT(JOB_ID)

FROM EMPLOYEES

WHERE LASTNAME LIKE '%N'

GROUP BY JOB_ID

HAVING AVG(SALARY)<10000;

d. SELECT MAX(LASTNAME||FIRSTNAME) AS "EMPLOYEES NAME", JOB_ID, COUNT(JOB_ID)

FROM EMPLOYEES

GROUP BY JOB_ID

WHERE LASTNAME LIKE '%N'

HAVING AVG(SALARY)>10000;

Feedback
Your answer is correct.

Question 5

Not answered

Marked out of 1.00

Not flaggedFlag question

Question text

SELECT COUNT (AVG(PRICE)) FROM STOCKS GROUP BY WAREHOUSE;

Answer:

Question 6

Not answered

Marked out of 1.00

Not flaggedFlag question

Question text

SELECT COUNT(*) FROM STOCKS;

Answer:

Question 7

Not answered

Marked out of 1.00


Not flaggedFlag question

Question text

Which of the following query is correct which will display the same output as shown below?

Select one:

a. SELECT COUNTDISTINCT(MANAGER_ID) AS "NO. OF MANAGER_ID" FROM EMPLOYEES;

b. SELECT COUNT *(MANAGER_ID) AS "NO. OF MANAGER_ID" FROM EMPLOYEES;

c. SELECT COUNT(MANAGER_ID) NO. OF MANAGER_ID FROM EMPLOYEES;

d. SELECT COUNT(MANAGER_ID) AS "NO. OF MANAGER_ID" FROM EMPLOYEES;

Feedback

Your answer is incorrect.

Question 8

Not answered

Marked out of 1.00

Not flaggedFlag question

Question text

SELECT COUNT(DISTINCT QTY) FROM STOCKS;

Answer:

Question 9
Not answered

Marked out of 1.00

Not flaggedFlag question

Question text

Which of the following query is correct which will display the same output as shown below?

Select one:

a. SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)

FROM EMPLOYEES

WHERE JOB_ID LIKE '%ST%';

b. SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)

FROM EMPLOYEES

WHERE JOB_ID LIKE 'ST%';

c. SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)

FROM EMPLOYEES

WHERE JOB_ID LIKE '%ST';

d. SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES

WHERE JOB_ID LIKE = ‘ST’;

Feedback

Your answer is incorrect.

Question 10

Not answered

Marked out of 1.00

Not flaggedFlag question

Question text

Which of the following query is correct which will display the same output as shown below?

Select one:

a. SELECT MAX(LASTNAME||','||FIRSTNAME) AS NAME, MAX(SALARY)

FROM EMPLOYEES;

b. SELECT MAX(LASTNAME||''||FIRSTNAME) AS NAME, MAX(SALARY)

FROM EMPLOYEES;

c. SELECT MAX(LASTNAME||','||FIRSTNAME) AS NAME, MIN(SALARY)

FROM EMPLOYEES;
d. SELECT MAX(LASTNAME||FIRSTNAME) AS NAME, MAX(SALARY)

FROM EMPLOYEES;

-------

Skip to main content

BL-IT-6202-LEC-1923T DATABASE MGT. SYSTEM 1(ORACLE)

Dashboard

My courses

BL-IT-6202-LEC-1923T

Week 10: Short Quiz

Quiz 005

Started on Friday, 3 January 2020, 4:14 PM

State Finished

Completed on Friday, 3 January 2020, 4:42 PM

Time taken 28 mins 25 secs

Marks 9.00/10.00

Grade 90.00 out of 100.00

Question 1

Incorrect

Mark 0.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.
Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

SELECT LASTNAME,SALARY, RPAD(SALARY,4,’@’)

FROM EMPLOYEES

WHERE SALARY BETWEEN 4000 AND 9000

LASTNAME LIKE ‘%S’;

Select one:

a. MOURGOS 5800 5800@@@@

RAJS 3500 3500@@@@

DAVIES 3100 3100@@@@

MATOS 2600 2600@@@@

VARGAS 2500 2500@@@@

HIGGINS 12000 12000@@@

b. MOURGOS 5800 5800@@@@

c. RAJS 3500 3500

DAVIES 3100 3100

MATOS 2600 2600


VARGAS 2500 2500

HIGGINS 12000 12000

d. MOURGOS 5800 5800

DAVIES 3100 3100

e. MOURGOS 5800 5800

Feedback

Your answer is incorrect.

Question 2

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

It is a table that is owned by the user SYS and can be accessed by all users.

Select one:

a. Employees

b. Parts

c. Authors

d. Dual

Question 3

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

This is use to return one result per row.


Select one:

a. Single row

b. Multiple row

c. Dual table

d. Number function

Question 4

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

This is used to converts the first letter of each word to uppercase and the remaining letters to lowercase.

Select one:

a. Upper case

b. Sentence case

c. INITCAT

d. lowercase

Question 5

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES


Based on the given SELECT statement below what would be the possible output?

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;

Select one:

a. KING WITH A SALARY OF 24000 4

HUNOLDWITH A SALARY OF 2400 6

b. KINGWITH A SALARY OF 24000 4

HUNOLDWITH A SALARY OF 2400 6

c. king with a salary of 24000 4

hunoldwith a salary of 2400 6

d. kingwith a salary of 24000 4

hunoldwith a salary of 2400 6

Feedback

Your answer is correct.

Question 6
Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

Choose the letter of the correct answer based on the table EMPLOYEES as shown below.

Table 1.0 EMPLOYEES

Based on the given SELECT statement below what would be the possible output?

SELECT (LASTNAME||FIRSTNAME), JOB_ID

FROM EMPLOYEES

WHERE SUBSTR (JOB_ID,4)=’REP’;

Select one:

a. ABELELLEN SA_REP

b. ABELELLEN SA_REP

TALORJONATHAN SA_REP

GRANTKIMBERLY SA_REP

FAYPAT MK_REP

c. ABELELLEN SA_REP
TALORJONATHAN SA_REP

GRANTKIMBERLY SA_REP

d. ABEL ELLEN SA_REP

TALOR JONATHAN SA_REP

GRAN TKIMBERLY SA_REP

Feedback

Your answer is correct.

Question 7

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

This is use to accept character input and can return both character and number values.

Select one:

a. Number function

b. Case manipulation function

c. Multiple row function

d. Character function

Question 8

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

This is use to find the numeric position of a named character starting at character position n.
Select one:

a. Length

b. INSTR

c. Trim

d. SUBSTR

Question 9

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

Extracts a string of determined length.

Select one:

a. SUBSTR

b. Trim

c. Length

d. INSTR

Question 10

Correct

Mark 1.00 out of 1.00

Not flaggedFlag question

Question text

This is use to return one result per group of row.

Select one:

a. Single row

b. Number function
c. Multiple row

d. Dual table

Вам также может понравиться