Test your knowledge of SQL
Posted on
October 10, 2017
by
How much do you know about SQL and how it is used? Let's find out!

There are some things that you just don’t forget. For me, one of those was the thought I had the first time I was exposed to SQL: “This is supposed to better than what we have now?” To say that I was overwhelmed is to put it kindly. Particularly in light of the fact that what we previously had was just a bunch of cobbled together sed batch files that were very limited in what they could do.

Those who know how to work with SQL (or Structured Query Language) well can do amazing things — find and manipulate data quickly, and return only the results that matter. Those who don’t know how to work with SQL well often struggle and/or turn to someone else for help.

What follows is a self-test of 25 questions based on various levels of SQL difficulty but not centered around any one certification. The answers appear at the end of the questions. In all cases, pick the best answer(s) to each question. Good luck!

1. There are various ways to identify the current date and time based on which implementation of SQL you are using. Which of the following is the equivalent of GETDATE in MySQL?
A. CURRENTLY
B. TODAY
C. CURRENT_DATE
D. NOW

2. Objects that can be created and manipulated with SQL and include objects such as indexes, packages, and sequences – among others – are known as a(n):
A. Schema
B. Collection
C. Compilation
D. Set

3. Different implementations of SQL (Microsoft SQL Server vs. MySQL, for example), treat column names that include embedded spaces (such as “Employee Number”) differently. Which of the following is correct for Microsoft SQL Server?
A. SELECT *Employee Number* FROM Payroll
B. SELECT {Employee Number} FROM Payroll
C. SELECT [Employee Number] FROM Payroll
D. SELECT (Employee Number) FROM Payroll

4. While doing an ALTER TABLE operation, which command can you use to change the datatype, size, default value, and NOT NULL column constraint?
A. ADJUST
B. MODIFY
C. REVISE
D. AMEND

5. Which directive is used to remove a table and all its data from the database?
A. DROP TABLE
B. CLEAR TABLE
C. REMOVE TABLE
D. DELETE TABLE

6. When you create a [Fill in the blank], you can define its initial value and the increment between its values.
A. Function
B. Schema
C. Sequence
D. Condition

7. Within SQL, the LEFT function requires two arguments. They are:
A. CharacterValue, NumberOfCharacters
B. StartingPosition, NumberOfCharacters
C. NumberOfCharacters, StartingPosition
D. NumberOfCharacters, CharacterValue

8. As of MySQL 5.7.8, MySQL supports a native data type that enables access to data in JavaScript Object Notation documents. Which of the following is that data type?
A. JN
B. JON
C. JSON
D. JXON

9. Which command can be used to remove all rows from a table or from a cluster?
A. ELIMINATE
B. TRUNCATE
C. DETACH
D. DISCONNECT

10. Within SQL, the command “ … FROM Employees ORDER BY Name” will sort the results in what order?
A. Ascending
B. Descending
C. Numeric
D. Case

11. With Oracle SQL, what is the maximum number of primary keys a table can have?
A. One
B. Two
C. Three
D. More than three

12. Within SQL, which character/symbol is used as a multiplication operator (for example, multiplying a purchase amount by a percentage to ascertain sales tax)?
A. x
B. *
C. ++
D. M
E. m
F. #

13. You are wanting to use a CASE expression in Oracle SQL to add If-Then-type logic without having to invoke a lot of separate procedures. The maximum number of arguments in a CASE expression is limited to:
A. 16
B. 256
C. 512
D. 65535

14. Which of the following creates a view only if the base tables exist and the owner of the schema containing the view has privileges?
A. DEF
B. IMPOSE
C. NOFORCE
D. CONSTRAIN

15. Many versions of SQL have an ISNULL function. In MySQL, this functionality exists but the function is called:
A. NOTNULL
B. IFNULL
C. NOT
D. IFNOT

Please visit GoCertify to attempt the remaining 10 questions of this quiz.

ANSWERS

1. D
2. A
3. C
4. B
5. A
6. C
7. A
8. C
9. B
10. A
11. A
12. B
13. D
14. C
15. B

About the Author

Emmett Dulaney is a professor at Anderson University and the author of several books including Linux All-in-One For Dummies and the CompTIA Network+ N10-008 Exam Cram, Seventh Edition.

Posted to topic:
Certification

Important Update: We have updated our Privacy Policy to comply with the California Consumer Privacy Act (CCPA)

CompTIA IT Project Management - Project+ - Advance Your IT Career by adding IT Project Manager to your resume - Learn More