+ All Categories
Home > Documents > Design Final 3

Design Final 3

Date post: 18-Nov-2014
Category:
Upload: alex
View: 1,826 times
Download: 6 times
Share this document with a friend
Description:
www.hporacle.wordpress.com
31
1. The explanation below is a column integrity constraint: A column must contain only values consistent with the defined data format of the column. True or False? True False 2. A table must have at least one candidate key, as well as its primary key. True or False? True False 3. A table must have a primary key. True or False? Mark for Review (1) Points True False 4. A foreign key can not refer to a primary key in the same table. True or False? Mark for Review (1) Points True False Section 12 Lesson 2(Answer all questions in this section) 5. In a physical data model, a relationship is represented as a combination of: (Choose Two) (Choose all correct answers) Column Primary Key or Unique Key Check Constraint or Unique Key Foreign Key 6. In an Oracle database, why would 1_TABLE not work as a table name? The database does not understand all capital letters There is no problem here. You can create a table called 1_TABLE This watermark does not appear in the registered version - http://www.clicktoconvert.com
Transcript
Page 1: Design Final 3

1. The explanation below is a column integrity constraint: A column must contain only values

consistent with the defined data format of the column. True or False?

True

False

2. A table must have at least one candidate key, as well as its primary key. True or

False?

True

False

3. A table must have a primary key. True or False? Mark for Review (1) Points

True

False

4. A foreign key can not refer to a primary key in the same table. True or False?

Mark for Review (1) Points

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. In a

physical data model, a relationship is represented as a combination of: (Choose Two) (Choose all correct answers)

Column

Primary Key or Unique Key

Check Constraint or Unique Key

Foreign Key

6. In an Oracle database, why would 1_TABLE not work as a table name?

The database does not understand all capital letters

There is no problem here. You can create a table called 1_TABLE

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 2: Design Final 3

Object names must not start with a number. They must begin with a letter

TABLE is a reserved word

7. Attributes become tables in a database. True or False?

True

False

Section 12 Lesson 3(Answer all questions in this section) 8. The Oracle Database can implement a many to many relationship. You simple create two foreign keys

between the two tables. True or False? Mark for Review (1) Points

True

False

9. What do you create when you transform a many to many relationship from your ER

diagram into a physical design?

Unique key constraints

Intersection entity

Intersection table

Two tables with a Foreign key constraints between them

Section 12 Lesson 4(Answer all questions in this section) 10. An "Arc Implementation" can be done just like any other Relationship - you simply add the required

Foreign Keys. True or False?

True

False

Section 12 Lesson 4(Answer all questions in this section) 11. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two Unique Key Constraints to

ensure the Arc is implemented correctly. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 3: Design Final 3

False

Section 13 Lesson 1(Answer all questions in this section) 12. What

command can used to create a new row in a table in the database?

CREATE

NEW

ADD

INSERT

13. What command will return data from the database to you?

FETCH

GET

SELECT

RETURN

Section 16 Lesson 1(Answer all questions in this section) 14. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL

query?

AS

OR

AND

SUBSTITUTE

15. In the default order of precedence, which operator would be evaluated first?

Subtractions

Multiplications

Additions

Divisions

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 4: Design Final 3

16. Which statement best describes how arithmetic expressions are handled?

Addition operations are handled before any other operations.

Multiplication and substraction operations are handled before any other operations.

Multiplication and addition operations are handled before subtraction and division operations.

Division and multiplication operations are handled before subtraction and addition operations.

17. You query the database with this SQL statement: SELECT * FROM students;

Why would you use this statement?

To insert data

To view data

To display the table structure

To delete data

18. The EMPLOYEES table contains these columns:

SALARY NUMBER(7,2) BONUS NUMBER(7,2) COMMISSION_PCT NUMBER(2,2)

All three columns contain values greater than zero. There is one row of data in the table and the values are as follows:

Salary = 500, Bonus = 50, Commission_pct = .5

Evaluate these two SQL statements:

1. SELECT salary + bonus + commission_pct * salary - bonus AS income FROM employees;

2. SELECT (salary + bonus ) + commission_pct * (salary - bonus) income FROM employees;

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 5: Design Final 3

What will be the result?

Statement 1 will return a higher value than statement 2.

Statement 2 will return a higher value than statement 1.

Statement 1 will display a different column heading.

One of the statements will NOT execute.

