Evaluate this SELECT statement SELECT last_name, first_name, salary from employees

4.The functionCOUNTis a single row function. True or False?False (*)True

5.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 through100000 and whose team id is in the range of 1200 through 1500. The results must be sorted by team id from lowestto highest and then further sorted by salary from highest to lowest. Which statement should you use to display thedesired result?

SELECT last_name, first_name, team_id, salaryFROM playersWHERE salary > 24999.99 AND salary < 100000AND team_id BETWEEN 1200 AND 1500ORDER BY team_id ASC, salary DESC;SELECT last_name, first_name, team_id, salaryFROM playersWHERE salary BETWEEN 24999.99 AND 100000.01AND team_id BETWEEN 1200 AND 1500ORDER BY team_id DESC, salary DESC;6.You query the database with this SQL statement:SELECT priceFROM productsWHERE price IN(1, 25, 50, 250)AND (price BETWEEN 25 AND 40 OR price > 50);Which two values could the statement return? (Choose two.)15025 (*)10250 (*)In7.What clause must you place in a SQL statement to have your results sorted from highest to lowest salary?

8.Evaluate this SELECT statement:

WHERE department_id = 34OR department_id = 45OR department_id = 67;Which operator is the equivalent of the OR conditions used in this SELECT statement?

9.You attempt to query the database with this SQL statement:SELECT product_id "Product Number", category_id "Category", price "Price"FROM productsWHERE "Category" = 5570ORDER BY "Product Number";This statement fails when executed. Which clause contains a syntax error?

10.Evaluate this SELECT statement:SELECT last_name, first_name, salaryFROM employees;How will the results of this query be sorted?

Section 3 Quiz
(Answer all questions in this section)

1. Which of the following statements best describes the rules of precedence 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
2. Which of the following are TRUE regarding the logical AND operator? Mark for Review
(1) Points

TRUE AND FALSE return TRUE
TRUE AND TRUE return FALSE
FALSE AND TRUE return NULL
TRUE AND FALSE return FALSE (*)

Correct Correct.
3. 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 answers)

AND, OR (*)
< >, =, <=, >=, <>
NOT (*)
LIKES
All of the above

Correct Correct
4. 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 first_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 50

FIRST_NAME LAST_NAME DEPARTMENT_ID
Randall Matos 50

FIRST_NAME LAST_NAME DEPARTMENT_ID
Michael Hartstein 20
All of the above (*)

Correct Correct
5. Which logical operator returns TRUE if either condition is true? Mark for Review
(1) Points

OR (*)
NOT
AND
BOTH

Correct Correct.

====Section 3 Quiz
(Answer all questions in this section)

6. The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9) PK
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
Compare these two SQL statements:

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;

How will the results differ?

Mark for Review
(1) Points

One of the statements will return a syntax error.
There is no difference in the result between the two statements.
One of the statements will eliminate all duplicate DEPARTMENT_ID values.
The statements will sort on different column values. (*)

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 (*)

Incorrect Incorrect! See Section 3 Lesson 3.
8. 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 from each employee.
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.

Correct Correct
9. 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, first_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, first_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, first_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, first_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;

Correct Correct.
10. The conversion function TO_CHAR is a single row function. True or False? Mark for Review
(1) Points

True (*)
False

==========
Section 3 Quiz
(Answer all questions in this section)

11. A column alias can be specified in an ORDER BY Clause. True or False? Mark for Review
(1) Points

True (*)
False

Correct Correct
12. 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 …
AND
IN (*)
LIKE

Incorrect Incorrect! See Section 3 Lesson 2.
13. 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

100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
19
No rows will be returned
200, 201, 202, 203, 204, 205, 206

Correct Correct.
14. What clause must you place in a SQL statement to have your results sorted from highest to lowest salary? Mark for Review
(1) Points

ORDER BY salary DESC (*)
ORDER salary BY DESC
None, the database always sorts from highest to lowest on the salary column.
ORDER BY salary ASC

Incorrect Incorrect! See Section 3 Lesson 2.
15. 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
HAVING price < 50;
SELECT product_id, product_name
FROM products
WHERE price < 50;
(*)

SELECT product_id, product_name
FROM products
WHERE price <= 50;
SELECT product_id, product_name
FROM products
GROUP BY price < 50;
SELECT product_id, product_name
FROM products
WHERE price < 50.00
GROUP BY price;

Correct Correct.

Which clause would you include in a SELECT statement?

The Five Clauses of the SELECT Statement.
SELECT – the columns in the result set..
FROM – names the base table(s) from which results will be retrieved..
WHERE – specifies any conditions for the results set (filter).
ORDER BY – sets how the result set will be ordered..
LIMIT – sets the number of rows to be returned..

What would you use in the SELECT clause to return all the columns in the table?

The SELECT clause allows us to specify a comma-separated list of attribute names corresponding to the columns that are to be retrieved. You can use an asterisk character, *, to retrieve all the columns.

Which clause would you include in a SELECT statement to sort the rows returned?

To sort the results of an SQL SELECT statement, you use the ORDER BY clause.

Which of the following clause is the last clause in the SELECT statement?

Which of the following clause is evaluated in the last by database server? Explanation: “SELECT” clause is used to show all rows or columns therefore it evaluated at last.

Toplist

Neuester Beitrag

Stichworte