Question 71

Which of the following MySQL query will display all the NAME from the table STUDENT, which are having maximum five characters and starting with the alphabet…

Which of the following MySQL query will display all the NAME from the table STUDENT, which are having maximum five characters and starting with the alphabet 'A'?
  1. ASELECT NAME FROM STUDENT WHERE NAME LIKE 'A____';
  2. BSELECT NAME FROM STUDENT WHERE NAME = 'A____';
  3. CSELECT NAME FROM STUDENT WHERE NAME = 'A%%%%;
  4. DSELECT NAME FROM STUDENT WHERE NAME LIKE 'A%%%%'
Show answerHide answer

Correct answer: (A) SELECT NAME FROM STUDENT WHERE NAME LIKE 'A____';

Explanation

LIKE with the wildcard _ matches exactly one character, so 'A____' matches names that start with A and have five characters. The = operator does not treat wildcards specially.

From DSSSB TGT Computer Science Practice Set 5

This is question 71 of DSSSB TGT Computer Science Practice Set 5. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.