19. Which keyword can be used to specify a column alias?

AS

DESCRIBE

FROM

WHERE

20. Evaluate this SELECT statement:

SELECT (salary * raise_percent) raise FROM employees;

If the RAISE_PERCENT column only contains null values, what will the statement return?

Only zeroes

Only null values

A null value or a zero depending on the value of the SALARY column

A null value or a numeric value depending on the value of the SALARY column

Section 16 Lesson 3(Answer all questions in this section) 21. There is only one kind of

software used by all computers. True or Fale?

True

False

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 6: Design Final 3

22. All computers in the world speaks the same languages, so you only need to learn one

programming language - Oracle SQL. True or False?

True

False

Section 17 Lesson 1(Answer all questions in this section) 23. Which clause would you include in a SELECT statement to restrict the data returned to only the

employees in department 10?

WHERE

FROM

SELECT

IS

24. When using the LIKE condition, which symbol represents any sequence of none,

one or more characters?

_

%

#

&

25. Which comparison condition would you use to select rows that match a character

pattern?

IN

LIKE

ALMOST

SIMILAR

26. Which of the following elements cannot be included in a WHERE clause?

A column alias

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 7: Design Final 3

A column name

A comparison condition

A constant

27. Which operator is used to combine columns of character strings to other columns?

*

/

+

||

28. You need to display all the rows in the EMPLOYEES table that contain a null value

in the DEPARTMENT_ID column. Which comparison operator should you use?

"= NULL"

NULL!

ISNULL

IS NULL

Section 17 Lesson 2(Answer all questions in this section) 29. You want to retrieve a list of customers whose last names begin with the letters Fr . Which symbol should

you include in the WHERE clause of your SELECT statement to achieve the desired result?

%

~

#

*

30. You want to retrieve a list of customers whose last names begin with the letters Fr . Which keyword should you include in the WHERE clause of your SELECT statement to achieve

the desired result?

AND

IN

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 8: Design Final 3

BETWEEN

LIKE

Section 17 Lesson 2(Answer all questions in this section) 31. What will the result of the following SELECT statement be:

SELECT last_name, salary, salary + 300 FROM employees;

Display the last name, salary and the results of adding 300 to each salary for all the employees

Modify the salary column by adding 300 and displaying the last name, salary and the new salary.

Modify the salary column by adding 300 and only display the last name and the new salary.

Display the last name, salary and the results of adding 300 to the salary of the first employee row

32. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"?

SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees;

SELECT last_name||', '|| job_id "Employee and Title" FROM employees;

SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp;

SELECT last_name||","|| job_id "Employee and Title" FROM employees;

33. The PLAYERS table contains these columns:

PLAYER_ID NUMBER (9) Primary Key LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) TEAM_ID NUMBER (4) MANAGER_ID NUMBER (9) POSITION_ID NUMBER (4)

Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID and MANAGER_ID columns?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 9: Design Final 3

SELECT * FROM players;

SELECT team_id, manager_id FROM players;

SELECT DISTINCT team_id, manager_id FROM players;

SELECT team_id, DISTINCT manager_id FROM players;

SELECT team_id, manager_id DISTINCT FROM players;

Section 17 Lesson 3(Answer all questions in this section) 34. The EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(9) PrimaryKey LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) DEPARTMENT_ID NUMBER(5) NOT NULL MANAGER_ID NUMBER(9) NOT NULL

Evaluate these two SELECT statements: 1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees; 2. SELECT employee_id, department_id, manager_id FROM employees;

Which of the following statements is true?

The two statements will display the same data.

The first statement will display a particular DEPARTMENT_ID only once.

The first statement will NOT display values from all of the rows in the EMPLOYEE table

The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.

35. You want to create a report that displays all employees who were hired before January 1, 2000 and whose annual salaries are greater than 50000.

The EMPLOYEES table contains these columns:

EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY LAST_NAME VARCHAR2(35) HIRE_DATE DATE DEPARTMENT_ID NUMBER(4)

The SALARY table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 10: Design Final 3

SALARY_ID VARCHAR2(5) PRIMARY KEY SALARY NUMBER(5, 2) EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY

Which query should you issue?

SELECT last_name, hiredate, salary FROM employees NATURAL JOIN salary USING employee_id WHERE hiredate < 01-jan-00 AND salary > 50000;

