Chapter 3
The ELSE clause in a CASE statement is _____. Illegal Required Recommended Unimportant
Recommended
Oracle, DB2, and MySQL are examples of what type of database? Knowledge-based Relational Hierarchical Online
Relational
Given a table called Employees with a field called Last Name, using SQL, how would you select all the records with the last name 'Jones'? SELECT * FROM Employees WHERE Last Name = 'Jones' FROM Employees SELECT * WHERE Last Name = 'Jones' SELECT * FROM Employees WHERE Last Name <> 'Jones' FROM Employees SELECT all WHERE Last Name = 'Jones'
SELECT * FROM Employees WHERE Last Name = 'Jones'
Write a SELECT SQL statement to retrieve records for which the FirstName starts with the letter 'C', the LastName contains the letter 'o', is between the age of 40 and 43, and is Female. SELECT * from Actors WHERE FirstName like 'C%' and LastName like '%o%' and Sex = 'Female' and Age BETWEEN '40' and '43' SELECT * from Actors WHERE FirstName like 'C%' and LastName like '%o%' and Sex = 'Female' and Age IN '40' and '43' SELECT * from Actors WHERE FirstName like '%C%' and LastName like '%o%' and Sex = 'Female' and Age BETWEEN '40' and '43' SELECT * from Actors WHERE FirstName like 'C%' and LastName = 'o' and Sex = 'Female' and Age BETWEEN '40' and '43'
SELECT * from Actors WHERE FirstName like 'C%' and LastName like '%o%' and Sex = 'Female' and Age BETWEEN '40' and '43'
You can insert multiple rows into the table by adding _____ to the INSERT statement. DELETE ... FROM ... WHERE WHERE ... FROM ... UPDATE SELECT ... FROM ... WHERE UPDATE ... FROM ... WHERE
SELECT ... FROM ... WHERE
Which of the following statements below show an SQL Statement that uses the GROUP BY clause correctly? SELECT AuthorFirstName, AuthorLastName FROM Author GROUP BY Book.AuthorFirstName ORDER BY COUNT(AuthorFirstName) LIMIT 5; SELECT AuthorFirstName, AuthorLastName FROM Author COUNT *, ORDER BY Author ASC (SELECT ((GROUP COUNT(AuthorFirstName)) LIMIT 5; SELECT AuthorFirstName, AuthorLastName FROM Author GROUP BY AuthorFirstName, AuthorLastName ORDER BY COUNT(AuthorFirstName) LIMIT 5; SELECT GROUP AuthorFirstName, AuthorLastName FROM Author ORDER BY AuthorFirstName ORDER BY COUNT(AuthorFirstName) LIMIT 5;
SELECT AuthorFirstName, AuthorLastName FROM Author GROUP BY AuthorFirstName, AuthorLastName ORDER BY COUNT(AuthorFirstName) LIMIT 5;
Which statement correctly displays 99999 for NULL Zip Codes in the Customer_Contact table? SELECT NVL(ZipCode, 99999) FROM Customer_Contact; INSERT INTO Customer_Contact (NVL, 9999); NVL(ZipCode, 99999); SELECT NVL(ZipCode) FROM Customer_Contact TO 99999;
SELECT NVL(ZipCode, 99999) FROM Customer_Contact;
Which is the correct syntax for replacing a blank customer SSN with 555-55-5555? SELECT customerName, ISNULL(SSN, '555-55-5555') FROM tblCustomer; SELECT customerName, ISNULL('555-55-5555') FROM tblCustomer; SELECT ISNULL (customerName), (SSN, '555-55-5555') FROM tblCustomer; SELECT customerName, NULL(SSN, '555-55-5555') FROM tblCustomer;
SELECT customerName, ISNULL(SSN, '555-55-5555') FROM tblCustomer;
Using ISNULL to replace a NULL value with another value is used mainly in _____. Oracle MySQL Python SQL Server
SQL Server
NVL can be used with the following data types: Numeric String or Numeric String BLOB
String or Numeric
NVL is a function used for _____ Deleting data Substitution Updating database structure Interfacing data
Substitution
Which term below refers to strict structural patterns when related to SQL? Relationship Standard Query Language Syntax Database
Syntax
In order to ensure a NULL inside a numeric field is replaced with a string, you use the _____ keyword CHAR() CONVERT_CHAR TOSTR TO_CHAR
TO_CHAR
In what scenario would you want to use the UPPER function in SQL? All text is numeric You need to convert the data to date format The text values might be mixed-case All text is unreadable or mis-aligned
The text values might be mixed-case
The SQL statement clause that is used to identify the criteria to be matched for inclusion in the results is the _____ clause. SELECT FROM ORDER BY WHERE
WHERE
What notation must be used to end a GROUP BY clause or any SQL statement? the semicolon the exclamation sign the period The ORDER BY clause
the semicolon
Which SQL function can be used when you want to get results on how many days have passed after the dates in the field, such as in a billing cycle? YEAR CURDATE DATEDIFF All of the provided answers can be used.
CURDATE
In an SQL SELECT statement, what character is used as a delimiter between fields? Period (.) Dash (-) Interrogative (?) Comma (,)
Comma (,)
INSERT is part of a categorization of SQL statements called _____. Java Data Manipulation Language (DML) Data Definition Language (DDL) C++
Data Manipulation Language (DML)
The SQL clause used to identify the table or tables containing the target data is the _____ clause. ORDER BY FROM SELECT WHERE
FROM
Which statement will correctly insert a new record into the genre table? UPDATE genre SET genre = 'Rock'; INSERT Rock INTO genre INSERT INTO genre (genre) VALUES ('Rock'); INSERT INTO genre ('Rock');
INSERT INTO genre (genre) VALUES ('Rock');
How many columns can be used to sort the data in an ORDER BY clause? One or more columns, but all in either ASC or DESC order Minimum of two or more columns One or more columns, with each one in either ASC or DESC order Only one column, in either ASC or DESC order
One or more columns, with each one in either ASC or DESC order
If a field allows blank or NULL values, it is _____ to specify it in the INSERT statement. Required if character Required Optional Required if numeric
Optional
NVL can be used in the following databases: SQL Server MySQL All answers are correct Oracle
Oracle
It's best to use ISNULL for mathematical operations because: It keeps data consistent It is more efficient It updates the data behind the scenes Performing them on a NULL value can cause errors
Performing them on a NULL value can cause errors