1. A column alias can be specifified in an ORDER BY Clause. True or False?
True (*)
2. Evaluate this SELECT statement:
SELECT last_name, fifirst_name, salary
FROM employees;
How will the results of this query be sorted?
The database will display the rows in whatever order it fifinds it in the database, so no particular
order. (*)
3. Evaluate this SELECT statement:
SELECT last_name, fifirst_name, department_id, manager_id
FROM employees;
You need to sort data by manager id values and then alphabetically by employee last name and fifirst
name values. Which ORDER BY clause could you use?
ORDER BY manager_id, last_name, fifirst_name (*)
4. 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?
WHERE "Category" = 5570 (*)
5. Which SELECT statement should you use to limit the display of product information to those
products with a price of less than 50?
SELECT product_id, product_name
FROM products
WHERE price < 50;
(*)
6. The following statement represents a multi-row function. True or False?
SELECT UPPER(last_name)
FROM employees;
False (*)
7. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
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?
SELECT last_name, fifirst_name, team_id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary DESC;
(*)
8. The following statement represents a multi-row function. True or False?
SELECT MAX(salary)
FROM employees
True (*)
9. Evaluate this SQL statement:
SELECT e.employee_id, e.last_name, e.fifirst_name, m.manager_id
FROM employees e, employees m
ORDER BY e.last_name, e.fifirst_name
WHERE e.employee_id = m.manager_id;
This statement fails when executed. Which change will correct the problem?
Reorder the clauses in the query. (*)
10. Will the following statement return one row?
SELECT MAX(salary), MIN(Salary), AVG(SALARY)
FROM employees;
Yes, it will return the highest salary, the lowest salary, and the average salary from all employees. (*)
11. Which of the following is earliest in the rules of precedence?
Arithmetic operator (*)
12. Which statement about the logical operators is true?
The order of operator precedence is NOT, AND, and OR. (*)
13. Which comparison condition means "Less Than or Equal To"?
"<=" (*)
14. What will be the results of the following selection?
SELECT *
FROM employees
WHERE last_name NOT LIKE 'A%' AND last_name NOT LIKE 'B%'
All last names that do not begin with A or B (*)
15. Which of the following statements best describes the rules of precedence when using SQL?
The order in which the expressions are evaluated and calculated (*)
1. The following statement represents a multi-row function. True
or False?
(
)SELECT UPPER(last_ name)
FROM employees;
Mark for Review
(1) Points
True
False (*)
Correct Correct
2. Will the following statement return one row?
SELECT MAX(salary), MIN(Salary), AVG(SALARY)
FROM employees;
Mark for Review
(1) Points
No, it is illegal. You cannot use more than one multi-row function in
a SELECT statement.
Yes, it will return the average salary from the employees table.
Yes, it will return the highest salary from each employee.
Yes, it will return the highest salary, the lowest salary, and the
average salary from all employees. (*)
Correct Correct
3. The conversion function TO CHAR is a single row function. True_
g
or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
4. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_ NAME VARCHAR2 (20)
FIRST_ NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ ID NUMBER(4)
MANAGER_ ID NUMBER(9)
POSITION_ ID NUMBER(4)
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?
Mark for Review
(1) Points
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id, salary DESC;
(*)
SELECT l
fifi
id
lSELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id DESC, salary DESC;
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id ASC, salary DESC;
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id, salary;
Correct Correct.
5. Evaluate this SQL statement:
SELECT e.employee_ id, e.last_ name, e.fifirst_ name, m.manager_ id
FROM employees e, employees m
ORDER BY e.last_ name, e.fifirst_ name
WHERE e.employee_ id = m.manager_ id;
This statement fails when executed. Which change will correct the
problem?
Mark for Review
(1) Points
Reorder the clauses in the query. (*)
Remove the table aliases in the ORDER BY clause.Include a HAVING clause.
Remove the table aliases in the WHERE clause.
Correct Correct.
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
6. Evaluate this SQL statement:
SELECT product_ id, product_ name, price
FROM products
ORDER BY product_ name, price;
What occurs when the statement is executed?
Mark for Review
(1) Points
The results are sorted alphabetically and then numerically. (*)
The results are sorted numerically and then alphabetically.
The results are sorted alphabetically only.
The results are sorted numerically only.
Correct Correct7. What value will the following SQL statement return?
SELECT employee_ id
FROM employees
WHERE employee_ id BETWEEN 100 AND 150
OR employee_ id IN(119, 175, 205)
AND (employee_ id BETWEEN 150 AND 200);
Mark for Review
(1) Points
200, 201, 202, 203, 204, 205, 206
No rows will be returned
19
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
Correct Correct
8. 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?
Mark for Review
(1) Points
ORDER BY "Product Number";WHERE "Category" = 5570 (*)
FROM products
SELECT product_ id "Product Number", category_ id "Category", price
"price"
Correct Correct
9. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, department_ id, manager_ id
FROM employees;
You need to sort data by manager id values and then alphabetically
by employee last name and fifirst name values. Which ORDER BY
clause could you use?
Mark for Review
(1) Points
ORDER BY manager_ id, last_ name, fifirst_ name (*)
ORDER BY last_ name, fifirst_ name, manager_ id
ORDER BY department_ id, last_ name
ORDER BY manager_ id, fifirst_ name, last_ name
Correct Correct.
10. Evaluate this SELECT statement:
SELECT employee id last name fifirst name salary 'Yearly Salary'SELECT employee_ id, last_ name, fifirst_ name, salary Yearly Salary
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_ name, 3;
Which clause contains an error?
Mark for Review
(1) Points
FROM employees
SELECT employee_ id, last_ name, fifirst_ name, salary 'Yearly Salary'
(*)
WHERE salary IS NOT NULL
ORDER BY last_ name, 3;
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
11. Which logical operator returns TRUE if either condition is true?
Mark for Review
(1) Points
NOT
ANDOR (*)
BOTH
Correct Correct
12. Which of the following best describes the meaning of the LIKE
operator? Mark for Review
(1) Points
To fifind Null values.
Display rows based on a range of values.
Match a character pattern. (*)
To test for values in a list.
Correct Correct
13. Which of the following are TRUE regarding the logical AND
operator? Mark for Review
(1) Points
TRUE AND FALSE return TRUE
FALSE AND TRUE return NULLTRUE AND TRUE return FALSE
TRUE AND FALSE return FALSE (*)
Correct Correct
14. Which clause would you include in a SELECT statement to sort
the rows returned by the LAST_ NAME column? Mark for Review
(1) Points
FROM
WHERE
ORDER BY (*)
HAVING
Correct Correct
15. What will be the results of the following selection?
SELECT *
FROM employees
WHERE last_ name NOT LIKE 'A%' AND last_ name NOT LIKE 'B%'
Mark for Review
(1) Points
All last names that begin with A or BNo rows will be returned. There is a syntax error
All last names that do not begin with A or B (*)
All rows will be returned
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
1. Which of the following best describes the meaning of the LIKE
operator? Mark for Review
(1) Points
To test for values in a list.
To fifind Null values.
Match a character pattern. (*)
Display rows based on a range of values.
Correct Correct
2. What will be the results of the following selection?
SELECT *
FROM employeesFROM employees
WHERE last_ name NOT LIKE 'A%' AND last_ name NOT LIKE 'B%'
Mark for Review
(1) Points
All last names that do not begin with A or B (*)
All last names that begin with A or B
All rows will be returned
No rows will be returned. There is a syntax error
Correct Correct
3. Which of the following would be returned by this SQL statement:
SELECT First_ name, last_ name, department_ id
FROM employees
WHERE department_ id IN(50,80)
AND fifirst_ name LIKE ' C% '
OR last_ name LIKE ' %s% '
Mark for Review
(1) Points
FIRST_ NAME LAST_ NAME DEPARTMENT_ ID
Shelly Higgins 110
FIRST_ NAME LAST_ NAME DEPARTMENT_ ID
Curtis Davies 50FIRST_ NAME LAST_ NAME DEPARTMENT_ ID
Randall Matos 50
FIRST_ NAME LAST_ NAME DEPARTMENT_ ID
Michael Hartstein 20
All of the above (*)
Correct Correct
4. Which clause would you include in a SELECT statement to sort
the rows returned by the LAST_ NAME column? Mark for Review
(1) Points
FROM
WHERE
ORDER BY (*)
HAVING
Correct Correct
5. Which statement about the ORDER BY clause is true? Mark for
Review
(1) Points
The ORDER BY clause should immediately precede the FROM clauseThe ORDER BY clause should immediately precede the FROM clause
in a SELECT statement
You can use a column alias in the ORDER BY clause. (*)
The ORDER BY clause can only contain columns that are included in
the SELECT list.
The default sort order of the ORDER BY clause is descending.
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
6. The following statement represents a multi-row function. True
or False?
SELECT UPPER(last_ name)
FROM employees;
Mark for Review
(1) Points
True
False (*)
Correct Correct
ll h f ll7. Will the following statement return one row?
SELECT MAX(salary), MIN(Salary), AVG(SALARY)
FROM employees;
Mark for Review
(1) Points
Yes, it will return the highest salary, the lowest salary, and the
average salary from all employees. (*)
Yes, it will return the highest salary from each employee.
Yes, it will return the average salary from the employees table.
No, it is illegal. You cannot use more than one multi-row function in
a SELECT statement.
Correct Correct
8. The following statement represents a multi-row function. True
or False?
SELECT MAX(salary)
FROM employees
Mark for Review
(1) Points
True (*)
False
Correct Correct9. The conversion function TO_CHAR is a single row function. True
or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_ NAME VARCHAR2 (20)
FIRST_ NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ ID NUMBER(4)
MANAGER_ ID NUMBER(9)
POSITION_ ID NUMBER(4)
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 fifirst name.
Which statement should you use to achieve the required results?
Mark for Review
(1) Points
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id >= 6900
ORDER BY last_ name, fifirst_ name;
(*)
SELECT last_ name, fifirst_ name
FROM lFROM players
WHERE position_ id >= 6900
ORDER BY last_ name DESC, fifirst_ name;
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id > 6900
ORDER BY last_ name, fifirst_ name;
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id <= 6900
ORDER BY last_ name, fifirst_ name;
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
11. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, email
FROM employees
ORDER BY email;
If the EMAIL column contains null values, which statement is true?
Mark for Review
(1) Points
Null email values will be displayed last in the result. (*)
The result will not be sorted.Null email values will not be displayed in the result.
Null email values will be displayed fifirst in the result.
Correct Correct.
12. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, department_ id, manager_ id
FROM employees;
You need to sort data by manager id values and then alphabetically
by employee last name and fifirst name values. Which ORDER BY
clause could you use?
Mark for Review
(1) Points
ORDER BY last_ name, fifirst_ name, manager_ id
ORDER BY department_ id, last_ name
ORDER BY manager_ id, last_ name, fifirst_ name (*)
ORDER BY manager_ id, fifirst_ name, last_ name
Correct Correct
13. A column alias can be specifified in an ORDER BY Clause. True or
False? Mark for Review
(1) PointsTrue (*)
False
Correct Correct
14. Which of the following is true of the ORDER BY clause:?
(Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
Defaults to a descending order (DESC)
Displays the fetched rows in no particular order
Must be the last clause of the SQL statement (*)
Defaults to an ascending order (ASC) (*)
Correct Correct
15. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, salary
FROM employees;
How will the results of this query be sorted?
Mark for Review
(1) PointsThe results will be sorted ascending by the LAST_ NAME column
only.
The database will display the rows in whatever order it fifinds it in the
database, so no particular order. (*)
The results will be sorted ascending by LAST_ NAME, FIRST_ NAME,
and SALARY.
The results will be sorted ascending by LAST_ NAME and
FIRST_ NAME only.
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
1. You query the database with this SQL statement:
SELECT price
FROM products
WHERE price IN(1, 25, 50, 250)
AND (price BETWEEN 25 AND 40 OR price > 50);
Which two values could the statement return? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
501
250 (*)
10
25 (*)
Correct Correct
2. What value will the following SQL statement return?
SELECT employee_ id
FROM employees
WHERE employee_ id BETWEEN 100 AND 150
OR employee_ id IN(119, 175, 205)
AND (employee_ id BETWEEN 150 AND 200);
Mark for Review
(1) Points
19
No rows will be returned
200, 201, 202, 203, 204, 205, 206
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
Correct Correct
3. Evaluate this SELECT statement:SELECT last_ name, fifirst_ name, department_ id, manager_ id
FROM employees;
You need to sort data by manager id values and then alphabetically
by employee last name and fifirst name values. Which ORDER BY
clause could you use?
Mark for Review
(1) Points
ORDER BY department_ id, last_ name
ORDER BY last_ name, fifirst_ name, manager_ id
ORDER BY manager_ id, fifirst_ name, last_ name
ORDER BY manager_ id, last_ name, fifirst_ name (*)
Correct Correct
4. What clause must you place in a SQL statement to have your
results sorted from highest to lowest salary? Mark for Review
(1) Points
None, the database always sorts from highest to lowest on the
salary column.
ORDER BY salary DESC (*)
ORDER BY salary ASC
ORDER salary BY DESCCorrect Correct
5. Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_ id = 34
OR department_ id = 45
OR department_ id = 67;
Which operator is the equivalent of the OR conditions used in this
SELECT statement?
Mark for Review
(1) Points
LIKE
AND
BETWEEN AND ...
IN (*)
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
6. The following statement represents a multi-row function. Trueor False?
SELECT UPPER(last_ name)
FROM employees;
Mark for Review
(1) Points
True
False (*)
Correct Correct
7. Will the following statement return one row?
SELECT MAX(salary), MIN(Salary), AVG(SALARY)
FROM employees;
Mark for Review
(1) Points
Yes, it will return the average salary from the employees table.
Yes, it will return the highest salary, the lowest salary, and the
average salary from all employees. (*)
No, it is illegal. You cannot use more than one multi-row function in
a SELECT statement.
Yes, it will return the highest salary from each employee.
Correct Correct8. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_ NAME VARCHAR2 (20)
FIRST_ NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ ID NUMBER(4)
MANAGER_ ID NUMBER(9)
POSITION_ ID NUMBER(4)
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?
Mark for Review
(1) Points
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id ASC, salary DESC;
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id, salary DESC;
(*)
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id DESC, salary DESC;SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id, salary;
Correct Correct
9. The function COUNT is a single row function. True or False?
Mark for Review
(1) Points
True
False (*)
Correct Correct
10. The following statement represents a multi-row function. True
or False?
SELECT MAX(salary)
FROM employees
Mark for Review
(1) Points
True (*)
False
Correct CorrectTest: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
11. Which of the following is earliest in the rules of precedence?
Mark for Review
(1) Points
Concatenation operator
Logical condition
Comparison condition
Arithmetic operator (*)
Correct Correct
12. Which of the following best describes the meaning of the LIKE
operator? Mark for Review
(1) Points
Match a character pattern. (*)
To test for values in a list.
Display rows based on a range of values.
T fifi d N ll
lTo fifind Null values.
Correct Correct.
13. Find the clause that will give the same results as:
SELECT *
FROM d_ cds
WHERE cd_ id NOT IN(90, 91, 92);
Mark for Review
(1) Points
WHERE cd_ id <=90 and cd_ id >=92;
WHERE cd_ id != 90 or cd_ id != 91 or cd_ id!= 92;
WHERE cd_ id NOT LIKE (90, 91, 92);
WHERE cd_ id != 90 and cd_ id != 91 and cd_ id != 92; (*)
Correct Correct
14. Which statement about the logical operators is true?
Mark for Review
(1) Points
The order of operator precedence is NOT, AND, and OR. (*)
The order of operator precedence is AND, NOT, and OR.
The order of operator precedence is NOT, OR, and AND.p
p
The order of operator precedence is AND, OR, and NOT.
Correct Correct.
15. You need to change the default sort order of the ORDER BY
clause so that the data is displayed in reverse alphabetical order.
Which keyword should you include in the ORDER BY clause? Mark for
Review
(1) Points
SORT
CHANGE
ASC
DESC (*)
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
1. Which of the following are examples of logical operators that
might be used in a WHERE clause. (Choose Two) Mark for Review
(1) Points
(Choose all correct ans ers)(Choose all correct answers)
AND, OR (*)
< >, =, <=, >=, <>
NOT (*)
LIKES
All of the above
Correct Correct
2. Which logical operator returns TRUE if either condition is true?
Mark for Review
(1) Points
BOTH
AND
OR (*)
NOT
Correct Correct
3. Which of the following statements best describes the rules ofprecedence when using SQL? Mark for Review
(1) Points
The order in which the columns are displayed
The order in which the expressions are sorted
The order in which the operators are returned
The order in which the expressions are evaluated and calculated (*)
All of the above
Correct Correct
4. Which symbol in the WHERE clause means "Not Equal To"?
(Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
<> (*)
><
NOT IN (..) (*)
=+
Correct CorrectCorrect Correct
5. What will be the results of the following selection?
SELECT *
FROM employees
WHERE last_ name NOT LIKE 'A%' AND last_ name NOT LIKE 'B%'
Mark for Review
(1) Points
No rows will be returned. There is a syntax error
All last names that begin with A or B
All rows will be returned
All last names that do not begin with A or B (*)
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
6. Evaluate this SQL statement:
SELECT e.employee_ id, e.last_ name, e.fifirst_ name, m.manager_ id
FROM employees e, employees m
ORDER BY e.last_ name, e.fifirst_ name
WHERE e.employee_ id = m.manager_ id;
This statement fails when executed. Which change will correct the
problem?Mark for Review
(1) Points
Remove the table aliases in the WHERE clause.
Reorder the clauses in the query. (*)
Include a HAVING clause.
Remove the table aliases in the ORDER BY clause.
Correct Correct
7. The following statement represents a multi-row function. True
or False?
SELECT UPPER(last_ name)
FROM employees;
Mark for Review
(1) Points
True
False (*)
Correct Correct
8. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_ NAME VARCHAR2 (20)
FIRST_ NAME VARCHAR2 (20)
SALARY NUMBER(8 2)SALARY NUMBER(8,2)
TEAM_ ID NUMBER(4)
MANAGER_ ID NUMBER(9)
POSITION_ ID NUMBER(4)
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 fifirst name.
Which statement should you use to achieve the required results?
Mark for Review
(1) Points
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id > 6900
ORDER BY last_ name, fifirst_ name;
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id >= 6900
ORDER BY last_ name, fifirst_ name;
(*)
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id >= 6900
ORDER BY last_ name DESC, fifirst_ name;
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id <= 6900
ORDER BY last_ name, fifirst_ name;
Correct Correct9. The conversion function TO_CHAR is a single row function. True
or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. The function COUNT is a single row function. True or False?
Mark for Review
(1) Points
True
False (*)
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
11. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, email
FROM employees
ORDER BY email;
If the EMAIL column contains null values, which statement is true?Mark for Review
(1) Points
Null email values will be displayed fifirst in the result.
Null email values will not be displayed in the result.
The result will not be sorted.
Null email values will be displayed last in the result. (*)
Correct Correct
12. Which columns can be added to the ORDER BY clause in the
following SELECT statement? (Choose Three)
SELECT fifirst_ name, last_ name, salary, hire_ date
FROM employees
WHERE department_ id = 50
ORDER BY ?????;
Mark for Review
(1) Points
(Choose all correct answers)
All columns in the EMPLOYEES table (*)
All the columns in the database
last_ name, fifirst_ name (*)
The table name, EMPLOYEES, which would then automatically sortby all columns in the table
Any column in the EMPLOYEES table, any expression in the SELECT
list or any ALIAS in the SELECT list (*)
Correct Correct
13. You query the database with this SQL statement:
SELECT price
FROM products
WHERE price IN(1, 25, 50, 250)
AND (price BETWEEN 25 AND 40 OR price > 50);
Which two values could the statement return? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
10
50
25 (*)
250 (*)
1
Correct Correct14. Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_ id = 34
OR department_ id = 45
OR department_ id = 67;
Which operator is the equivalent of the OR conditions used in this
SELECT statement?
Mark for Review
(1) Points
BETWEEN AND ...
LIKE
IN (*)
AND
Correct Correct
15. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, department_ id, manager_ id
FROM employees;
You need to sort data by manager id values and then alphabetically
by employee last name and fifirst name values. Which ORDER BY
clause could you use?
Mark for Review
(1) Points
ORDER BY last_ name, fifirst_ name, manager_ idORDER BY department_ id, last_ name
ORDER BY manager_ id, fifirst_ name, last_ name
ORDER BY manager_ id, last_ name, fifirst_ name (*)
Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
1. Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE salary > 30000
AND department_ id = 10
OR email IS NOT NULL;
Which statement is true?
Mark for Review
(1) Points
The AND condition will be evaluated before the OR condition. (*)
The OR condition will be evaluated before the AND condition.
The OR and AND conditions have the same precedence and will be
evaluated from right to leftThe OR and AND conditions have the same precedence and will be
evaluated from left to right
Correct Correct.
2. 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?
Mark for Review
(1) Points
SELECT product_ id "Product Number", category_ id "Category", price
"price"
FROM products
WHERE "Category" = 5570 (*)
ORDER BY "Product Number";
Correct Correct
3. Evaluate this SELECT statement:
SELECT last_ name, fifirst_ name, salary
FROM employees;How will the results of this query be sorted?
Mark for Review
(1) Points
The results will be sorted ascending by the LAST_ NAME column
only.
The database will display the rows in whatever order it fifinds it in the
database, so no particular order. (*)
The results will be sorted ascending by LAST_ NAME and
FIRST_ NAME only.
The results will be sorted ascending by LAST_ NAME, FIRST_ NAME,
and SALARY.
Correct Correct
4. 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
SELECT product_ id, product_ name
FROM products
GROUP BY price < 50;
SELECT product_ id, product_ name
FROM products
WHERE price <= 50;
SELECT product_ id, product_ nameFROM products
HAVING price < 50;
SELECT product_ id, product_ name
FROM products
WHERE price < 50;
(*)
SELECT product_ id, product_ name
FROM products
WHERE price < 50.00
GROUP BY price;
Correct Correct
5. What value will the following SQL statement return?
SELECT employee_ id
FROM employees
WHERE employee_ id BETWEEN 100 AND 150
OR employee_ id IN(119, 175, 205)
AND (employee_ id BETWEEN 150 AND 200);
Mark for Review
(1) Points
200, 201, 202, 203, 204, 205, 206
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
No rows will be returned
19Correct Correct
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
6. Which comparison condition means "Less Than or Equal To"?
Mark for Review
(1) Points
">="
"+<"
"<=" (*)
"=)"
Correct Correct
7. Which statement about the default sort order is true? Mark for
Review
(1) Points
The earliest date values are displayed fifirst. (*)
Character values are displayed in reverse alphabetical order.
Null values are displayed fifirst.The lowest numeric values are displayed last.
Correct Correct.
8. Find the clause that will give the same results as:
SELECT *
FROM d_ cds
WHERE cd_ id NOT IN(90, 91, 92);
Mark for Review
(1) Points
WHERE cd_ id NOT LIKE (90, 91, 92);
WHERE cd_ id != 90 and cd_ id != 91 and cd_ id != 92; (*)
WHERE cd_ id <=90 and cd_ id >=92;
WHERE cd_ id != 90 or cd_ id != 91 or cd_ id!= 92;
Correct Correct
9. Which symbol in the WHERE clause means "Not Equal To"?
(Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
<> (*)NOT IN (..) (*)
=+
><
Correct Correct
10. Which clause would you include in a SELECT statement to sort
the rows returned by the LAST_ NAME column? Mark for Review
(1) Points
ORDER BY (*)
WHERE
FROM
HAVING
Correct Correct.
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An
asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
11. The function COUNT is a single row function. True or False?
Mark for Review(1) Points
True
False (*)
Correct Correct
12. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_ NAME VARCHAR2 (20)
FIRST_ NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ ID NUMBER(4)
MANAGER_ ID NUMBER(9)
POSITION_ ID NUMBER(4)
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 fifirst name.
Which statement should you use to achieve the required results?
Mark for Review
(1) Points
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id >= 6900
ORDER BY last_ name, fifirst_ name;
(*)
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id <= 6900
ORDER BY last_ name, fifirst_ name;SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id > 6900
ORDER BY last_ name, fifirst_ name;
SELECT last_ name, fifirst_ name
FROM players
WHERE position_ id >= 6900
ORDER BY last_ name DESC, fifirst_ name;
Correct Correct.
13. Evaluate this SQL statement:
SELECT e.employee_ id, e.last_ name, e.fifirst_ name, m.manager_ id
FROM employees e, employees m
ORDER BY e.last_ name, e.fifirst_ name
WHERE e.employee_ id = m.manager_ id;
This statement fails when executed. Which change will correct the
problem?
Mark for Review
(1) Points
Include a HAVING clause.
Remove the table aliases in the WHERE clause.
Reorder the clauses in the query. (*)
Remove the table aliases in the ORDER BY clause.Correct Correct
14. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_ NAME VARCHAR2 (20)
FIRST_ NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ ID NUMBER(4)
MANAGER_ ID NUMBER(9)
POSITION_ ID NUMBER(4)
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?
Mark for Review
(1) Points
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id, salary DESC;
(*)
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id, salary;
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team id DESC, salary DESC;ORDER BY team_ id DESC, salary DESC;
SELECT last_ name, fifirst_ name, team_ id, salary
FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_ id BETWEEN 1200 AND 1500
ORDER BY team_ id ASC, salary DESC;
Correct Correct.
15. The conversion function TO_CHAR is a single row function.
True or False? Mark for Review
(1) Points
True (*)
False
No comments:
Post a Comment