SELECT last_name, hiredate, salary FROM employees JOIN salary ON employee_id = employee_id WHERE hiredate < '01-jan-00' AND salary > 50000;

SELECT last_name, hiredate, salary FROM employees NATURAL JOIN salary WHERE hiredate < '01-jan-00' AND salary > 50000;

SELECT last_name, hiredate, salary FROM employees (+) salary WHERE hiredate < '01-jan-00' AND salary > 50000;

36. If you write queries using the BETWEEN operator it does not matter in what order you enter the values, i.e. BETWEEN low value AND high value will give the same result as

BETWEEN high value AND low value. True or False?

True

False

Section 18 Lesson 1(Answer all questions in this section) 37. Which

statement about the ORDER BY clause is true?

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 can only contain columns that are included in the SELECT list.

The ORDER BY clause should immediately precede the FROM clause in a SELECT statement

38. Which logical operator returns TRUE if either condition is true?

OR

AND

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 11: Design Final 3

NOT

BOTH

39. 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?

DESC

ASC

SORT

CHANGE

40. Which of the following are TRUE regarding the logical AND operator?

TRUE AND TRUE return FALSE

TRUE AND FALSE return TRUE

FALSE AND TRUE return NULL

TRUE AND FALSE return FALSE

Section 18 Lesson 1(Answer all questions in this section) 41. The ORDER BY clause

always comes last. True or False?

True

False

42. Which of the following best describes the meaning of the LIKE operator?

Display rows based on a range of values.

To test for values in a list.

Match a character pattern.

To find Null values.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 12: Design Final 3

Section 18 Lesson 2(Answer all questions in this section) 43. Evaluate this SELECT statement:

SELECT * FROM employees WHERE salary > 30000 AND department_id = 10 OR email IS NOT NULL;

Which statement is true?

The OR condition will be evaluated before the AND condition.

The AND condition will be evaluated before the OR condition.

The OR and AND conditions have the same precedence and will be evaluated from left to right

The OR and AND conditions have the same precedence and will be evaluated from right to left

44. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees;

How will the results of this query be sorted?

The database will display the rows in whatever order it finds it in the database, so no particular order.

The results will be sorted ascending by the LAST_NAME column only.

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.

45. Evaluate this SELECT statement:

SELECT last_name, first_name, department_id, manager_id FROM employees;

You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 13: Design Final 3

ORDER BY department_id, last_name

ORDER BY manager_id, last_name, first_name

ORDER BY last_name, first_name, manager_id

ORDER BY manager_id, first_name, last_name

46. Evaluate this SELECT statement:

SELECT last_name, first_name, email FROM employees ORDER BY email;

If the EMAIL column contains null values, which statement is true?

Null email values will be displayed first in the result.

Null email values will be displayed last in the result.

Null email values will not be displayed in the result.

The result will not be sorted.

47. Evaluate this SELECT statement:

SELECT employee_id, last_name, first_name, salary 'Yearly Salary' FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3;

Which clause contains an error?

SELECT employee_id, last_name, first_name, salary 'Yearly Salary'

FROM employees

WHERE salary IS NOT NULL

ORDER BY last_name, 3;

48. Evaluate this SELECT statement:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 14: Design Final 3

SELECT first_name, last_name, email FROM employees ORDER BY last_name;

Which statement is true?

The rows will not be sorted.

The rows will be sorted alphabetically by the LAST_NAME values.

The rows will be sorted in reverse alphabetical order by the LAST_NAME values.

The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values

Section 18 Lesson 3(Answer all questions in this section) 49. 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, 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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 15: Design Final 3

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;

50. The EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(9) Primary Key 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?

One of the statements will return a syntax error.

One of the statements will eliminate all duplicate DEPARTMENT_ID values.

There is no difference in the result between the two statements.

The statements will sort on different column values.

Section 12 Lesson 1(Answer all questions in this section) 1. A table must have at least

one candidate key, as well as its primary key. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 16: Design Final 3

False

2. Foreign keys must be null. True or False?

True

False

3. The text below is an example of what constraint type: If the number of BOOKS lent to a BORROWER in the LIBRARY exceeds 5, then we must send him/her a letter requesting the

return of the BOOKS, which will require extra programming to enforce.

Entity integrity

User-defined integrity

Column integrity

Referential integrity

4. The explanation below is a User Defined integrity rule and must therefore be manually coded, the Database cannot enforce this rule automatically: A primary key must be

