Question 11 of 32beginner🔧 ApplyVery Short1 mark

Write the output produced by the following SQL statement: SELECT LEFT("INDIA",3), RIGHT("Computer Science",4), MID("Informatics",3,4), SUBSTR("Practices",3);

Correct Answer

IND, ence, form, actices

Exercise: EXERCISE | Q: 2(e) | (Page 46)
For More Understanding

Explanation

According to the textbook context: LEFT(string, N) returns N characters from the left side, so LEFT("INDIA",3) = "IND". RIGHT function works similarly from the right side, so RIGHT("Computer Science",4) = "ence". MID(string, pos, n) returns n characters starting from position pos, and the example shows MID("Informatics", 3, 4) = "form". For SUBSTR, the context states "If n is not specified, it returns the substring from the position pos till end of the string", so SUBSTR("Practices",3) returns "actices" (from position 3 to end).

Solution Steps

  1. Step 1: LEFT("INDIA",3) extracts 3 characters from left → IND

  2. Step 2: RIGHT("Computer Science",4) extracts 4 characters from right → ence

  3. Step 3: MID("Informatics",3,4) extracts 4 characters starting from position 3 → form

  4. Step 4: SUBSTR("Practices",3) extracts from position 3 to end → actices