Which SQL statement is used to create a new database?
A
CREATE DB mydb; B
NEW DATABASE mydb; C
CREATE DATABASE mydb; D
MAKE DATABASE mydb;
Analysis & Theory
The correct syntax is CREATE DATABASE database_name;
What does the following statement do?
CREATE DATABASE SalesDB;
A
Creates a table named SalesDB B
Creates a database named SalesDB C
Creates a user named SalesDB D
Creates a view named SalesDB
Analysis & Theory
It creates a new database named SalesDB.
Which clause can you use with CREATE DATABASE to avoid errors if the database already exists (in some systems like MySQL)?
A
IF NOT EXISTS B
ON ERROR IGNORE C
WHEN NOT EXISTS D
IGNORE IF EXISTS
Analysis & Theory
IF NOT EXISTS prevents an error if the database already exists.
What happens if you run CREATE DATABASE with the name of an existing database (without IF NOT EXISTS)?
A
It overwrites the database B
It ignores the statement C
It returns an error D
It renames the existing database
Analysis & Theory
It will return an error indicating the database already exists.
Which of the following is a valid SQL statement to create a database named 'Library'?
A
CREATE DATABASE Library; B
NEW DATABASE Library; C
ADD DATABASE Library; D
MAKE DATABASE Library;
Analysis & Theory
CREATE DATABASE Library; is the correct syntax.
After creating a database, what must you do to start working in it?
A
CREATE TABLE B
USE database_name C
SELECT database_name D
INIT DATABASE
Analysis & Theory
You must switch to it with USE database_name.
Which of the following statements will create a database called 'TestDB' only if it does not already exist?
A
CREATE DATABASE TestDB IF NOT EXISTS; B
CREATE DATABASE IF NOT EXISTS TestDB; C
IF NOT EXISTS CREATE DATABASE TestDB; D
CREATE IF NOT EXISTS DATABASE TestDB;
Analysis & Theory
In MySQL, CREATE DATABASE IF NOT EXISTS TestDB; is correct.
In SQL Server, which statement is correct to create a new database?
A
CREATE DATABASE db_name; B
NEW DATABASE db_name; C
CREATE DB db_name; D
INIT DATABASE db_name;
Analysis & Theory
SQL Server uses CREATE DATABASE db_name; syntax.
What privilege must a user have to create a database?
A
INSERT privilege B
CREATE DATABASE privilege C
UPDATE privilege D
SELECT privilege
Analysis & Theory
A user needs CREATE DATABASE or similar administrative privilege.
Which of the following statements is true about CREATE DATABASE?
A
It creates a table inside the database B
It creates a new empty database container C
It automatically creates a default table D
It adds data to an existing database
Analysis & Theory
CREATE DATABASE just creates an empty database.