unique, and no part of the primary key can be null. True or False?

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. Attributes become tables in a database. True or False?

True

False

6. Why would this table name NOT work in an Oracle database?

This_year_end+next_year

Table names must begin with an alphabetic character

Too long

The Plus sign + is not allowed in object names

None of the above

7. In a physical data model, a relationship is represented as a combination of: (Choose

Two) (Choose all correct answers)

Column

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 17: Design Final 3

Primary Key or Unique Key

Check Constraint or Unique Key

Foreign Key

Section 12 Lesson 3(Answer all questions in this section) 8. The Oracle Database can implement a many to many relationship. You simple create two foreign keys

between the two tables. True or False?

True

False

9. What do you create when you transform a many to many relationship from your ER

diagram into a physical design?

Unique key constraints

Intersection entity

Intersection table

Two tables with a Foreign key constraints between them

Section 12 Lesson 4(Answer all questions in this section) 10. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two

Unique Key Constraints to ensure the Arc is implemented correctly. True or False?

True

False

Section 12 Lesson 4(Answer all questions in this section) 11. When mapping supertypes, relationships at the supertype level transform as usual. Relationships at subtype level are implemented as foreign keys, but the foreign key columns all become mandatory. True or False?

True

False

Section 13 Lesson 1(Answer all questions in this section) 12. What

command will return data from the database to you?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 18: Design Final 3

FETCH

GET

SELECT

RETURN

13. The _______ clause can be added to a select statement to return a subset of the

data.

ANYWHERE

WHICH

WHERE

EVERY

Section 16 Lesson 1(Answer all questions in this section) 14. You want to create a list of all albums that have been produced by the company. The list should include the title of the album, the artist's name, and the date the album was released. The ALBUMS table includes the following columns:

ALB_TITLE VARCHAR2(150) NOT NULL ALB_ARTIST VARCHAR2(150) NOT NULL ALB_DATE DATE NOT NULL

Which statement can you use to retrieve the necessary information?

SELECT * FROM albums;

SELECT alb_title, alb_artist, alb_dates FROM album;

SELECT * FROM album;

SELECT alb_title; alb_artist; alb_date FROM albums;

15. In the default order of precedence, which operator would be evaluated first?

Subtractions

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 19: Design Final 3

Multiplications

Additions

Divisions

16. Evaluate this SELECT statement:

SELECT (salary * raise_percent) raise FROM employees;

If the RAISE_PERCENT column only contains null values, what will the statement return?

Only zeroes

Only null values

A null value or a zero depending on the value of the SALARY column

A null value or a numeric value depending on the value of the SALARY column

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

an asterisk (*)

a minus sign (-)

a plus sign (+)

the ALL keyword

18. The SELECT statement retrieves information from the database. In a SELECT

statement, you can do all of the following EXCEPT:

Projection

Manipulation

Joining

Selection

19. The EMPLOYEES table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 20: Design Final 3

SALARY NUMBER(7,2) BONUS NUMBER(7,2) COMMISSION_PCT NUMBER(2,2)

All three columns contain values greater than zero. There is one row of data in the table and the values are as follows:

Salary = 500, Bonus = 50, Commission_pct = .5

Evaluate these two SQL statements:

1. SELECT salary + bonus + commission_pct * salary - bonus AS income FROM employees;

2. SELECT (salary + bonus ) + commission_pct * (salary - bonus) income FROM employees;

What will be the result?

Statement 1 will return a higher value than statement 2.

Statement 2 will return a higher value than statement 1.

Statement 1 will display a different column heading.

One of the statements will NOT execute.

20. When you use the SELECT clause to list one or two columns only from a table and no WHERE clause, which SQL capability is used?

Joining only

Selection only

Projection only

Projection and Selection

Section 16 Lesson 3(Answer all questions in this section) 21. In a SELECT statement

Additions are evaluated before Multiplications. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 21: Design Final 3

False

22. All computers in the world speaks the same languages, so you only need to learn one

programming language - Oracle SQL. True or False?

True

False

Section 17 Lesson 1(Answer all questions in this section) 23. Which statement best describes how column headings are displayed by default in Oracle Application

Express:

Column headings are displayed left-justified and in lowercase.

Column headings are displayed left-justified and in uppercase.

Column headings are displayed centered and in uppercase.

Column headings are displayed centered and in mixed case.

