SQLforGeeks
  • Home
  • SQL
  • SQL Tutorial
  • SQL Syntax
  • Services
  • Product
    🏋️ GyManage 📱 More to come
Contact
  1. SQL
  2. Delete database

Text copied!

« Previous
Next »

Delete database

Dec. 12, 2022, 11:18 a.m. under SQL

  • Hi! You should check Create database post first.

    Deleting SQL database refers to the process of deleting/removing the entire database permanently from the database server and it can not be undone. "DROP DATABASE" command is used to remove the database.

    You will not be able to retrieve the date unless you have a backup. Be careful before you delete a database, please make sure you have perform a backup of the important data.

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

    As you can see in below image, [BI Tutorial] database is present. Let's delete it!

    Delete database

    1. Run below SQL command in SSMS :

    USE [master]; 
    
    DROP DATABASE [BI Tutorial];
            
    Delete database

    2. Above command will delete [BI Tutorial] from SQL Server database instance.

    Delete database

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

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

    1. Right-click on the database you want to delete in "Database folder" >> Select "Delete".

    Delete database

    2. "Delete Object" dialog box will appear, review the database name >> Select the checkbox "Close existing connections", this will close active connections before deleting the database >> Click "OK" button.

    Delete database

    3. There you go, [BI Tutorial] database deleted successfully.

    Delete database

    That's it! You have successfully deleted [BI Tutorial] database using GUI.

    Frequently Asked Questions :

    How do I DELETE a SQL database?

    Use the "DROP DATABASE" command in SQL to delete a SQL database.

    Which command is used to delete a database in SQL?

    The command used to delete a database in SQL varies depending on the database management system, but for SQL Server, it's typically "DROP DATABASE [database_name];" and for MySQL, it's "DROP DATABASE [database_name];"

    Which command is used to delete a database in SQL?

    The command "DROP DATABASE" is used to delete a database in SQL.

    What is the SQL query for DELETE?

    The SQL query for deleting data is "DELETE FROM <table_name> WHERE <condition>;" for deleting records or "DROP DATABASE <database_name>;" for deleting an entire database.
    Thank You! You should check Rename database 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

    Rename database

    Select 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

    © 2024 Copyright | All Rights Reserved | Legal