View the Exhibit and examine the details for the CATEGORIES_TAB table.
Evaluate the following incomplete SQL statement:
SELECT category_name,category_description
FROM categories_tab
You want to display only the rows that have ‘harddisks’ as part of the string in the CATEGORY_DESCRIPTION column.
Which two WHERE clause options can give you the desired result? (Choose two.)
A.
WHERE REGEXP_LIKE (category_description, ‘hard+.s’);
B.
WHERE REGEXP_LIKE (category_description, ‘^H|hard+.s’);
C.
WHERE REGEXP_LIKE (category_description, ‘^H|hard+.s$’);
D.
WHERE REGEXP_LIKE (category_description, ‘[^H|hard+.s]’);
A and B
Question, Why is not D?, I ran the sentences below and only the C is wrong.
Select sysdate from dual
WHERE REGEXP_LIKE (‘harddisks’, ‘hard+.s’);
Select sysdate from dual
WHERE REGEXP_LIKE (‘harddisks’, ‘^H|hard+.s’);
Select sysdate from dual
WHERE REGEXP_LIKE (‘harddisks’, ‘^H|hard+.s$’);
Select sysdate from dual
WHERE REGEXP_LIKE (‘harddisks’, ‘[^H|hard+.s]’);
Thanks
When D. is run against categories_tab, it displays ALL rows from the table, not only ‘hardisks’ row.
D. finds matches of characters that are NOT H,h,a,r,d and s.
In ‘harddisks’ the matches are i and k, for example.
I get why D is wrong and why A and B is right.
Why is C wrong?