Vidyalelo
MySQL · Q287

MySQL

Programming · MySQL · question 287

Q287

Which of the following is an illegal unquoted identifier name?

A.
123_id
B.
123id
C.
id1
D.
123
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
This question asks about identifier names in MySQL. An identifier is a name used to refer to things like tables, columns, and databases.

In MySQL, identifier names follow specific rules. Here are the key points:

* Start with a letter or an underscore (_): Identifiers must begin with a letter (a-z, A-Z) or an underscore (_).
* Can contain letters, numbers, and underscores: After the first character, identifiers can include letters, numbers, and underscores.
* Case-insensitive: MySQL treats uppercase and lowercase letters the same.

Let's analyze the options:

Option A: 123_id - This is valid. It starts with a number but uses an underscore as the first character, which is allowed.
Option B: 123id - This is valid. It starts with a number, but the rest of the name follows the rules.
Option C: id1 - This is valid. It starts with a letter and follows the rules.
Option D: 123 - This is invalid. It starts with a number, and numbers are not allowed as the first character of an identifier.

Therefore, the correct answer is Option D: 123.