Examveda
Examveda

How to select all data from student table starting the name from letter 'r'?

A. SELECT * FROM student WHERE name LIKE 'r%';

B. SELECT * FROM student WHERE name LIKE '%r%';

C. SELECT * FROM student WHERE name LIKE '%r';

D. SELECT * FROM student WHERE name LIKE '_r%';

Answer: Option A

Solution(By Examveda Team)

To select all data from the "student" table where the names start with the letter 'r,' you can use the LIKE operator in SQL. Here's an explanation of each option:

Option A: SELECT * FROM student WHERE name LIKE 'r%';
This option selects all rows where the "name" column starts with 'r'.

Option B: SELECT * FROM student WHERE name LIKE '%r%';
This option selects all rows where the "name" column contains the letter 'r' anywhere within the name.

Option C: SELECT * FROM student WHERE name LIKE '%r';
This option selects all rows where the "name" column ends with the letter 'r'.

Option D: SELECT * FROM student WHERE name LIKE '_r%';
This option selects all rows where the "name" column has 'r' as the second letter.

Since you want to select names starting with 'r,' the correct query is Option A, which uses 'r%' in the LIKE clause to match names that start with 'r'.

This Question Belongs to SQL >> Sql Miscellaneous

Join The Discussion

Related Questions on Sql Miscellaneous