Thursday, February 1, 2018

How To Drop Database In Mssql

Hello Friend Today In This Blog I Will Show You How To Drop Database In Mssql.The DROP DATABASE statement is used to drop an existing SQL database.DROP DATABASE returns the number of tables that were removed. This corresponds to the number of .frm files removed. The DROP DATABASE statementremoves from the given database directory those files and directories that MySQL itself may create during normal operation: All files with the following extensions.The SQL DROP DATABASE statement is used to drop an existing database in SQL schema.The DROP DATABASE Statement is used to drop or delete a database. Dropping of the database will drop all database objects (tables, views, procedures etc.) inside it. The user should have admin privileges for deleting a database.DROP is a powerful statement. A backup of data for a database to be deleted or drop is a the best quick cheap recovery solution. So be smart with this statement!To use DROP DATABASE, one needs to have the DROP privilege on the database.You can easily remove or delete indexes, tables and databases with the DROP statement.DROP DATABASE drops all tables in the database and deletes the database. Be very careful with this statement! To use DROP DATABASE, you need the DROP privilege on the database. DROP SCHEMA is a synonym for DROP DATABASE.IF EXISTS is used to prevent an error from occurring if the database does not exist.


If the default database is dropped, the default database is unset (the DATABASE() function returns NULL).If you use DROP DATABASE on a symbolically linked database, both the link and the original database are deleted.DROP DATABASE returns the number of tables that were removed. This corresponds to the number of .frm files removed.If other files or directories remain in the database directory after MySQL removes those just listed, the database directory cannot be removed. In this case, you must remove any remaining files or directories manually and issue the DROP DATABASE statement again.DROP DATABASE drops all tables in the database and deletes the database. Be very careful with this statement! To use DROP DATABASE, you need the DROP privilege on the database. DROP SCHEMA is a synonym for DROP DATABASE.SQL provides DROP DATABASE statement to allow you to remove existing databases. The SQL DROP DATABASE statement deletes all tables, views, triggers, and other related objects inside a database, and also removes the database permanently.Sometimes we may decide that we need to delete of an entire database in the RDBMS. In fact, if we cannot do so, we would be faced with a maintenance nightmare. Fortunately, SQL allows us to do it, as we can use the DROP DATABASE command. The DROP DATABASE statement is used for deleting a database and all of its tables completely.After dropping a database you can check the database list to cross verify that the database has been successfully dropped or not.Use the DROP DATABASE command to delete the target database and, if RMAN is connected to a recovery catalog, unregister it. RMAN removes all data files, online redo logs, and control files belonging to the target database. By default, RMAN prompts for confirmation.

Syntax

DROP DATABASE databasename;


Step 1 :Create database


Create database Employee



Step 2:Create table

Here In This step We Will Create table.

Here In This Step We Required Four Column With Name eids ,ename ,edept and esalary using Parameter bigint,varchar and float.

create table emp
(
eids bigint,
ename varchar(50),
edept varchar(50),
esalary float
);



Step 3 :Drop Database Using Database Name

DROP DATABASE Employee;


2 comments: