Multiple choice technology databases

Which of the query will print the output as 'TCS' (single quotes should come in the output of the query)

  1. select '''||'TCS'||''' from dual

  2. select 'TCS' from dual

  3. select '''TCS''' from dual

  4. select "TCS" from dual

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Oracle SQL, a single quote is escaped by doubling it. The expression '''||'TCS'||''' concatenates an escaped single quote, the string 'TCS', and another escaped single quote, resulting in 'TCS'.