Skip to Main Content
SQL in a Nutshell
book

SQL in a Nutshell

by Kevin Kline
December 2000
Intermediate to advanced content levelIntermediate to advanced
224 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from SQL in a Nutshell

Name

DROP DATABASE

Synopsis

DROP DATABASE undoes all the work done by the CREATE DATABASE command. It drops all existing database objects and releases the space used by them. With most vendors this command cannot be executed while users (including the owner) are active in the database.

Vendor

Command

SQL Server

Supported

MySQL

Supported

Oracle

Not supported

PostgreSQL

Supported

SQL99 Syntax and Description

DROP DATABASE database_name

Like CREATE DATABASE, DROP DATABASE is supported by ANSI SQL only as an extension and not as a core command. SQL99 prefers commands relating to SCHEMA and DOMAIN to cover areas that roughly correspond to what most implementations would consider “database” issues.

The system databases created by the database vendor should never be dropped. Dropping a database requires explicit permissions, unless performed by the database owner or the system administrator.

Microsoft SQL Server Syntax and Variations

DROP DATABASE database_name [,...n]

In SQL Server, multiple databases may be dropped in the same command by adding a comma between each database name. A database may be dropped only by a user in the master database, a user who has sys admin privileges, or the database owner. The database must be ONLINE to be dropped.

MySQL and PostgreSQL Syntax and Variations

In MySQL and PostgreSQL, this command removes an entire database and all associated files. The DB sends a message indicating how many files were deleted. A database that is open and in use under the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL in a Nutshell, 3rd Edition

SQL in a Nutshell, 3rd Edition

Kevin Kline

Publisher Resources

ISBN: 1565927443