Which statement is valid if '`sampledb`' is a database and '`tbl`' is a table in it?
A. SELECT * FROM `sampledb.member`
B. SELECT * FROM `sampledb`.`member`
C. SELECT * FROM `member`.`sampledb`
D. SELECT * FROM `member.sampledb`
Answer: Option B
Solution (By Examveda Team)
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.
Related Questions on MySQL Miscellaneous
How is communication established with MySQL?
A. SQL
B. Network calls
C. A programming language like C++
D. APIs
Which type of database management system is MySQL?
A. Object-oriented
B. Hierarchical
C. Relational
D. Network
Join The Discussion