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

Suppose you want to select a database named 'sampledb' as the default database. Which of the following commands do you use?

Answer & Solution
Correct Answer: Option D
This question is about how to tell MySQL which database you want to work with. Imagine you have multiple folders on your computer, and you want to work in a specific folder. In MySQL, you have different databases, and you need to choose the one you want to use.

The command to do this is USE. So the correct answer is Option D: USE sampledb.

Let's break down the options:
* Option A: SELECT DATABASE() This command will tell you the currently selected database, but it won't change it.
* Option B: SELECT DATABASE sampledb This is incorrect syntax, and it wouldn't work.
* Option C: USE DATABASE sampledb This is close, but the DATABASE keyword is unnecessary.
* Option D: USE sampledb This is the correct way to switch to the 'sampledb' database.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.