24. You need to display employees with salaries that are at least 30000 or higher. Which

comparison operator should you use?

>

"=>"

>=

!=

25. The Concatenation Operator does which of the following?

Links rows of data together inside the database.

Links two or more columns or literals to form a single output column

Is represented by the asterisk (*) symbol

Separates columns.

26. You need to display only unique combinations of the LAST_NAME and MANAGER_ID columns in the EMPLOYEES table. Which keyword should you include in the

SELECT clause?

ONLY

UNIQUE

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 22: Design Final 3

DISTINCT

DISTINCTROW

27. What does the DISTINCT keyword do when it is used in a SELECT clause?

Mark for Review (1) Points

Hides NULL values

Eliminates all unique values and compares values

Eliminates duplicate rows in the result

Eliminates only unique rows in the result

28. You need to display employees whose salary is in the range of 10000 through 25000

for employees in department 50 . What does the WHERE clause look like?

WHERE department_id < 50 AND salary BETWEEN 10000 AND 25000

WHERE department_id > 50 AND salary BETWEEN 10000 AND 25000

WHERE department_id = 50 AND salary BETWEEN 25001 AND 10001

WHERE department_id = 50 AND salary BETWEEN 25000 AND 10000

Section 17 Lesson 2(Answer all questions in this section) 29. You need to display all the values in the EMAIL column that contains the underscore (_) character as part of that email address. The WHERE clause in your SELECT statement contains the LIKE

operator. What must you include in the LIKE operator?

The ESCAPE option (\) and one or more percent signs (%)

The (+) operator

A percent sign (%)

The ESCAPE option (\)

30. Evaluate this SQL statement:

SELECT last_name, first_name, salary FROM employees;

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 23: Design Final 3

How will the heading for the SALARY column appear in the display by default in Oracle Application Express?

The heading will display with the first character capitalized and centered.

The heading will display with the first character capitalized and left justified.

The heading will display as uppercase and centered.

The heading will display as uppercase and left justified.

Section 17 Lesson 2(Answer all questions in this section) 31. Which SELECT

statement will display both unique and non-unique combinations of the MANAGER_ID

and DEPARTMENT_ID values from the EMPLOYEES table?

SELECT manager_id, department_id DISTINCT FROM employees;

SELECT manager_id, department_id FROM employees;

SELECT DISTINCT manager_id, department_id FROM employees;

SELECT manager_id, DISTINCT department_id FROM employees;

32. You want to determine the orders that have been placed by customers who live in Chicago. You write this partial SELECT statement:

SELECT orderid, orderdate, total FROM orders;

What should you include in your SELECT statement to achieve the desired results?

AND city = Chicago;

AND city = 'Chicago';

WHERE city = 'Chicago';

WHERE city = Chicago;

33. The PLAYERS table contains these columns: PLAYER_ID NUMBER (9) Primary Key

LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) TEAM_ID NUMBER (4) MANAGER_ID NUMBER (9) POSITION_ID NUMBER (4)

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 24: Design Final 3

Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID and MANAGER_ID columns?

SELECT * FROM players;

SELECT team_id, manager_id FROM players;

SELECT DISTINCT team_id, manager_id FROM players;

SELECT team_id, DISTINCT manager_id FROM players;

SELECT team_id, manager_id DISTINCT FROM players;

Section 17 Lesson 3(Answer all questions in this section) 34. The PRODUCT table contains these columns:

PRODUCT_ID NUMBER(9) DESCRIPTION VARCHAR2(20) COST NUMBER(5,2) LOCATION_ID VARCHAR2(10)

You want to display product costs with these desired results: 1. The cost displayed for each product is increased by 10 percent. 2. The product location id must be 4859, 9789, or 9898. 3. Ten percent of the original cost is less than $10.

Which statement should you issue?

SELECT product_id, cost * 1.10 FROM product WHERE cost * .10 < 10.00 AND location_id IN (4859, 9789, 9898);

SELECT product_id, cost * .10 FROM product WHERE cost * 1.10 > 10.00 AND location_id IN (4859, 9789, 9898);

SELECT product_id, cost * 1.10 FROM product WHERE cost * 1.10 < 10.00 AND location_id = (4859, 9789, 9898);

SELECT product_id, cost * 1.10 FROM product WHERE cost * .10 > 10.00 AND location_id = (4859, 9789, 9898);

