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

Is the underlying the structure of a database.

Data ModelsX
data models

Are said to exhibit physical data independence if they do not depend on the
physical schema.
Application programsX

It is a collection of relations or two-dimensional tables controlled by the Oracle


server.
c. Relational database

Which of the following is not part of transaction control?


d. CREATE

It is a unit of data � is a symbol or a set of symbols which is used to represent


something.
datum

It is an interpreted data � data supplied with semantics.


Information

This is also known as facts that can be recorded and that have implicit meaning.
Data

The overall logical structure schema of a database can be expressed graphically by


an
E-R diagram

This is a characteristic of database that includes also the protection of the


database from unauthorized access confidentiality and unauthorized changes.
Data Integrity

It is an association among several entities.


relationship
___________________________________________________
Which of the following is the correct example of updating the COURSE to �N/A� of
all students from STUDENTS table whose course IS NULL;
a. UPDATE STUDENTS
SET COURSE = �N/A�

WHERE COURSE = NULL; X

b. UPDATE TABLE STUDENTS


SET COURSE = �N/A�

WHERE COURSE IS NULL;

Which of the following is the correct example inserting a new value to STUDENTS
table that will only add new data to STUD_ID and LASTNAME? The stud_id is 10 and
lastname is �CRUZ�
b. INSERT INTO STUDENTS(STUD_ID,LASTNAME)
VALUES(10,�CRUZ�);

Consists of a collection of DML statements that form a logical unit of work.


c. Transaction

A type of DML statement that is use to remove existing rows in a table.


a. DELETE
A statement that is use to rename the table or change the existing name of the
table.
c. Rename

Which of the following is the correct example updating all student COURSE to �BSIT�
from STUDENTS table?
d. UPDATE STUDENTS
SET COURSE = �BSIT�;

A type of DML statement that is use to update existing rows in a table.


b. UPDATE

Which of the following datatype is not being used in oracle?


c. INT

Which of the following is not true about ALTER statement?


b. Insert new row in a table

Suppose that a user wanted to insert a new value using the implicit method which of
the following is the correct example.
b. INSERT INTO STUDENST(USN_ID, FIRSTNAME)
VALUES(10,�ELENA�)
_______________________________________________________________

It is design to manage large bodies of information.


Database systemsX
database management system

It is collection of data that contains information relevant to an enterprise.


database

This describes the database design at the physical level.


physical schema

It is the term generally used to describe what was done by large mainframe
computers from the late 1940's until the early 1980's.
Data Processing

It is the collection of basic objects.


Entities

It is a bundle of actions which are done within a database to bring it from one
consistent state to a new consistent state.
Transaction

This describes the database design at the logical level.


logical schema

He proposed the relational model for database systems in 1970.


b. Dr. E.F Codd

Which of the following is not part of data manipulation language?


b. Alter

The overall design of the database is called the


database schema
______________________________________________________
Which of the following is the correct example of deleting a student record from
STUDENTS table whose COURSE is equal to NULL;
a. DELETE FROM STUDENTS
WHERE COURSE IS =NULL; X
d. DELETE FROM STUDENTS
WHERE COURSE = �NULL�; X

Which of the following is the correct example of removing a column FIRSTNAME from
EMPLOYEES table?
c. ALTER TABLE EMPLOYEES
DROP COLUMN FIRSTNAME;

Which of the following is the correct example of updating the LASTNAME to �REYES�
of all students from STUDENTS table whose STUD_ID is equal to 01020564?
d. UPDATE STUDENTS
SET LASTNAME = �REYES�

WHERE STUD_ID = 01020564;

Suppose that a user uses the DELETE statement as shown below: what is/are the
possible output.
d. All rows are deleted but the table is still intact.

A type of DML statement that is use to add new rows in a table.


a. INSERT

A type of insert statement that omit the column from the column list.
c. Implicit

Which of the following is the correct example of modifying the column lastname?
Change the datatype size to 20.
d. ALTER TABLE EMPLOYEES
MODIFY LASTNAME VARCHAR(20);

A type of insert statement that specify the NULL keyword in the VALUES clause.
a. Explicit

Which of the following is the correct example of creating a new table STUDENTS? The
column STUD_ID is set to primary key.
c. CREATE TABLE STUDENTS( STUD_ID NUMBER(3) PRIMARY KEY);

