SQLforGeeks
  • Home
  • SQL
  • SQL Tutorial
  • SQL Syntax
  • Our Services
Contact
  1. SQL
  2. Select database

Text copied!

« Previous
Next »

Select database

Dec. 14, 2022, 12:39 p.m. under SQL

  • Hi! You should check Rename database post first.

    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.

    To select SQL database, you can use the graphical user interface (GUI) or Transact-SQL (T-SQL).
    Here's an example of how to select database using T-SQL :

    As you can see in below image, [SQL Tutorial] is in use. Let's switch to [BI Tutorial].

    Select database

    1. Run below SQL command in SSMS :

    USE [BI Tutorial];
            

    2. Above command will switch to [BI Tutorial] from [SQL Tutorial] database.

    Select database

    That's it! You have successfully switched to [BI Tutorial] from [SQL Tutorial] database using T-SQL.

    Here's a step-by-step guide on how to select SQL database using GUI :

    1. Click on the "Available Databases" window in SSMS tool.

    Select database

    2. Choose the specific database and click on it.

    Select database

    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.

    Frequently Asked Questions :

    How do I SELECT a database in SQL?

    To SELECT a database in SQL, you use the "USE" statement followed by the database name.

    What does SELECT database () do in SQL?

    "SELECT DATABASE()" returns the currently selected database in SQL.

    How do I SELECT all databases in SQL?

    You can't directly SELECT all databases in SQL, but you can query system tables to list them.

    What are the 3 types of SELECT query in SQL?

    The three types of SELECT queries in SQL are SELECT, SELECT DISTINCT, and SELECT INTO.
    Thank You! You should check Database offline post next.
    « Previous
    Next »
    RELATED :

    What is SQL

    What is T-SQL

    Difference between DBMS and Data Warehouse

    Download SQL Server

    Install SQL Server

    Download SQL Server Management Studio SSMS

    SQL Server Management Studio

    SQL Database

    Download database

    Restore database

    Backup database

    Attach database

    Detach database

    Create database

    Delete database

    Rename database

    Database offline

    Database online

    SQL Commands

    SQL Tables

    Create table

    Truncate table

    Delete table

    Rename table

    Select table

    Alter table

    SQL Data Types

    SQL Comments

    SQL Constraints

    SQL Joins

    SQL inner join

    SQL left join

    SQL right join

    SQL full join

    SQL cross join

    SQL self join

    INSERT INTO SELECT statement

    INSERT INTO statement

    SQL Clauses

    SELECT clause

    FROM clause

    WHERE clause

    GROUP BY clause

    HAVING clause

    ORDER BY clause

    JOIN clause

    UNION clause

    UNION ALL clause

    TOP clause

    DISTINCT clause

    SQL Operators

    SQL Arithmetic operators

    SQL Comparison operators

    SQL Logical operators

    UNION operator

    UNION ALL operator

    INTERSECT operator

    EXCEPT operator

    LIKE operator

    NOT LIKE operator

    IN operator

    NOT IN operator

    IS NULL operator

    IS NOT NULL operator

    EXISTS operator

    NOT EXISTS operator

    BETWEEN operator

    NOT BETWEEN operator

    SQL Functions

    SQL Built-In functions

    CHARINDEX function

    DATEADD function

    CONCAT function

    LEN function

    REPLACE function

    SUBSTRING function

    CASE statement

    GETDATE function

    DATEPART function

    DATEDIFF function

    CAST function

    TRY_CAST function

    CONVERT function

    TRY_CONVERT function

    ISNULL function

    NULLIF function

    COALESCE function

    SQL Window functions

    ROW_NUMBER function

    RANK function

    DENSE_RANK function

    IIF function

    CHOOSE function

    SQL Store Procedure

    Store Procedure vs. Function

    SQL Subquery

    SQL Aliases

    Temp table

    SQL Error Handling

    SQL Variables

    SQL Views

    SQL Merge

    SQL CTE

    SQL WITH TIES

    Define Transaction in DBMS

    ACID properties in DBMS

    Types of Triggers in DBMS


    • Have Some Questions?
    logo

    Elevate your data experience with SQL excellence

    Quick Links
    •  Home
    •  SQL Tutorial
    •  SQL Syntax
    •  Our Services
    Our Services
    • Web Development
    • BI Development
    • Data Warehousing
    • Data Integration ETL


    Follow Us

    GST Registered: XXAXXXXXXXZX
    Mumbai, Maharashtra, India support@sqlforgeeks.com

    © 2025 Copyright™ | All Rights Reserved | Privacy Policy