Which SQL statement is used to delete an existing database?
A
DELETE DATABASE dbname; B
DROP DATABASE dbname; C
REMOVE DATABASE dbname; D
DESTROY DATABASE dbname;
Analysis & Theory
DROP DATABASE dbname; is the correct syntax to delete a database.
What does the statement DROP DATABASE SalesDB; do?
A
Deletes all tables inside SalesDB but keeps the database B
Removes the SalesDB database and all its data permanently C
Clears all data but retains the database structure D
Archives the SalesDB database
Analysis & Theory
DROP DATABASE deletes the database and all contained objects.
Which clause can you use in some systems to avoid errors if the database does not exist?
A
IF NOT FOUND B
IF NOT EXISTS C
IF EXISTS D
IGNORE ERROR
Analysis & Theory
DROP DATABASE IF EXISTS dbname; avoids errors if the database is missing.
What happens if you try to drop a database that is currently in use?
A
The database is dropped without any warning B
You get an error because it is in use C
It creates a backup before dropping D
It ignores the request
Analysis & Theory
You cannot drop a database that is currently in use; an error is returned.
Which of the following is the correct syntax to drop a database named 'TestDB'?
A
DROP DATABASE 'TestDB'; B
REMOVE DATABASE TestDB; C
DELETE DATABASE TestDB; D
DROP DATABASE TestDB;
Analysis & Theory
DROP DATABASE TestDB; is the correct SQL syntax.
Which privilege is usually required to drop a database?
A
SELECT privilege B
DELETE privilege C
DROP privilege or CREATE/DROP DATABASE privilege D
INSERT privilege
Analysis & Theory
You must have DROP DATABASE privileges.
What is a risk of using DROP DATABASE?
A
It only removes user permissions B
It leaves all tables intact C
It permanently deletes all data in the database D
It can be undone easily
Analysis & Theory
DROP DATABASE permanently removes all data and cannot be undone.
Which of the following statements will safely remove 'SalesDB' only if it exists?
A
DROP DATABASE SalesDB IF EXISTS; B
DROP DATABASE IF EXISTS SalesDB; C
REMOVE DATABASE IF EXISTS SalesDB; D
DELETE DATABASE IF EXISTS SalesDB;
Analysis & Theory
DROP DATABASE IF EXISTS SalesDB; is the correct syntax (e.g., in MySQL).
If you need to delete a database and all its objects, which command should you use?
A
DELETE DATABASE B
DROP DATABASE C
REMOVE DATABASE D
CLEAR DATABASE
Analysis & Theory
DROP DATABASE removes the database and everything in it.
After dropping a database, what happens to the data?
A
It can be recovered automatically B
It is permanently lost unless you have backups C
It is stored in a temporary table D
It is archived to the system schema
Analysis & Theory
Data is permanently lost unless you have made backups.