Which of the following is the correct example of truncating the table EMPLOYEES?
c. TRUNCATE TABLE EMPLOYEES;
______________________________________________________________
Basic unit of storage composed of rows and columns
d. Table

Which of the following is the correct example of dropping the table EMPLOYEES?
d. DROP TABLE EMPLOYEES;

An alter statement that is used to update an existing column datatype or datatype


size.
b. MODIFY

It is a collection of interrelated data and a set of programs to access those data.


Database-management system (DBMS)X
Database-management system

Are applied to the table and form the logical schema.


Constraints
Which of the following is the correct example of inserting new values to STUDENTS
table where the course is set to NULL;
a. INSERT INTO STUDENTS VALUES(1,'DELA CRUZ','JUANITO',NULL); X

Which of the following is the correct example of adding a new column


CONTACT_NOdatatypeNUMBER size 11 to EMPLOYEES table?
c. ALTER TABLE EMPLOYEES
ADD CONTACT_NO NUMBER(11);

Which of the following is the correct example of deleting all records in STUDENTS
table;
b. DELETE FROM STUDENTS;

An alter statement that is used to add new column to the table.


c. ADD

An alter statement that is used to delete an existing column in the table.


c. DROP

Which of the following is the correct example inserting a new value to STUDENTS
table that will only add new data to STUD_ID and LASTNAME? The stud_id is 10 and
lastname is 'CRUZ' and the rest of the column is set to NULL.
c. INSERT INTO STUDENTS VALUES (10,'CRUZ',NULL,NULL);

Which of the following is the correct example of inserting new values to STUDENTS
table?
a. INSERT INTO STUDENTS VALUES(1,'DELA CRUZ','JUANITO','BSIT');

Suppose that a user wanted to update the lastname of student to �Santos� and YR_LVL
to �Irreg� whose USN_ID is equal to 50, in one select statement which of the
following is the correct sql statement to use.
d. UPDATE STUDENTS
SET LASTNAME = �SANTOS�, YR_LVL = �IRREG�
WHERE USN_ID = 50;

It logically represents subsets of data from one or more table.


c. View
_________________________________________________________
Which of the following is not true about writing SQL statements?
b. Indents should be used to make code more readable. X
a. Keywords cannot be split across lines or abbreviated.

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


statement.
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.
d. Projection

Supposed that the user uses the ff SELECT statement: what will be the possible
output.
SELECT GRADE AS STUDENT MARK FROM GRADE_REPORT;
d. Error because of missing �� mark.

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.
d. Selection
This is used to brings together data that is stored in different tables by
specifying the link between them.
a. Joins

A system used to concatenate one column to another column.


a. ||

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


c. Literal

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


b. NULL

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


a. Arithmetic expression
___________________________________________________________
This is used to perform wildcard searches of valid search string values.
a. Like

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


True

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

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


a. Between

Given the output below. Which of the following is the correct PL/SQL to be used?
b. SELECT (PARTNUM|| �belong to�||DESCRIPTION) FROM PARTS WHERE CLASS = �SG�;

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


a. Where

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

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
-SELECT (PARTNUM || �is the part number of� ||DESCRIPTION || �which belongs to� ||
WAREHOUSE) FROM PARTS WHERE PARTNUM NOT LIKE �ER%�;
X
Given the output below. Which of the following is the correct PL/SQL to be used
a. SELECT WAREHOUSE, CLASS FROM PARTS WHERE CLASS IN (�AP�,�SG�,�HW�);
X
b. SELECT DICTINCT WAREHOUSE, CLASS FROM PARTS WHERE WAREHOUSE >=1;

Given the output below. Which of the following is the correct PL/SQL to be used?
c. SELECT DESCRIPTION, ONHAND, CLASS
FROM PARTS
WHERE CLASS = �AP� OR ONHAND BETWEEN 8 AND 12;
X
_______________________________________________________
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;
a. NENA 17000 $$$18600
LEX 17000 $$$18600

Extracts a string of determined length.


d. SUBSTR

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

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


SELECT TRUNC (65.73,-2) FROM DUAL;
d. 0

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

SELECT TRUNC(563.396,2)FROM DUAL;


d. 563.39

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%�;


a. King,Steven
Hunold,Alexander
Ernst,Bruce
Lorentz,Diana

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.
c. SELECT RPAD(SALARY,15,'$'), LPAD(SALARY,10,'@')
FROM EMPLOYEES

WHERE EMPLOYEE_ID IN (201,176,144); XXXX

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�.
d. SELECT FIRSTNAME AS PANGALAN
FROM EMPLOYEES

