Chapter 4


1.

Rewrite the following expression using the CONCAT function.

last_name || ‘, ‘ || first_name

the expression is rewritten as: concat(concat(last_name, , ),first_name)

2.

What are two ways that you can indicate a comment in a SQL command?

you can indicate a comment in a sql command by using /* and */ or by using -- .

3.

The SQL engine converts the IN operator to a series of .

the sql engine converts the in operator to a series of or operations.

4.

Rewrite the following WHERE clause to be case-insensitive.

where job_title like ‘%Manager%’;

use the upper function to convert the job title to uppercase: where upper(job_title) like %manager% ;

5.

What is the only group function that counts NULL values in its calculation without using NVL or other special processing?

the count group function using the syntax count(*) counts null values without using nvl .

6.

The query results from using aggregate functions with a GROUP BY clause can be filtered or restricted by using what clause?

the having clause filters or restricts the query results of the group by clause.

7.

Identify the two special characters used with the LIKE operator and describe what they do.

the % character matches zero or more characters, and thecharacter matches exactly one character.

8.

Name two aggregate functions that work only on numeric columns or expressions, and two other aggregate functions that work on numeric, character, and date columns.

 avg and sum work only on numeric columns; min and max work on all datatypes.

9.

Put the clauses of a SQL SELECT statement in the order in which they are processed.

the proper order is: select , where , group by , having , order by .

10.

Which operator can do valid comparisons to columns with NULL values?

the operator is is null .

11.

The SQL engine converts the BETWEEN operator to .

the sql engine converts the between operator to two logical comparisons using - = and - = , connected by an and operation.

12.

Where do NULL values end up in a sort operation?

for ascending sorts, the null values are at the end; for descending sorts, the null values are at the beginning.

Answers

1.

The expression is rewritten as:

concat(concat(last_name, ‘, ‘),first_name)

2.

You can indicate a comment in a SQL command by using /* and */ or by using --.

3.

The SQL engine converts the IN operator to a series of OR operations.

4.

Use the UPPER function to convert the job title to uppercase:

where UPPER(job_title) like ‘%MANAGER%’;

5.

The COUNT group function using the syntax COUNT(*) counts NULL values without using NVL.

6.

The HAVING clause filters or restricts the query results of the GROUP BY clause.

7.

The % character matches zero or more characters, and the character matches exactly one character.

8.

AVG and SUM work only on numeric columns; MIN and MAX work on all datatypes.

9.

The proper order is: SELECT, WHERE, GROUP BY, HAVING, ORDER BY.

10.

The operator is IS NULL.

11.

The SQL engine converts the BETWEEN operator to two logical comparisons using >= and <=, connected by an AND operation.

12.

For ascending sorts, the NULL values are at the end; for descending sorts, the NULL values are at the beginning.




Oracle9i DBA JumpStart
Oracle9i DBA JumpStart
ISBN: 0782141897
EAN: 2147483647
Year: 2006
Pages: 138
Authors: Bob Bryla

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net