SQL USE Database Statement - Use Database in SQL



Use Statement in SQL

  • USE statement is used to specify the database that you want to work with. It allows you to switch between different databases within your SQL Server instance.

Syntax

 USE database_name; 
  • Here, database_nameis the name of the database you want to switch to.

Use Statement Example

      USE  wikitechydatabase;

Output

use-1
  • Once you've executed the USE statement, all subsequent SQL statements you run will be executed in the context of the specified database. This means that any tables, views, stored procedures, or other database objects you reference in your SQL statements will be assumed to belong to the specified database.
  • If you want to switch to a different database, you can use the USE statement again with the name of the desired database. Keep in mind that permissions to access and use a particular database may be required, so ensure that you have the necessary permissions to access the database you want to switch to.

Related Searches to SQL USE Database Statement - Use Database in SQL