WHERE JOB_ID = 'SA_REP'; XXXX

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;
b. king with a salary of 24000 4
hunoldwith a salary of 2400 6 XXXXXXX

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.
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%';

XXXXXX
_______________________________
Which of the following query is correct which will display the same output as shown
below?
c. SELECT MAX(LASTNAME||','||FIRSTNAME) AS NAME, MAX(SALARY)
FROM EMPLOYEES;

SELECT MIN(PRICE) FROM STOCKS;


7
SELECT MAX(NAME) FROM STOCKS;
ZONROX
SELECT COUNT(*) FROM STOCKS;
9
Which of the following is the correct query that displays the lowest salary rename
as �LOWEST SALARY�, maximum salary rename as �HIGHEST SALARY� and department_id
concatenated to job_id?
SELECT CONCAT(DEPARTMENT_ID,JOB_ID),MIN(SALARY), MAX(SALARY)
FROM EMPLOYEES

GROUP BY JOB_ID,DEPARTMENT_ID;

Which of the following query is correct which will display the same output as shown
below?
a. SELECT MIN(LASTNAME), JOB_ID, MAX(SALARY)
FROM EMPLOYEES

WHERE JOB_ID LIKE '%REP%'

GROUP BY JOB_ID;

Which of the following query is correct which will display the same output as shown
below?
b. SELECT MIN(LASTNAME||FIRSTNAME) AS NAME, DEPARTMENT_ID
FROM EMPLOYEES

WHERE DEPARTMENT_ID IN(90,50)

GROUP BY DEPARTMENT_ID

HAVING(DEPARTMENT_ID)<=90; XXXX
Which of the following query is correct which will display the same output as shown
below?
a. SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES

WHERE JOB_ID LIKE '%ST%'; XXX

Which of the following is the correct query that display the Minimum firstname
concatenated to lastname? Look for the maximum salary that is less than 10000 per
department_id.
d. SELECT MIN(FIRSTNAME||LASTNAME)
FROM EMPLOYEES

HAVING MAX(SALARY)<10000

GROUP BY DEPARTMENT_ID; XXX


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

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


a. Arithmetic expression

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


c. Between

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

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


c. 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.
b. Selection

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
%�;

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


c. Where

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.
d. Projection

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

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


c. Where

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


b. NULL
Given the output below. Which of the following is the correct PL/SQL to be used?
a. SELECT * FROM PARTS;

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

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


a. Between

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


c. Literal

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


b. IN

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


True

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

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


d. Like

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)
SELECT PARTNUM, CLASS, ONHAND FROM PARTS WHERE PARTNUM IN (�AT94�,�DR93�,�KV29�);

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;

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


statement.
b. ( )

Supposed that the user uses the ff SELECT statement: what will be the possible
output.

SELECT GRADE AS STUDENT MARK FROM GRADE_REPORT;


d. Error because of missing �� mark.

Given the output below. Which of the following is the correct PL/SQL to be used?
b. SELECT DESCRIPTION, ONHAND, CLASS
FROM PARTS

WHERE CLASS = �AP� AND DESCRIPTION LIKE �%ER�;

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


a. IN

True/False. Character strings and date values are enclosed with double quotation
marks.
False
This is used to brings together data that is stored in different tables by
specifying the link between them.
b. Joins

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


d. SQL statements are not case sensitive.

A system used to concatenate one column to another column.


