Home
51.
Refer to the listing of records in the EMP table in question 9. How many rows will the following query return?
SELECT * FROM emp WHERE ename BETWEEN 'A' AND 'C'

  • A.
    4
  • B.
    4
  • C.
    A character column cannot be used in the BETWEEN operator.
  • D.
    3
  • Answer & Explanation
  • Report
Answer : [D]
Explanation :
Here, a character column is compared against a string using the BETWEEN operator, which is equivalent to ename >= 'A' AND ename <= 'C' . The name CLARK will not be included in this query, because 'CLARK' is > 'C' .
Report
Name Email  
52.
Refer to the EMP table in question 2. When you issue the following query, which line has an error?

1. SELECT empno "Enumber", ename "EmpName"
2. FROM emp
3. WHERE deptno = 10
4. AND "Enumber" = 7782
5. ORDER BY "Enumber";
  • A.
    1
  • B.
    5
  • C.
    4
  • D.
    No error; the statement will finish successfully.
  • Answer & Explanation
  • Report
Answer : [C]
Explanation :
Column alias names cannot be used in the WHERE clause. They can be used in the ORDER BY clause.
Report
Name Email  
53.
You issue the following query:

SELECT empno, ename
FROM emp
WHERE empno = 7782
OR empno = 7876;
Which other operator can replace the OR condition in the WHERE clause?
  • A.
    IN
  • B.
    BETWEEN ... AND ...
  • C.
    LIKE
  • D.
    <=
  • D.
    >=
  • Answer & Explanation
  • Report
Answer : [A]
Explanation :
The IN operator can be used. You can write the WHERE clause as WHERE empno IN (7782, 7876); . Using the =ANY operator also produces the same result.
Report
Name Email  
54.
Which statement searches for PRODUCT_ID values that begin with DI_ from the ORDERS table?
  • A.
    SELECT * FROM ORDERS
    WHERE PRODUCT_ID = 'DI%';
  • B.
    SELECT * FROM ORDERS
    WHERE PRODUCT_ID LIKE 'DI_' ESCAPE '\';
  • C.
    SELECT * FROM ORDERS
    WHERE PRODUCT_ID LIKE 'DI\_%' ESCAPE '\';
  • D.
    SELECT * FROM ORDERS
    WHERE PRODUCT_ID LIKE 'DI\_' ESCAPE '\';
  • E.
    SELECT * FROM ORDERS WHERE PRODUCT_ID LIKE 'DI_%' ESCAPE '\';
  • Answer & Explanation
  • Report
Answer : [C]
Explanation :
Because _ is a special pattern-matching character, you need to include the ESCAPE clause in LIKE . The % character matches any number of characters including 0, and _ matches a single character.
Report
Name Email  
55.
COUNTRY_NAME and REGION_ID are valid column names in the COUNTRIES table. Which one of the following statements will execute without an error?
  • A.
    SELECT country_name, region_id,CASE region_id = 1 THEN 'Europe', region_id = 2 THEN 'America', region_id = 3 THEN 'Asia', ELSE 'Other' END ContinentFROM countries;
  • B.
    SELECT country_name, region_id,CASE (region_id WHEN 1 THEN 'Europe', WHEN 2 THEN 'America', WHEN 3 THEN 'Asia', ELSE 'Other') ContinentFROM countries;
  • C.
    SELECT country_name, region_id,CASE region_id WHEN 1 THEN 'Europe' WHEN 2 THEN 'America' WHEN 3 THEN 'Asia' ELSE 'Other' END ContinentFROM countries;
  • D.
    SELECT country_name, region_id,CASE region_id WHEN 1 THEN 'Europe' WHEN 2 THEN 'America' WHEN 3 THEN 'Asia' ELSE 'Other' ContinentFROM countries;
  • Answer & Explanation
  • Report
Answer : [C]
Explanation :
A CASE expression begins with the keyword CASE and ends with the keyword END .
Report
Name Email