Database Programming With SQL Section 3 Quiz
Database Programming With SQL Section 3 Quiz
Section 3 Quiz
You must display the player name, team id, and salary for players whose salary is in the range from
25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be
sorted by team id from lowest to highest and then further sorted by salary from highest to lowest. Which
statement should you use to display the desired result?
This statement fails when executed. Which change will correct the problem?
4. The function COUNT is a single row function. True or False? Mark for Review
(1) Points
True
False (*)
1.
SELECT DISTINCT department_id DEPT, last_name, first_name
FROM employees
ORDER BY department_id;
2.
SELECT department_id DEPT, last_name, first_name
FROM employees
ORDER BY DEPT;
6. Which columns can be added to the ORDER BY clause in the following SELECT statement?
(Choose Three)
SELECT first_name, last_name, salary, hire_date
FROM employees
WHERE department_id = 50
ORDER BY ?????;
7. Which SELECT statement should you use to limit the display of product information to those
products with a price of less than 50? Mark for Review
(1) Points
Which operator is the equivalent of the OR conditions used in this SELECT statement?
IN (*)
AND
BETWEEN AND ...
LIKE
11. From left to right, what is the correct order of Precedence? Mark for Review
(1) Points
13. The ORDER BY clause always comes last. True or False? Mark for Review
(1) Points
True (*)
False
14. Which symbol in the WHERE clause means "Not Equal To"? (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
=+
<> (*)
><
NOT IN (..) (*)
15. Which comparison condition means "Less Than or Equal To"? Mark for Review
(1) Points
">="
"+<"
"<=" (*)
"=)"
This statement fails when executed. Which clause contains a syntax error?
2. Which of the following is true of the ORDER BY clause:? (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values
The rows will be sorted in reverse alphabetical order by the LAST_NAME values.
The rows will not be sorted.
The rows will be sorted alphabetically by the LAST_NAME values. (*)
5. Which columns can be added to the ORDER BY clause in the following SELECT statement?
(Choose Three)
SELECT first_name, last_name, salary, hire_date
FROM employees
WHERE department_id = 50
ORDER BY ?????;
True (*)
False
This statement fails when executed. Which change will correct the problem?
8. The conversion function TO_CHAR is a single row function. True or False? Mark for Review
(1) Points
True (*)
False
True
False (*)
10. The function COUNT is a single row function. True or False? Mark for Review
(1) Points
True
False (*)
11. Which of the following statements best describes the rules of precedence when using SQL? Mark
for Review
(1) Points
12. Which of the following best describes the meaning of the LIKE operator? Mark for Review
(1) Points
13. Which statement about the ORDER BY clause is true? Mark for Review
(1) Points
14. From left to right, what is the correct order of Precedence? Mark for Review
(1) Points
15. Find the clause that will give the same results as:
SELECT *
FROM d_cds
WHERE cd_id NOT IN(90, 91, 92);
True
False (*)
You want to display all players' names with position 6900 or greater.
You want the players names to be displayed alphabetically by last name and then by first name.
Which statement should you use to achieve the required results?
2.
SELECT department_id DEPT, last_name, first_name
FROM employees
ORDER BY DEPT;
True (*)
False
You must display the player name, team id, and salary for players whose salary is in the range from
25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be
sorted by team id from lowest to highest and then further sorted by salary from highest to lowest. Which
statement should you use to display the desired result?
6. Which statement about the ORDER BY clause is true? Mark for Review
(1) Points
The ORDER BY clause can only contain columns that are included in the SELECT list.
You can use a column alias in the ORDER BY clause. (*)
The default sort order of the ORDER BY clause is descending.
The ORDER BY clause should immediately precede the FROM clause in a SELECT statement
7. Which of the following best describes the meaning of the LIKE operator? Mark for Review
(1) Points
8. Which of the following are TRUE regarding the logical AND operator? Mark for Review
(1) Points
9. Which statement about the default sort order is true? Mark for Review
(1) Points
FROM employees
SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*)
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
12. Which of the following is true of the ORDER BY clause:? (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
13. A column alias can be specified in an ORDER BY Clause. True or False? Mark for Review
(1) Points
True (*)
False
15. You attempt to query the database with this SQL statement:
SELECT product_id "Product Number", category_id "Category", price "Price"
FROM products
WHERE "Category" = 5570
ORDER BY "Product Number";
This statement fails when executed. Which clause contains a syntax error?