35. The EMPLOYEES table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 25: Design Final 3

EMPLOYEE_ID NUMBER(9) PrimaryKey LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) DEPARTMENT_ID NUMBER(5) NOT NULL MANAGER_ID NUMBER(9) NOT NULL

Evaluate these two SELECT statements: 1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees; 2. SELECT employee_id, department_id, manager_id FROM employees;

Which of the following statements is true?

The two statements will display the same data.

The first statement will display a particular DEPARTMENT_ID only once.

The first statement will NOT display values from all of the rows in the EMPLOYEE table

The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.

36. The EMPLOYEES table includes these columns: EMPLOYEE_ID NUMBER(4) NOT NULL

LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL

You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task?

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00';

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00';

SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00';

SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

Section 18 Lesson 1(Answer all questions in this section) 37. You need to change the default sort order of the ORDER BY clause so that the data is

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 26: Design Final 3

displayed in reverse alphabetical order. Which keyword should you include in the

ORDER BY clause?

DESC

ASC

SORT

CHANGE

38. Which clause would you include in a SELECT statement to sort the rows

returned by the LAST_NAME column?

ORDER BY

WHERE

FROM

HAVING

39. Which statement about the logical operators is true?

The order of operator precedence is AND, OR, and NOT.

The order of operator precedence is AND, NOT, and OR.

The order of operator precedence is NOT, OR, and AND.

The order of operator precedence is NOT, AND, and OR.

40. You need to replace null values in the DEPARTMENT_ID column with a

zero (0). Which function should you use?

NVL

NULL

NULLIF

REPLACE

Section 18 Lesson 1(Answer all questions in this section) 41. Which logical operator

returns TRUE if either condition is true?

OR

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 27: Design Final 3

AND

NOT

BOTH

42. The ORDER BY clause always comes last. True or False?

True

False

Section 18 Lesson 2(Answer all questions in this section) 43. Evaluate this SELECT statement:

SELECT * FROM employees WHERE salary > 30000 AND department_id = 10 OR email IS NOT NULL;

Which statement is true?

The OR condition will be evaluated before the AND condition.

The AND condition will be evaluated before the OR condition.

The OR and AND conditions have the same precedence and will be evaluated from left to right

The OR and AND conditions have the same precedence and will be evaluated from right to left

44. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees;

How will the results of this query be sorted?

The database will display the rows in whatever order it finds it in the database, so no particular order.

The results will be sorted ascending by the LAST_NAME column only.

The results will be sorted ascending by LAST_NAME and FIRST_NAME only.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 28: Design Final 3

The results will be sorted ascending by LAST_NAME, FIRST_NAME, and SALARY.

45. Evaluate this SELECT statement:

SELECT last_name, first_name, email FROM employees ORDER BY email;

If the EMAIL column contains null values, which statement is true?

Null email values will be displayed first in the result.

Null email values will be displayed last in the result.

Null email values will not be displayed in the result.

The result will not be sorted.

46. Evaluate this SELECT statement:

SELECT * FROM employees WHERE department_id = 34 OR department_id = 45 OR department_id = 67;

Which operator is the same as the OR conditions used in this SELECT statement?

IN

AND

LIKE

BETWEEN ... AND ...

47. You need to create a report to display all employees that were hired on or before January 1, 1996. The data should display in this format: Employee Start Date and Salary 14837 - Smith 10-MAY-92 / 5000

Which SELECT statement could you use?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 29: Design Final 3

SELECT employee_id || - || last_name "Employee", hire_date || / || salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' '|| last_name "Employee", hire_date ||' '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||'"- "|| last_name "Employee", hire_date ||" / "|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name 'Employee', hire_date ||' / '|| salary 'Start Date and Salary' FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name "Employee", hire_date ||' / '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

48. 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.)

(Choose all correct answers)

1

50

25

10

250

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 30: Design Final 3

100

Section 18 Lesson 3(Answer all questions in this section) 49. Evaluate this SQL statement:

SELECT e.employee_id, e.last_name, e.first_name, m.manager_id FROM employees e, employees m ORDER BY e.last_name, e.first_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.

Remove the tables aliases in the WHERE clause.

Remove the table aliases in the ORDER BY clause.

Include a HAVING clause.

50. 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, 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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 31: Design Final 3

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;

This watermark does not appear in the registered version - http://www.clicktoconvert.com


Recommended