b. ||
__________________________
____WRONG ANSWERS______
https://www.studocu.com/row/document/ama-computer-university/database-management-
system/past-exams/exam-13-november-2019-questions-and-answers/6301720/view
https://www.studocu.com/in/document/ama-computer-university/sql-database/past-
exams/exam-3-march-2018-questions-and-answers/5359046/view
Given the output below. Which of the following is the correct PL/SQL to be used?
X d. SELECT DESCRIPTION, (PRICE *.5 )+PRICE-100 FROM PARTS WHERE PRICE >10000;
a. SELECT DESCRIPTION, PRICE *.5 +PRICE-100 FROM PARTS WHERE PRICE >10000;

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�.
X SELECT DESCRIPTION, PARTNUM, CLASS, PRICES FROM PARTS WHERE DESCRIPTION LIKE �D
%�;
SELECT DESCRIPTION, PARTNUM, CLASS, PRICES FROM PARTS WHERE DESCRIPTION LIKE �___D
%�;

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.
X SELECT CLASS, DESCRIPTION, PRICE FROM PARTS WHERE PRICE BETWEEN 200 AND BETWEEN
500;
SELECT CLASS, DESCRIPTION, PRICE FROM PARTS WHERE PRICE BETWEEN 200 AND 500;

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.
X SELECT DESCRIPTION, CLASS, PRICE FROM PARTS WHERE CLASS NOT LIKE �%AP�;
X 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?
X d. SELECT (PARTNUM|| belong to||DESCRIPTION) FROM PARTS WHERE CLASS = �SG�;
X b. SELECT (PARTNUM|| �belong to�||DESCRIPTION) FROM PARTS WHERE PARTNUM IN
(�BV06,�KV29�)

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?
X SELECT CLASS, WAREHOUSE FROM PARTS WHERE WAREHOUSE = �3�;
SELECT CLASS, WAREHOUSE FROM PARTS WHERE WAREHOUSE = 3;

Given the output below. Which of the following is the correct PL/SQL to be used?
X WHERE DESCRIPTION LIKE �R%�;
WHERE DESCRIPTION LIKE �%R�;

Given the output below. Which of the following is the correct PL/SQL to be used?
X WHERE ONHAND IN(50,21,22);
WHERE CLASS = �HW�;

Given the output below. Which of the following is the correct PL/SQL to be used?
X WHERE CLASS = �AP� OR DESCRIPTION LIKE �__S%�;
X WHERE CLASS = �AP� OR ONHAND BETWEEEN 8 AND 12

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
X SELECT (PARTNUM || �is the part number of� ||DESCRIPTION || �which belongs to�
|| WAREHOUSE) FROM PARTS WHERE PARTNUM LIKE �%ER�;
X SELECT (PARTNUM || �is the part number of� ||DESCRIPTION || �which belongs to�
|| WAREHOUSE) FROM PARTS WHERE PARTNUM NOT LIKE �ER%�;

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.
X SELECT DESCRIPTION, PARTNUM, CLASS, PRICE FROM PARTS WHERE class="HW";
X SELECT COLUMN DESCRIPTION, PARTNUM, CLASS, PRICE FROM PARTS WHERE CLASS=�HW�;
SELECT DESCRIPTION, PARTNUM, CLASS, PRICE FROM PARTS WHERE CLASS=�HW�;

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.
X SELECT DESCRIPTION, ONHAND, WAREHOUSE FROM PARTS WHERE ONHAND <=21;
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
X b. SELECT WAREHOUSE, CLASS FROM PARTS WHERE CLASS IN (�AP�,�SG�,�HW�);
d. SELECT WAREHOUSE, CLASS FROM PARTS;

Given the output below. Which of the following is the correct PL/SQL to be used?
X WHERE CLASS IN (�HW�,�SG�);
WHERE DESCRIPTION LIKE �%L�;

Which of the following is the correct report that will display the DESCRIPTION,
WAREHOUSE AND distinct value for CLASS.
X SELECT DESCRIPTION, WAREHOUSE, DISTINCT �CLASS � FROM PARTS;
SELECT DESCRIPTION, WAREHOUSE, DISTINCT (CLASS) FROM PARTS;

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.
X SELECT DESCRIPTION, PRICE + 10000 AS �NEW PRICE LISTS� FROM PARTS ORDER BY
PRICE;
SELECT DESCRIPTION, PRICE + 10000 AS �NEW PRICE LISTS� FROM PARTS ORDER BY PRICE
DESC;

Which of the following is the correct report showing all rows and columns sort the
description in ascending order.
X SELECT * FROM PARTS ORDER BY DESCRIPTION ASC;
X SELECT * FRO

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�.
Which of the following is the correct report showing all rows and columns sort the
description in ascending order.
SELECT DESCRIPTION, ONHAND, CLASSS FROM PARTS WHERE DESCRIPTION LIKE �%N�;

Given the output below. Which of the following is the correct PL/SQL to be used?
X d. SELECT WAREHOUSE, CLASS FROM PARTS WHERE CLASS IN (�AP�,�SG�,�HW�);
X b. SELECT DISTINCT WAREHOUSE, CLASS FROM PARTS WHERE WAREHOUSE >=1;

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�.
X SELECT (DESCRIPTION|| �WITH A PRICE OF� || PRICE) FROM PARTS WHERE PARTNUM LIKE
�%K�;
SELECT (DESCRIPTION|| �WITH A PRICE OF� || PRICE) FROM PARTS WHERE PARTNUM LIKE �K
%�;
___________________________________________________________________________________
___

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

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.
a. SELECT TRIM('A' FROM LASTNAME)
FROM EMPLOYEES

