Vidyalelo
MySQL · Q248

MySQL

Programming · MySQL · question 248

Q248

What column names are displayed when this SQL command is executed? SHOW COLUMNS FROM tbl_name LIKE '%name';

A.
suffixed with 'name'
Answer
B.
prefixed with 'name'
C.
suffixed with '%name'
D.
prefixed with '%name'

Answer: Option A

Solution

Answer: Option A
Solution:
This SQL command is used to get information about the columns of a table.
Let's break down the command:
* SHOW COLUMNS FROM tbl_name: This part tells MySQL to display the column names of the table named 'tbl_name'.
* LIKE '%name': This part acts like a filter, specifying that we only want to see column names that end with 'name'. The '%' symbol is a wildcard in SQL, representing any number of characters.
Therefore, the correct answer is Option A: suffixed with 'name'.
This command will show only those column names that end with 'name'. For example, columns named 'first_name', 'last_name', or 'full_name' would be displayed.