The "USE" command is a powerful tool that allows to switch to a specific database in order to use it to perform operations in SQL. You can easily navigate to a particular database instance within your SQL environment.
In simple words, A single SQL instance can have multiple databases and to access data from a specific database, you first need to select it using the "USE" command. This allows you to switch to the desired database and perform operations such as querying, modifying, or updating the data contained within it.
As you can see in below image, [SQL Tutorial] is in use. Let's switch to [BI Tutorial].
1. Run below SQL command in SSMS :
USE [BI Tutorial];
2. Above command will switch to [BI Tutorial] from [SQL Tutorial] database.
That's it! You have successfully switched to [BI Tutorial] from [SQL Tutorial] database using T-SQL.
1. Click on the "Available Databases" window in SSMS tool.
2. Choose the specific database and click on it.
3. There you go, You have selected [BI Tutorial] database successfully.
That's it! You have successfully switched to [BI Tutorial] from [SQL Tutorial] database using GUI.
To SELECT a database in SQL, you use the "USE" statement followed by the database name.
"SELECT DATABASE()" returns the currently selected database in SQL.
You can't directly SELECT all databases in SQL, but you can query system tables to list them.
The three types of SELECT queries in SQL are SELECT, SELECT DISTINCT, and SELECT INTO.