Google News
logo
SQL - Quiz(MCQ)
1 .
Which of the following SQL statements will generate an error when executed.
A)
CREATE DATABASE students
B)
CREATE DATABASE students;
C)
create database if not exists students
D)
IF NOT EXISTS CREATE DATABASE `STUDENTS`;

Correct Answer : Option (D) :  

IF NOT EXISTS CREATE DATABASE `STUDENTS`;

2 .
Which of the following scripts will run successfully?
A)
SELECT `customer name` FROM customers WHERE cat_id = 12 ORDER BY cat_id;
B)
SELECT `customer name` FROM customers ORDER BY zone WHERE cat_id = 12;
C)
SELECT FROM `customers` 'customer name';
D)
SELECT customer name FROM customers;

Correct Answer : Option (A) :  

SELECT `customer name` FROM customers WHERE cat_id = 12 ORDER BY cat_id;

3 .
The SQL WHERE clause:
A)
limits the column data that are returned.
B)
limits the row data are returned.
C)
Both A and B are correct.
D)
None of the above

Correct Answer : Option (B) :   limits the row data are returned.

4 .
Which of the following is the original purpose of SQL?
A)
To specify the syntax and semantics of SQL data definition language
B)
To specify the syntax and semantics of SQL manipulation language
C)
To define the data structures
D)
All of the above.

Correct Answer : Option (D) :   All of the above.

5 .
The wildcard in a WHERE clause is useful when?
A)
An exact match is necessary in a SELECT statement.
B)
An exact match is not possible in a SELECT statement.
C)
An exact match is necessary in a CREATE statement.
D)
An exact match is not possible in a CREATE statement.

Correct Answer : Option (B) :   An exact match is not possible in a SELECT statement.

6 .
What type of join is needed when you wish to include rows that do not have matching values?
A)
Equi-join
B)
Natural join
C)
Outer join
D)
All of the above

Correct Answer : Option (C) :   Outer join

7 .
What type of join is needed when you wish to return rows that do have matching values?
A)
Equi-join
B)
Natural join
C)
Outer join
D)
All of the above.

Correct Answer : Option (D) :   All of the above.

8 .
Which of the following is true concerning a procedure?
A)
You do not create them with SQL.
B)
They do not need to have a unique name.
C)
They include procedural and SQL statements.
D)
They are the same thing as a function.

Correct Answer : Option (C) :   They include procedural and SQL statements.

9 .
A CASE SQL statement is which of the following?
A)
A way to establish an IF-THEN-ELSE in SQL.
B)
A way to establish a data definition in SQL.
C)
A way to establish a loop in SQL.
D)
All of the above.

Correct Answer : Option (A) :   A way to establish an IF-THEN-ELSE in SQL.

10 .
Which of the following statements is true concerning routines and triggers?
A)
Both consist of procedural code.
B)
Both have to be called to operate.
C)
Both are stored in the database.
D)
Both run automatically.

Correct Answer : Option (A) :   Both consist of procedural code.