WHERE DEPARTMENT_ID BETWEEN 60 AND 90;

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


b. Multiple row

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.
b. SELECT LOWER(LASTNAME||','||FIRSTNAME) AS "COMPLETE NAME",
LENGTH(LASTNAME)

FROM EMPLOYEES

WHERE LASTNAME LIKE 'M%';

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

b. SELECT JOB_ID FROM EMPLOYEES


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

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

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


d. Trim

************WRONG ANSWERS********

1.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.
X d. SELECT LASTNAME, RPAD(SALARY,15,'$') AS SALARY
FROM EMPLOYEES

WHERE DEPARTMENT_ID = 60 OR JOB_ID LIKE '_T';

2.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;

c. 0 XXX
0
0
0
0

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
XXX a. SELECT FIRSTNAME, INSTR(FIRSTNAME) AS "NUMBER OF CHARACTER"
FROM EMPLOYEES

WHERE SALARY BETWEEN 4400 AND 8300;

https://www.coursehero.com/u/file/p3bejd0/SELECT-COUNT-FROM-STOCKS-9-CORRECT-10-
SELECT-AVGNVLQTY0-FROM-STOCKS-822-CORRECT/#doc/qa
*************************************************

Which of the following is the correct query that displays the MINIMUM salary of
employees per job_id? Note job_id should be in lowercase.
c. SELECT MIN(SALARY) AS �LOWEST SALARY�, LOWER(JOB_ID)
FROM EMPLOYEES

GROUP BY JOB_ID;

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


- c. Number function

SELECT (LASTNAME||FIRSTNAME), JOB_ID

FROM EMPLOYEES

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

- ANS: c. ABELELLEN SA_REP


TALORJONATHAN SA_REP
GRANTKIMBERLY SA_REP
FAYPAT MK_REP

SELECT AVG(WAREHOUSE) FROM STOCKS;


- 5

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

SELECT COUNT(DISTINCT QTY) FROM STOCKS;


- 4

SELECT MIN(PRICE) FROM STOCKS;


- 7

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


- 3

SELECT COUNT(*) FROM STOCKS;


- 9

SELECT MAX(NAME) FROM STOCKS;


- ZONROX

SELECT COUNT(PRICE) FROM STOCKS;


-3

SELECT MIN(ID) FROM STOCKS;


- 1

Which of the following is the correct query that displays the lowest salary rename
as �LOWEST SALARY�, maximum salary rename as �HIGHEST SALARY� and department_id
concatenated to job_id?
- d. SELECT CONCAT(DEPARTMENT_ID,JOB_ID),MIN(SALARY), MAX(SALARY)
FROM EMPLOYEES

GROUP BY JOB_ID,DEPARTMENT_ID;

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.
- d. 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;

SELECT TRUNC(563.396,1)FROM DUAL;


- d. 563.3

KIMBERLY
WILLIAM
BRUCE
PAT
- a. SELECT MAX(FIRSTNAME), MANAGER_ID, COUNT(SALARY), AVG(SALARY)
FROM EMPLOYEES

WHERE SALARY BETWEEN 10000 AND 6000

GROUP BY MANAGER_ID
HAVING MIN(SALARY) >= 5000;

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.
- 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';

COUNT(*)
20
- b. SELECT COUNT(*) FROM EMPLOYEES;

SELECT TRUNC(563.396,2)FROM DUAL;


- c. 563.39

DE HAANLEX 90
ABELELLEN 50
- SELECT MIN(LASTNAME||FIRSTNAME) AS NAME, DEPARTMENT_ID
FROM EMPLOYEES

WHERE DEPARTMENT_ID IN(90,50)

GROUP BY DEPARTMENT_ID

HAVING MIN(DEPARTMENT_ID)<=90;

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

NAME MAX(SALARY)
----------------------------------------
ZLOTKEY, ELENI 24000
- SELECT MAX(LASTNAME||','||FIRSTNAME) AS NAME, MAX(SALARY)
FROM EMPLOYEES;

