Home
16.
Which clause in a query restricts the rows selected?
  • A.
    ORDER BY
  • B.
    WHERE
  • C.
    SELECT
  • D.
    FROM
  • Answer & Explanation
  • Report
Answer : [B]
Explanation :
The WHERE clause is used to filter the rows returned from a query. The WHERE clause condition is evaluated, and rows are returned only if the result is TRUE. The ORDER BY clause is used to display the result in a certain order. The OFFSET and FETCH clauses are used to limit the rows returned.
Report
Name Email  
17.
The following listing shows the records of the EMP table:
When you issue the following query, which value will be displayed in the first row?
SELECT empno
FROM emp
WHERE deptno = 10
ORDER BY ename DESC;
  • A.
    MILLER
  • B.
    7934
  • C.
    7876
  • D.
    No rows will be returned because ename cannot be used in the ORDER BY clause.
  • Answer & Explanation
  • Report
Answer : [B]
Explanation :
There are three records belonging to DEPTNO 10: EMPNO 7934 (MILLER), 7839 (KING), and 7782 (CLARK). When you sort their names by descending order, MILLER is the first row to display. You can use alias names and columns that are not in the SELECT clause in the ORDER BY clause.
Report
Name Email  
18.
You want to display each project’s start date as the day, week, number, and year. Which statement will give output like the following?
Tuesday Week 23, 2008
  • A.
    SELECT proj_id, TO_CHAR(start_date, 'DOW Week WOY YYYY') FROM projects;
  • B.
    SELECT proj_id, TO_CHAR(start_date,'Day'||' Week'||' WOY, YYYY') FROM projects;
  • C.
    SELECT proj_id, TO_CHAR(start_date, 'Day" Week" WW, YYYY') FROM projects;
  • D.
    SELECT proj_id, TO_CHAR(start_date, 'Day Week# , YYYY') FROM projects;
  • E.
    You can’t calculate week numbers with Oracle.
  • Answer & Explanation
  • Report
Answer : [C]
Explanation :
Double quotation marks must surround literal strings like "Week".
Report
Name Email  
19.
What will the following statement return?
SELECT last_name, first_name, start_date
FROM employees
WHERE hire_date < TRUNC(SYSDATE) – 5;
  • A.
    Employees hired within the past five hours
  • B.
    Employees hired within the past five days
  • C.
    Employees hired more than five hours ago
  • D.
    Employees hired more than five days ago
  • Answer & Explanation
  • Report
Answer : [D]
Explanation :
The TRUNC function removes the time portion of a date by default, and whole numbers added to or subtracted from dates represent days added or subtracted from that date. TRUNC(SYSDATE) -5 means five days ago at midnight.
Report
Name Email  
20.
Which assertion about the following statements is most true?
SELECT name, region_code||phone_number
FROM customers;
SELECT name, CONCAT(region_code,phone_number)
FROM customers;
  • A.
    If REGION_CODE is NULL, the first statement will not include that customer’s PHONE_NUMBER.
  • B.
    If REGION_CODE is NULL, the second statement will not include that customer’s PHONE_NUMBER.
  • C.
    Both statements will return the same data.
  • D.
    The second statement will raise an error if REGION_CODE is NULL for any customer.
  • Answer & Explanation
  • Report
Answer : [C]
Explanation :
The two statements are equivalent.
Report
Name Email