SQL -Structured Query Language - SQL Database - Use / Select Database Tutorial
To use or select a different SQL database, then we can use a ' USE ' statement.
With this, we can write any other query, which will get executed in the selected database.
Syntax-
The basic syntax of the USE statement is given below –
USE DatabaseName;
For example-
If we want to use the database employees.
Then use the following syntax-
USE employees;
You can try all examples in MySQL workbench.
Click here to install MySQL workbench.
- Open a query editor mark on the left side.
- Write a basic query such as ' use employees '
- Click on execute (power symbol)
It will use a database of employees.
( With this you can write any other query, which will get executed in the employees database )
If the output shows a green mark then it is executed successfully.
If it still not showing click on refresh, marked in an image.