ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

Which statement is valid if '`sampledb`' is a database and '`tbl`' is a table in it?

Answer & Solution
Correct Answer: Option B
This question is asking about the correct way to reference a table within a database in MySQL.

In MySQL, you use the following format to access a table:

`database_name`.`table_name`

Let's break down each option:

Option A: `SELECT * FROM `sampledb.member`
This is incorrect because it uses the wrong format. The database name and table name should be separated by a dot (`.`).

Option B: `SELECT * FROM `sampledb`.`member`
This is the correct way to reference the table 'member' in the database 'sampledb'.

Option C: `SELECT * FROM `member`.`sampledb`
This is incorrect because it references the database name as the table name and the table name as the database name.

Option D: `SELECT * FROM `member.sampledb`
This is incorrect for the same reason as Option A, the database name and table name should be separated by a dot (`.`).

Therefore, the correct answer is Option B.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.