Skip to main contentSkip to solution

What is output of the following SQL statement?

SELECT LEFT((RIGHT("INFORMATION",3),2);

Solution

✅ Correct Option: 3

The inner function RIGHT("INFORMATION", 3)\text{RIGHT("INFORMATION", 3)} takes the last 3 characters, which gives "ION".

The outer function LEFT("ION", 2)\text{LEFT("ION", 2)} then takes the first 2 characters of "ION", which gives "IO".


Option 2: "INF" would be the result of LEFT("INFORMATION", 3)\text{LEFT("INFORMATION", 3)}, which takes from the left of the original string.

Option 4: "ION" is only the result of the inner RIGHT, before LEFT is applied.

LEFT(str, n) returns the first n characters and RIGHT(str, n) returns the last n characters. Nested functions are evaluated from the inside out.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question