Which of the following is the correct query that display the Job_id and add the ff:
function:
Count the total number of job_id per distinct values; Compute for the summary of
salary per job_id; and Compute for the average salary per job_id
- SELECT DISTINCT(JOB_ID), COUNT(JOB_ID) AS �NO. OF JOB_ID�, SUM(SALARY) AS �TOTAL
SALARY�, AVG(SALARY) AS �AVERAGE SALARY� FROM EMPLOYEES GROUP BY JOB_ID;

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

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 MIN(LASTNAME), AVG(SALARY)
FROM EMPLOYEES

WHERE JOB_ID LIKE �%REP%�

GROUP BY JOB_ID
HAVING MAX(SALARY)>500;

Which of the following is the correct that display distinct job_id and the the
total number per distinct (unique) job_id.
- SELECT DISTICT(JOB_ID), COUNT(JOB_ID) AS �TOTAL NUMBER OF JOB_ID�
FROM EMPLOYEES

GROUP BY JOB_ID;

***************************************
SALA
***************************************

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
X- SELECT (FIRSTNAME||RPAD(SALARY,6,'*')) AS "EMPLOYEES AND THEIR SALARIES"
FROM EMPLOYEES

WHERE MANAGER_ID = NULL

OR SALARY BETWEEN 4000 AND 6000;

NO. OF MANAGER_ID
---------------------------- 8
X- SELECT COUNT(MANAGER_ID) AS "NO. OF MANAGER_ID" FROM 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.
X - SELECT LASTNAME, LPAD(SALARY,15,'$') AS SALARY
FROM EMPLOYEES

-SELECT last_name,
LPAD(salary, 15, '$') SALARY
FROM employees;

WHERE DEPARTMENT_ID = 60 OR JOB_ID LIKE 'T';

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�.
X- SELECT FIRSTNAME AS PANGALAN
FROM EMPLOYEES

WHERE JOB_ID = 'SA_REP';

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
X- SELECT FIRSTNAME, LENGTH(FIRSTNAME) AS "NUMBER OF CHARACTER"
FROM EMPLOYEES
WHERE SALARY BETWEEN 8300 AND 4400;

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.
X- SELECT (FIRSTNAME||' EARNS MONTHLY BUT WANTS' || SALARY * 3)
AS "DREAM SALARIES"

FROM EMPLOYEES

ORDER BY SALARY DESC;

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.
X- SELECT TRIM('A' FROM LASTNAME)
FROM EMPLOYEES

WHERE DEPARTMENT_ID BETWEEN 90 AND 60;

IT_PROG------------------- 3
AC_MGR------------------- 1
AC_ACCOUNT------------ 1
ST_MAN-------------------- 1
AD_ASST------------------- 1
AD_VP----------------------- 2
SA_MAN-------------------- 1

X- SELECT JOB_ID, COUNT*(JOB_ID)"NO. OF JOB_ID", SUM(SALARY), AVG(SALARY)


FROM EMPLOYEES

GROUP BY JOB_ID;

ALEXANDER SURNAME IS HUNOLD


X- SELECT MIN(initcap(FIRSTNAME||' surnname is '||LASTNAME)) AS COMPLETE NAME,
MIN(MANAGER_ID) AS "LOWEST MANAGER_ID" FROM 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.
X- SELECT LOWER(LASTNAME||','||FIRSTNAME) AS COMPLETE NAME,
LENGTH(LASTNAME)

FROM EMPLOYEES

WHERE LASTNAME LIKE '%M';

SELECT TRUNC(563.396,-2) FROM DUAL;


X- 563
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;
X- NENA 17000 18600$$$
LEX 17000 18600$$$

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

FROM EMPLOYEES

WHERE SALARY BETWEEN 4000 AND 9000

LASTNAME LIKE �%S�;


X- MOURGOS 5800 5800@@@@

SELECT TRIM(�K� FROM LASTNAME)AS TRIM, LASTNAME, DEPARTMENT_ID, MANAGER_ID

FROM EMPLOYEES

WHERE DEPARTMENT_ID = 50

AND MANAGER_ID = 100;


X- ZLOTKEY ZLOTKEY 80 100

DAVIES TRINA 17500 3500


X- SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES

WHERE JOB_ID LIKE '%ST%';

ABEL SA_REP 11000


FAY MK_REP 6000
X- SELECT MIN(LASTNAME), MIN(JOB_ID), MAX(SALARY)
FROM EMPLOYEES

WHERE JOB_ID LIKE '%REP%'

GROUP BY JOB_ID;

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