Semester 1 Final Term Exam Oracle
-
Upload
gabby-tesileanu -
Category
Documents
-
view
154 -
download
7
description
Transcript of Semester 1 Final Term Exam Oracle
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 12
1. One-to-One relationships are transformed into Check Constraints in the tables created at either end of that relationship. True or False? Mark for Review(1) Points
True
False (*)
Correct
2. The Oracle Database can implement a many to many relationship. You simply create two foreign keys between the two tables. True or False? Mark for Review(1) Points
True
False (*)
Incorrect. Refer to Section 12
3. Why would this table name NOT work in an Oracle database? this_year_end+next_year Mark for Review(1) Points
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names (*)
None of the above
Incorrect. Refer to Section 12
4. In a physical data model, an attribute becomes a _____________. Mark for Review(1) Points
Table
Foreign Key
Constraint
Column (*)
Correct
5. In a physical data model, a relationship is represented as a combination of: (Choose Two) Mark for Review(1) Points
(Choose all correct answers)
Column
Primary Key or Unique Key (*)
Check Constraint or Unique Key
Foreign Key (*)
Incorrect. Refer to Section 12
6. Identify all of the incorrect statements that complete this sentence: A primary key is: (Choose three) Mark for Review(1) Points
(Choose all correct answers)
A single column that uniquely identifies each column in a table (*)
One or more columns in a table that uniquely identifies each row in that table
A set of columns in one table that uniquely identifies each row in another table (*)
Only one column that must be null (*)
Incorrect. Refer to Section 12
7. 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?Mark for Review(1) Points
True (*)
False
Correct
8. Foreign keys must be null. True or False? Mark for Review(1) Points
True
False (*)
Correct
9. 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?Mark for Review(1) Points
True
False (*)
Incorrect. Refer to Section 12
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? Mark for Review(1) Points
True
False (*)
Incorrect. Refer to Section 12
Page 1 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 12
11. Which of the following are reasons why you should consider using a Subtype Implementation? Mark for Review(1) Points
The resulting table will reside in a single database and be used by just ONE user.
When the common access paths for the supertypes are different.
Business functionality and business rules, access paths and frequency of access are all very different between subtypes. (*)
Most of the relationships are at the supertype level
Incorrect. Refer to Section 12
Section 13
12. The _______ clause can be added to a SELECT statement to return a subset of the data. Mark for Review(1) Points
ANYWHERE
WHICH
WHERE (*)
EVERY
Correct.
13. What command can be used to create a new row in a table in the database? Mark for Review(1) Points
CREATE
NEW
ADD
INSERT (*)
Correct.
Section 16
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 NULLALB_ARTIST VARCHAR2(150) NOT NULLALB_DATE DATE NOT NULL
Which statement can you use to retrieve the necessary information?
Mark for Review(1) Points
SELECT *FROM albums;(*)
SELECT alb_title, alb_artist, alb_datesFROM album;
SELECT alb_title, alb_artist, alb_datesFROM albums;
SELECT alb_title; alb_artist; alb_dateFROM albums;
Incorrect. See Section 16
15. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review(1) Points
6
8 (*)
10
13
Correct.
16. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL query? Mark for Review(1) Points
AS (*)
OR
AND
SUBSTITUTE
Correct.
17. 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? Mark for Review(1) Points
Joining only
Selection only
Projection only (*)
Projection and Selection
Incorrect. See Section 16
18. When listing columns in the SELECT list, what should you use to separate the columns? Mark for Review(1) Points
Commas (*)
Semicolons
Dashes
Underscores
Correct.
19. In which clause of a SELECT statement would you specify the name of the table or tables being queried? Mark for Review(1) Points
The FROM clause (*)
The SELECT clause
The WHERE clause
Any of the above options, you can list tables wherever you want to in a SELECT statement.
Correct.
20. The SELECT statement retrieves information from the database. In a SELECT statement, you can do all of the following EXCEPT: Mark for Review(1) Points
Projection
Manipulation (*)
Joining
Selection
Incorrect. See Section 16
Page 2 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 16
21. In a SELECT statement Additions are evaluated before Multiplications. True or False? Mark for Review(1) Points
True
False (*)
Correct.
22. You cannot use computers unless you completely understand exactly how they work. True or False? Mark for Review(1) Points
True
False (*)
Incorrect. See Section 16
Section 17
23. The STUDENT table contains these columns:STUDENT_ID NUMBER(10) Primary KeyLAST_NAME VARCHAR2(25)FIRST_NAME VARCHAR2(25)MAIN_SUBJECT_ID NUMBER(3)ADVISOR_ID NUMBER(5)
Evaluate this statement:SELECT DISTINCT advisor_id, main_subject_idFROM student;
Which statement is true?Mark for Review(1) Points
Each ADVISOR_ID can be displayed only once.
Each MAIN_SUBJECT_ID can be displayed more than once per ADVISOR_ID. (*)
Each combination of ADVISOR_ID and MAIN_SUBJECT_ID can be displayed more than once.
Each MAIN_SUBJECT_ID can be displayed only once per query.
Incorrect. See Section 17
24. 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 KEYLAST_NAME VARCHAR2(35)HIREDATE DATEDEPARTMENT_ID NUMBER(4)
The SALARY table contains these columns:
SALARYID VARCHAR2(5) PRIMARY KEYSALARY NUMBER(5, 2)EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY
Which query should you issue?Mark for Review(1) Points
SELECT last_name, hiredate, salaryFROM employees NATURAL JOIN salary USING employee_idWHERE hiredate < 01-jan-00 AND salary > 50000;
SELECT last_name, hiredate, salaryFROM employees JOIN salaryON employee_id = employee_idWHERE hiredate < ’01-jan-00′ AND salary > 50000;
SELECT last_name, hiredate, salaryFROM employees NATURAL JOIN salaryWHERE hiredate < ’01-jan-00′ AND salary > 50000;(*)
SELECT last_name, hiredate, salaryFROM employees (+) salaryWHERE hiredate < ’01-jan-00′ AND salary > 50000;
Incorrect
25. The EMPLOYEES table includes these columns:EMPLOYEE_ID NUMBER(4) NOT NULLLAST_NAME VARCHAR2(15) NOT NULLFIRST_NAME VARCHAR2(10) NOT NULLHIRE_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?Mark for Review(1) Points
SELECT last_name, first_name, hire_dateFROM employeesWHERE hire_date BETWEEN ’01-MAR-00′ AND ’30-AUG-00′;(*)
SELECT last_name, first_name, hire_dateFROM employeesWHERE hire_date BETWEEN ’30-AUG-00′ AND ’01-MAR-00′;
SELECT last_name, first_name, hire_dateFROM employeesGROUP BY hire_date >= ’01-MAR-00′ and hire_date <= ’30- AUG-00′;
SELECT last_name, first_name, hire_dateFROM employeesAND hire_date >= ’01-MAR-00′ and hire_date <= ’30-AUG- 00′;
Correct.
26. 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? Mark for Review(1) Points
The ESCAPE option (\) and one or more percent signs (%)
The (+) operator
A percent sign (%)
The ESCAPE option (\) (*)
Incorrect. See Section 17
27. Evaluate this SELECT statement:SELECT *FROM employeesWHERE department_id IN(10, 20, 30)AND salary > 20000;
Which values would cause the logical condition to return TRUE?Mark for Review(1) Points
DEPARTMENT_ID = 10 and SALARY = 20000
DEPARTMENT_ID = 20 and SALARY = 20000
DEPARTMENT_ID = null and SALARY = 20001
DEPARTMENT_ID = 10 and SALARY = 20001 (*)
Correct. See Section 17
28. If the EMPLOYEES table has the following columns, and you want to write a SELECT statement to return the employee last name and department number for employee number 176, which of the following SQL statements should you use?Name Type LengthEMPLOYEE_ID NUMBER 22FIRST_NAME VARCHAR2 20LAST_NAME VARCHAR2 25EMAIL VARCHAR2 25PHONE_NUMBER VARCHAR2 20SALARY NUMBER 22COMMISSION_PCT NUMBER 22MANAGER_ID NUMBER 22DEPARTMENT_ID NUMBER 22
Mark for Review(1) Points
SELECT last_name, department_idFROM employeesWHERE employee_id = 176;(*)
SELECT last_name, department_idFROM employeesWHERE employee_id equals 176;
SELECT first_name, employee_idFROM employeesWHERE employee_id = 176;
SELECT last_name, employee_idFROM employeesWHERE employee_id equals 176;
Correct.
29. Evaluate this SELECT statement:SELECT last_name, first_name, salaryFROM employees;
How will the heading for the SALARY column appear in the display by default in Oracle Application Express?Mark for Review(1) Points
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.
Correct.
30. You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values? Mark for Review(1) Points
=
!=
IN (*)
BETWEEN..AND..
Correct.
Page 3 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 17
31. Which comparison operator searches for a specified character pattern? Mark for Review(1) Points
IN
LIKE (*)
BETWEEN…AND…
IS NULL
Incorrect. See Section 17.
32. 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
Incorrect. See Section 17
33. Which symbol represents the not equal to condition? Mark for Review(1) Points
#
‘+’
!= (*)
~
Correct.
34. Which of the following elements cannot be included in a WHERE clause? Mark for Review(1) Points
A column alias (*)
A column name
A comparison condition
A constant
Correct.
35. Where in a SQL statement can you not use arithmetic operators? Mark for Review(1) Points
SELECT
FROM (*)
WHERE
NONE
Incorrect. See Section 17.
36. Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10? Mark for Review(1) Points
WHERE (*)
FROM
SELECT
IS
Correct.
Section 18
37. Which of the following best describes the meaning of the LIKE operator? Mark for Review(1) Points
Display rows based on a range of values.
To test for values in a list.
Match a character pattern. (*)
To find Null values.
Incorrect. See Section 18
38. The ORDER BY clause always comes last. True or False? Mark for Review(1) Points
True (*)
False
Correct.
39. Which of the following is TRUE regarding the logical AND operator? Mark for Review(1) Points
TRUE AND TRUE return FALSE
TRUE AND FALSE return TRUE
FALSE AND TRUE return NULL
TRUE AND FALSE return FALSE (*)
Incorrect. See Section 18
40. 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
Incorrect. See Section 18
Page 4 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 18
41. Which comparison condition means “Less Than or Equal To?” Mark for Review(1) Points
“=)”
“+<”
“>=”
“<=” (*)
Correct.
42. 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
DESC (*)
ASC
SORT
CHANGE
Correct.
43. What value will the following SQL statement return?SELECT employee_idFROM employeesWHERE employee_id BETWEEN 100 AND 150OR employee_id IN(119, 175, 205)AND (employee_id BETWEEN 150 AND 200);
Mark for Review(1) Points
19
No rows will be returned
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
200, 201, 202, 203, 204, 205, 206
Correct.
44. 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_nameFROM productsWHERE price < 50;(*)
SELECT product_id, product_nameFROM productsHAVING price < 50;
SELECT product_id, product_nameFROM productsWHERE price <= 50;
SELECT product_id, product_nameFROM productsGROUP BY price < 50;
SELECT product_id, product_nameFROM productsWHERE price < 50.00GROUP BY price;
Correct.
45. Evaluate this SELECT statement:SELECT last_name, first_name, department_id, manager_idFROM 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?Mark for Review(1) Points
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
Correct.
46. Evaluate this SELECT statement:SELECT *FROM employeesWHERE salary > 30000AND department_id = 10OR email IS NOT NULL;Which statement is true?
Mark for Review(1) Points
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
Correct.
47. Evaluate this SELECT statement:SELECT last_name, first_name, emailFROM employeesORDER BY email;
If the EMAIL column contains null values, which statement is true?Mark for Review(1) Points
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.
Incorrect! See Section 18.
48. Evaluate this SELECT statement:SELECT *FROM employeesWHERE department_id = 34OR department_id = 45OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?Mark for Review(1) Points
IN (*)
AND
LIKE
BETWEEN … AND …
Correct.
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?Mark for Review(1) Points
SELECT last_name, first_name, team_id, salaryFROM playersWHERE (salary > 25000 OR salary < 100000)AND team_id BETWEEN 1200 AND 1500ORDER BY team_id, salary;
SELECT last_name, first_name, team_id, salaryFROM playersWHERE salary BETWEEN 25000 AND 100000AND team_id BETWEEN 1200 AND 1500ORDER BY team_id, salary DESC;(*)
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;
Correct.
50. Evaluate this SQL statement:SELECT e.employee_id, e.last_name, e.first_name, m.manager_idFROM employees e, employees mORDER BY e.last_name, e.first_nameWHERE 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 WHERE clause.
Remove the table aliases in the ORDER BY clause.
Include a HAVING clause.
Incorrect! See Section 18.
Page 5 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 12
1. In a physical data model, a relationship is represented as a combination of: (Choose Two) Mark for Review(1) Points
(Choose all correct answers)
Column
Primary Key or Unique Key (*)
Check Constraint or Unique Key
Foreign Key (*)
Correct
2. In a physical data model, an attribute becomes a _____________. Mark for Review(1) Points
Table
Foreign Key
Constraint
Column (*)
Correct
3. Why would this table name NOT work in an Oracle database? this_year_end+next_year Mark for Review(1) Points
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names (*)
None of the above
Correct
4. 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? Mark for Review(1) Points
True
False (*)
Correct
5. Which of the following are reasons why you should consider using a Subtype Implementation? Mark for Review(1) Points
The resulting table will reside in a single database and be used by just ONE user.
When the common access paths for the supertypes are different.
Business functionality and business rules, access paths and frequency of access are all very different between subtypes. (*)
Most of the relationships are at the supertype level
Correct
6. The Oracle Database can implement a many to many relationship. You simply create two foreign keys between the two tables. True or False? Mark for Review(1) Points
True
False (*)
Correct
7. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? Mark for Review(1) Points
True
False (*)
Incorrect. Refer to Section 12
8. The text below is an example of what constraint type:The value in the manager_id column of the EMPLOYEES table must match a value in the employee_id column in the EMPLOYEES table.Mark for Review(1) Points
Entity integrity
User-defined integrity
Column integrity
Referential integrity (*)
Correct
9. Entity integrity refers to Mark for Review(1) Points
Tables always containing text data
Tables always containing numeric data
Columns having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database.
Tables having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database. (*)
Incorrect. Refer to Section 12
10. Identify all of the incorrect statements that complete this sentence: A primary key is: (Choose three) Mark for Review(1) Points
(Choose all correct answers)
A single column that uniquely identifies each column in a table (*)
One or more columns in a table that uniquely identifies each row in that table
A set of columns in one table that uniquely identifies each row in another table (*)
Only one column that must be null (*)
Incorrect. Refer to Section 12
Page 1 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 12
11. 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?
Mark for Review(1) Points
True (*)
False
Correct
Section 13
12. The DESCRIBE command returns all rows from a table. True or False? Mark for Review(1) Points
True
False (*)
Correct.
13. What command can be used to create a new row in a table in the database? Mark for Review(1) Points
CREATE
NEW
ADD
INSERT (*)
Correct.
Section 16
14. In a SQL statement, which clause specifies one or more columns to be returned by the query? Mark for Review(1) Points
SELECT (*)
FROM
WHERE
Any of the above options, you can list columns wherever you want to in a SELECT statement.
Incorrect. See Section 16
15. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL query? Mark for Review(1) Points
AS (*)
OR
AND
SUBSTITUTE
Correct.
16. The SELECT statement retrieves information from the database. In a SELECT statement, you can do all of the following EXCEPT: Mark for Review(1) Points
Projection
Manipulation (*)
Joining
Selection
Correct.
17. When listing columns in the SELECT list, what should you use to separate the columns? Mark for Review(1) Points
Commas (*)
Semicolons
Dashes
Underscores
Correct.
18. In the default order of precedence, which operator would be evaluated first? Mark for Review(1) Points
Subtractions
Multiplications (*)
Additions
Divisions
Correct.
19. 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? Mark for Review(1) Points
Joining only
Selection only
Projection only (*)
Projection and Selection
Incorrect. See Section 16
20. In which clause of a SELECT statement would you specify the name of the table or tables being queried? Mark for Review(1) Points
The FROM clause (*)
The SELECT clause
The WHERE clause
Any of the above options, you can list tables wherever you want to in a SELECT statement.
Incorrect. See Section 16
Page 2 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 16
21. There is only one kind of software used by all computers. True or False? Mark for Review(1) Points
True
False (*)
Correct.
22. In a SELECT statement Additions are evaluated before Multiplications. True or False? Mark for Review(1) Points
True
False (*)
Correct.
Section 17
23. If the EMPLOYEES table has the following columns, and you want to write a SELECT statement to return the employee last name and department number for employee number 176, which of the following SQL statements should you use?Name Type LengthEMPLOYEE_ID NUMBER 22FIRST_NAME VARCHAR2 20LAST_NAME VARCHAR2 25EMAIL VARCHAR2 25PHONE_NUMBER VARCHAR2 20SALARY NUMBER 22COMMISSION_PCT NUMBER 22MANAGER_ID NUMBER 22DEPARTMENT_ID NUMBER 22
Mark for Review(1) Points
SELECT last_name, department_idFROM employeesWHERE employee_id = 176;(*)
SELECT last_name, department_idFROM employeesWHERE employee_id equals 176;
SELECT first_name, employee_idFROM employeesWHERE employee_id = 176;
SELECT last_name, employee_idFROM employeesWHERE employee_id equals 176;
Correct.
24. 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? Mark for Review(1) Points
% (*)
~
#
*
Correct. See Section 17
25. Evaluate this SELECT statement:SELECT last_name, first_name, salaryFROM employees;
How will the heading for the SALARY column appear in the display by default in Oracle Application Express?Mark for Review(1) Points
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.
Correct.
26. Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table? Mark for Review(1) Points
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;
Incorrect. See Section 17.
27. You need to display all the employees whose last name starts with the letters Sm . Which WHERE clause should you use? Mark for Review(1) Points
WHERE last_name LIKE ‘Sm%’ (*)
WHERE last_name LIKE ‘%Sm’
WHERE last_name LIKE ‘_Sm’
WHERE last_name LIKE ‘Sm_’
Correct. See Section 17
28. The STUDENT table contains these columns:STUDENT_ID NUMBER(10) Primary KeyLAST_NAME VARCHAR2(25)FIRST_NAME VARCHAR2(25)MAIN_SUBJECT_ID NUMBER(3)ADVISOR_ID NUMBER(5)
Evaluate this statement:SELECT DISTINCT advisor_id, main_subject_idFROM student;
Which statement is true?Mark for Review(1) Points
Each ADVISOR_ID can be displayed only once.
Each MAIN_SUBJECT_ID can be displayed more than once per ADVISOR_ID. (*)
Each combination of ADVISOR_ID and MAIN_SUBJECT_ID can be displayed more than once.
Each MAIN_SUBJECT_ID can be displayed only once per query.
Correct. See Section 17
29. The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9) PrimaryKeyLAST_NAME VARCHAR2 (20)FIRST_NAME VARCHAR2 (20)DEPARTMENT_ID NUMBER(5) NOT NULLMANAGER_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?Mark for Review(1) Points
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 EMPLOYEES table
The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.
Correct. See Section 17
30. 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? Mark for Review(1) Points
True
False (*)
Correct.
Page 3 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 17
31. Which comparison condition would you use to select rows that match a character pattern? Mark for Review(1) Points
IN
LIKE (*)
ALMOST
SIMILAR
Incorrect. See Section 17.
32. You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use? Mark for Review(1) Points
IN
LIKE
BETWEEN…AND… (*)
IS NULL
Correct.
33. 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
Correct. See Section 17
34. Which comparison operator searches for a specified character pattern? Mark for Review(1) Points
IN
LIKE (*)
BETWEEN…AND…
IS NULL
Incorrect. See Section 17.
35. Where in a SQL statement can you not use arithmetic operators? Mark for Review(1) Points
SELECT
FROM (*)
WHERE
NONE
Correct.
36. Which symbol represents the not equal to condition? Mark for Review(1) Points
#
‘+’
!= (*)
~
Correct.
Section 18
37. Evaluate this SQL statement:SELECT e.employee_id, e.last_name, e.first_name, m.manager_idFROM employees e, employees mORDER BY e.last_name, e.first_nameWHERE 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 WHERE clause.
Remove the table aliases in the ORDER BY clause.
Include a HAVING clause.
Correct.
38. 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, salaryFROM playersWHERE (salary > 25000 OR salary < 100000)
AND team_id BETWEEN 1200 AND 1500ORDER BY team_id, salary;
SELECT last_name, first_name, team_id, salaryFROM playersWHERE salary BETWEEN 25000 AND 100000AND team_id BETWEEN 1200 AND 1500ORDER BY team_id, salary DESC;(*)
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;
Correct.
39. Which statement about the default sort order is true? Mark for Review(1) Points
The lowest numeric values are displayed last.
The earliest date values are displayed first. (*)
Null values are displayed first.
Character values are displayed in reverse alphabetical order.
Correct.
40. The ORDER BY clause always comes last. True or False? Mark for Review(1) Points
True (*)
False
Correct.
Page 4 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 18
41. Which logical operator returns TRUE if either condition is true? Mark for Review(1) Points
OR (*)
AND
NOT
BOTH
Correct.
42. Which comparison condition means “Less Than or Equal To?” Mark for Review(1) Points
“=)”
“+<”
“>=”
“<=” (*)
Correct.
43. Which of the following is TRUE regarding the logical AND operator? Mark for Review(1) Points
TRUE AND TRUE return FALSE
TRUE AND FALSE return TRUE
FALSE AND TRUE return NULL
TRUE AND FALSE return FALSE (*)
Correct.
44. Which statement about the ORDER BY clause is true? Mark for Review(1) Points
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
Correct.
45. 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.)Mark for Review(1) Points
(Choose all correct answers)
1
50
25 (*)
10
250 (*)
100
Correct.
46. Evaluate this SQL statement:SELECT product_id, product_name, price
FROM productsORDER BY product_name, price;
What occurs when the statement is executed?Mark for Review(1) Points
The results are sorted numerically only.
The results are sorted alphabetically only.
The results are sorted numerically and then alphabetically.
The results are sorted alphabetically and then numerically. (*)
Correct.
47. Evaluate this SELECT statement:SELECT last_name, first_name, emailFROM employeesORDER BY email;
If the EMAIL column contains null values, which statement is true?Mark for Review(1) Points
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.
Correct.
48. What value will the following SQL statement return?SELECT employee_idFROM employeesWHERE employee_id BETWEEN 100 AND 150OR employee_id IN(119, 175, 205)AND (employee_id BETWEEN 150 AND 200);
Mark for Review(1) Points
19
No rows will be returned
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
200, 201, 202, 203, 204, 205, 206
Correct.
49. 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_nameFROM productsWHERE price < 50;(*)
SELECT product_id, product_nameFROM productsHAVING price < 50;
SELECT product_id, product_nameFROM productsWHERE price <= 50;
SELECT product_id, product_nameFROM productsGROUP BY price < 50;
SELECT product_id, product_nameFROM productsWHERE price < 50.00GROUP BY price;
Correct.
50. Evaluate this SELECT statement:SELECT *FROM employeesWHERE department_id = 34OR department_id = 45OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?Mark for Review(1) Points
IN (*)
AND
LIKE
BETWEEN … AND …
Correct.
Page 5 of 5
hoi
Section 12
1. In a physical data model, a relationship is represented as a combination of: (Choose Two) Markeren voor nakijken(1) Punten
(Kies alle goede antwoorden.)
Column
Primary Key or Unique Key (*)
Check Constraint or Unique Key
Foreign Key (*)
Correct
2. In an Oracle database, why would 1_TABLE not work as a table name? Markeren voor nakijken(1) Punten
The database does not understand all capital letters
There is no problem here. You can create a table called 1_TABLE.
Object names must not start with a number. They must begin with a letter (*)
TABLE is a reserved word
Correct
3. The transformation from an ER diagram to a physical design involves changing terminology. Primary Unique Identifiers in the ER diagram become __________ and relationships become ____________. Markeren voor nakijken(1) Punten
Foreign keys, Primary keys
Primary keys, Foreign keys (*)
Foreign keys, mandatory business rules
Unique Keys, Primary keys
Incorrect. Refer to Section 12
4. The text below is an example of what constraint type:The value in the manager_id column of the EMPLOYEES table must match a value in the employee_id column in the EMPLOYEES table. Markeren voor nakijken(1) Punten
Entity integrity
User-defined integrity
Column integrity
Referential integrity (*)
Incorrect. Refer to Section 12
5. A table must have at least one candidate key, as well as its primary key. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
6. 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? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
7. 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? Markeren voor nakijken(1) Punten
Waar (*)
Niet waar
Correct
8. What do you create when you transform a many to many relationship from your ER diagram into a physical design? Markeren voor nakijken(1) Punten
Unique key constraints
Intersection entity
Intersection table (*)
Two tables with Foreign key constraints between them
Incorrect. Refer to Section 12
9. The Oracle Database can implement a many to many relationship. You simply create two foreign keys between the two tables. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
10. 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? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct
Section 12
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? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct
Section 13
12. What command can be used to create a new row in a table in the database? Markeren voor nakijken(1) Punten
CREATE
NEW
ADD
INSERT (*)
Incorrect. Refer to Section 13
13. The _______ clause can be added to a SELECT statement to return a subset of the data. Markeren voor nakijken(1) Punten
ANYWHERE
WHICH
WHERE (*)
EVERY
Incorrect. Refer to Section 13
Section 16
14. All computers in the world speak the same languages, so you only need to learn one programming language – Oracle SQL. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. See Section 16
15. You cannot use computers unless you completely understand exactly how they work. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct.
16. When listing columns in the SELECT list, what should you use to separate the columns? Markeren voor nakijken(1) Punten
Commas (*)
Semicolons
Dashes
Underscores
Correct.
17. You query the database with this SQL statement:SELECT * FROM students;
Why would you use this statement? Markeren voor nakijken(1) Punten
To insert data
To view data (*)
To display the table structure
To delete data
Incorrect. See Section 16
18. In which clause of a SELECT statement would you specify the name of the table or tables being queried? Markeren voor nakijken(1) Punten
The FROM clause (*)
The SELECT clause
The WHERE clause
Any of the above options, you can list tables wherever you want to in a SELECT statement.
Incorrect. See Section 16
19. Which statement best describes how arithmetic expressions are handled? Markeren voor nakijken(1) Punten
Addition operations are handled before any other operations.
Multiplication and subtraction 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. (*)
Correct.
20. The SELECT statement retrieves information from the database. In a SELECT statement, you can do all of the following EXCEPT: Markeren voor nakijken(1) Punten
Projection
Manipulation (*)
Joining
Selection
Incorrect. See Section 16
Section 16
21. You query the database with this SQL statement:SELECT *FROM transactionWHERE product_id = 4569;Which SQL SELECT statement capabilities are achieved when this statement is executed? Markeren voor nakijken(1) Punten
Selection only (*)
Projection only
Selection and projection only
Projection, selection and joining
Correct.
22. If a SQL statement returns data from two or more tables, which SQL capability is being used? Markeren voor nakijken(1) Punten
Selection
Projection
Joining (*)
Insertion
Incorrect. See Section 16
Section 17
23. You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use? Markeren voor nakijken(1) Punten
IN
LIKE
BETWEEN…AND… (*)
IS NULL
Correct.
24. When using the LIKE condition, which symbol represents any sequence of none, one or more characters? Markeren voor nakijken(1) Punten
_
% (*)
#
&
Incorrect. See Section 17.
25. 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? Markeren voor nakijken(1) Punten
“= NULL”
NULL!
ISNULL
IS NULL (*)
Incorrect. See Section 17.
26. Where in a SQL statement can you not use arithmetic operators? Markeren voor nakijken(1) Punten
SELECT
FROM (*)
WHERE
NONE
Incorrect. See Section 17.
27. What does the DISTINCT keyword do when it is used in a SELECT clause? Markeren voor nakijken(1) Punten
Hides NULL values
Eliminates all unique values and compares values
Eliminates duplicate rows in the result (*)
Eliminates only unique rows in the result
Incorrect. See Section 17
28. Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10? Markeren voor nakijken(1) Punten
WHERE (*)
FROM
SELECT
IS
Correct.
29. The EMPLOYEES table includes these columns:EMPLOYEE_ID NUMBER(4) NOT NULLLAST_NAME VARCHAR2(15) NOT NULLFIRST_NAME VARCHAR2(10) NOT NULLHIRE_DATE DATE NOT NULLYou 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? Markeren voor nakijken(1) Punten
SELECT last_name, first_name, hire_dateFROM employeesWHERE hire_date BETWEEN ’01-MAR-00′ AND ’30-AUG-00′;(*)
SELECT last_name, first_name, hire_dateFROM employeesWHERE hire_date BETWEEN ’30-AUG-00′ AND ’01-MAR-00′;
SELECT last_name, first_name, hire_dateFROM employeesGROUP BY hire_date >= ’01-MAR-00′ and hire_date = ’01-MAR-00′ and hire_date 20000;Which values would cause the logical condition to return TRUE? Markeren voor nakijken(1) Punten
DEPARTMENT_ID = 10 and SALARY = 20000
DEPARTMENT_ID = 20 and SALARY = 20000
DEPARTMENT_ID = null and SALARY = 20001
DEPARTMENT_ID = 10 and SALARY = 20001 (*)
Correct. See Section 17
34. You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values? Markeren voor nakijken(1) Punten
=
!=
IN (*)
BETWEEN..AND..
Correct.
35. Evaluate this SELECT statement:SELECT last_name, first_name, salaryFROM employees;
How will the heading for the SALARY column appear in the display by default in Oracle Application Express? Markeren voor nakijken(1) Punten
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.
Incorrect. See Section 17.
36. 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? Markeren voor nakijken(1) Punten
The ESCAPE option (\) and one or more percent signs (%)
The (+) operator
A percent sign (%)
The ESCAPE option (\) (*)
Incorrect. See Section 17
Section 18
37. 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? Markeren voor nakijken(1) Punten
SELECT last_name, first_name, team_id, salaryFROM playersWHERE (salary > 25000 OR salary 24999.99 AND salary = 6900ORDER BY last_name, first_name;(*)
SELECT last_name, first_nameFROM playersWHERE position_id > 6900ORDER BY last_name, first_name;
SELECT last_name, first_nameFROM playersWHERE position_id = 6900ORDER BY last_name DESC, first_name;
Correct.
39. Which statement about the logical operators is true? Markeren voor nakijken(1) Punten
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. (*)
Incorrect. See Section 18
40. Which of the following is TRUE regarding the logical AND operator? Markeren voor nakijken(1) Punten
TRUE AND TRUE return FALSE
TRUE AND FALSE return TRUE
FALSE AND TRUE return NULL
TRUE AND FALSE return FALSE (*)
Correct.
Section 18
41. Which logical operator returns TRUE if either condition is true? Markeren voor nakijken(1) Punten
OR (*)
AND
NOT
BOTH
Correct.
42. Which comparison condition means “Less Than or Equal To?” Markeren voor nakijken(1) Punten
“=)”
“+=”
” 50);Which two values could the statement return? (Choose two.) Markeren voor nakijken(1) Punten
(Kies alle goede antwoorden.)
1
50
25 (*)
10
250 (*)
100
Incorrect! See Section 18.
48. Evaluate this SQL statement:SELECT product_id, product_name, priceFROM productsORDER BY product_name, price;What occurs when the statement is executed? Markeren voor nakijken(1) Punten
The results are sorted numerically only.
The results are sorted alphabetically only.
The results are sorted numerically and then alphabetically.
The results are sorted alphabetically and then numerically. (*)
Correct.
49. What value will the following SQL statement return?SELECT employee_idFROM employeesWHERE employee_id BETWEEN 100 AND 150OR employee_id IN(119, 175, 205)AND (employee_id BETWEEN 150 AND 200); Markeren voor nakijken(1) Punten
19
No rows will be returned
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
200, 201, 202, 203, 204, 205, 206
Incorrect! See Section 18.
50. Evaluate this SELECT statement:SELECT *FROM employeesWHERE salary > 30000AND department_id = 10OR email IS NOT NULL;Which statement is true? Markeren voor nakijken(1) Punten
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
Correct.
Section 12
1. An “Arc Implementation” can be done just like any other Relationship – you simply add the required Foreign Keys. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
2. Which of the following are reasons why you should consider using a Subtype Implementation? Markeren voor nakijken(1) Punten
The resulting table will reside in a single database and be used by just ONE user.
When the common access paths for the supertypes are different.
Business functionality and business rules, access paths and frequency of access are all very different between subtypes. (*)
Most of the relationships are at the supertype level
Incorrect. Refer to Section 12
3. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct
4. The Oracle Database can implement a many to many relationship. You simply create two foreign keys between the two tables. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct
5. 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? Markeren voor nakijken(1) Punten
Waar (*)
Niet waar
Correct
6. A foreign key cannot refer to a primary key in the same table. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
7. 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. Markeren voor nakijken(1) Punten
Entity integrity
User-defined integrity (*)
Column integrity
Referential integrity
Correct
8. A table must have a primary key. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
9. Why would this table name NOT work in an Oracle database? this_year_end+next_year Markeren voor nakijken(1) Punten
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names (*)
None of the above
Correct
10. In a physical data model, an attribute becomes a _____________. Markeren voor nakijken(1) Punten
Table
Foreign Key
Constraint
Column (*)
Incorrect. Refer to Section 12
Section 12
11. In an Oracle database, why would 1_TABLE not work as a table name? Markeren voor nakijken(1) Punten
The database does not understand all capital letters
There is no problem here. You can create a table called 1_TABLE.
Object names must not start with a number. They must begin with a letter (*)
TABLE is a reserved word
Incorrect. Refer to Section 12
Section 13
12. The _______ clause can be added to a SELECT statement to return a subset of the data. Markeren voor nakijken(1) Punten
ANYWHERE
WHICH
WHERE (*)
EVERY
Correct.
13. What command will return data from the database to you? Markeren voor nakijken(1) Punten
FETCH
GET
SELECT (*)
RETURN
Correct.
Section 16
14. There is only one kind of software used by all computers. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct.
15. In a SELECT statement Additions are evaluated before Multiplications. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct.
16. You query the database with this SQL statement:SELECT *FROM transactionWHERE product_id = 4569;Which SQL SELECT statement capabilities are achieved when this statement is executed? Markeren voor nakijken(1) Punten
Selection only (*)
Projection only
Selection and projection only
Projection, selection and joining
Incorrect. See Section 16
17. You query the database with this SQL statement:SELECT * FROM students;Why would you use this statement? Markeren voor nakijken(1) Punten
To insert data
To view data (*)
To display the table structure
To delete data
Correct.
18. In a SQL statement, which clause specifies one or more columns to be returned by the query? Markeren voor nakijken(1) Punten
SELECT (*)
FROM
WHERE
Any of the above options, you can list columns wherever you want to in a SELECT statement.
Incorrect. See Section 16
19. Which SQL statement will return an error? Markeren voor nakijken(1) Punten
SEL * FR sky; (*)
select star from sky;
SELECT star FROM sky;
SELECT * FROM sky;
Incorrect. See Section 16
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? Markeren voor nakijken(1) Punten
Joining only
Selection only
Projection only (*)
Projection and Selection
Correct.
Section 16
21. When listing columns in the SELECT list, what should you use to separate the columns? Markeren voor nakijken(1) Punten
Commas (*)
Semicolons
Dashes
Underscores
Correct.
22. In the default order of precedence, which operator would be evaluated first? Markeren voor nakijken(1) Punten
Subtractions
Multiplications (*)
Additions
Divisions
Correct.
Section 17
23. 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? Markeren voor nakijken(1) Punten
“= NULL”
NULL!
ISNULL
IS NULL (*)
Correct.
24. You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use? Markeren voor nakijken(1) Punten
>
“=>”
>= (*)
!=
Correct.
25. Where in a SQL statement can you not use arithmetic operators? Markeren voor nakijken(1) Punten
SELECT
FROM (*)
WHERE
NONE
Incorrect. See Section 17.
26. Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10? Markeren voor nakijken(1) Punten
WHERE (*)
FROM
SELECT
IS
Correct.
27. You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use? Markeren voor nakijken(1) Punten
IN
LIKE
BETWEEN…AND… (*)
IS NULL
Correct.
28. The Concatenation Operator does which of the following? Markeren voor nakijken(1) Punten
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.
Correct. See Section 17
29. The EMPLOYEES table includes these columns:EMPLOYEE_ID NUMBER(4) NOT NULLLAST_NAME VARCHAR2(15) NOT NULLFIRST_NAME VARCHAR2(10) NOT NULLHIRE_DATE DATE NOT NULLYou 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? Markeren voor nakijken(1) Punten
SELECT last_name, first_name, hire_dateFROM employeesWHERE hire_date BETWEEN ’01-MAR-00′ AND ’30-AUG-00′;(*)
SELECT last_name, first_name, hire_dateFROM employeesWHERE hire_date BETWEEN ’30-AUG-00′ AND ’01-MAR-00′;
SELECT last_name, first_name, hire_dateFROM employeesGROUP BY hire_date >= ’01-MAR-00′ and hire_date = ’01-MAR-00′ and hire_date 50);Which two values could the statement return? (Choose two.) Markeren voor nakijken(1) Punten
(Kies alle goede antwoorden.)
1
50
25 (*)
10
250 (*)
100
Correct.
45. Which SELECT statement should you use to limit the display of product information to those products with a price of less than 50? Markeren voor nakijken(1) Punten
SELECT product_id, product_nameFROM productsWHERE price < 50;(*)
SELECT product_id, product_nameFROM productsHAVING price < 50;
SELECT product_id, product_nameFROM productsWHERE price <= 50;
SELECT product_id, product_nameFROM productsGROUP BY price < 50;
SELECT product_id, product_nameFROM productsWHERE price 25000 OR 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;
Correct.
50. The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9) PKLAST_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_nameFROM employees
ORDER BY department_id;2.SELECT department_id DEPT, last_name, first_nameFROM employeesORDER BY DEPT;How will the results differ? Markeren voor nakijken(1) Punten
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.
Incorrect! See Section 18.
anonymous
1. A table must have a primary key. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
2. 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? Markeren voor nakijken(1) Punten
Waar (*)
Niet waar
Correct
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. Markeren voor nakijken(1) Punten
Entity integrity
User-defined integrity (*)
Column integrity
Referential integrity
Incorrect. Refer to Section 12
4. A foreign key cannot refer to a primary key in the same table. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
5. In an Oracle database, why would 1_TABLE not work as a table name? Markeren voor nakijken(1) Punten
The database does not understand all capital letters
There is no problem here. You can create a table called 1_TABLE.
Object names must not start with a number. They must begin with a letter (*)
TABLE is a reserved word
Incorrect. Refer to Section 12
6. Why would this table name NOT work in an Oracle database? this_year_end+next_year Markeren voor nakijken(1) Punten
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names (*)
None of the above
Correct
7. Attributes become tables in a database. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
8. 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? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
9. An “Arc Implementation” can be done just like any other Relationship – you simply add the required Foreign Keys. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Incorrect. Refer to Section 12
10. Many to many relationships are implemented via a structure called a: ________________ Markeren voor nakijken(1) Punten
Supertype
Intersection Table (*)
Intersection Entity
Subtype
Incorrect. Refer to Section 12
Section 12
11. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct
Section 13
12. What command can be used to create a new row in a table in the database? Markeren voor nakijken(1) Punten
CREATE
NEW
ADD
INSERT (*)
Correct.
13. The _______ clause can be added to a SELECT statement to return a subset of the data. Markeren voor nakijken(1) Punten
ANYWHERE
WHICH
WHERE (*)
EVERY
Correct.
Section 16
14. In a SELECT clause, what is the result of 2 + 3 * 2? Markeren voor nakijken(1) Punten
6
8 (*)
10
13
Correct.
15. In a SQL statement, which clause specifies one or more columns to be returned by the query? Markeren voor nakijken(1) Punten
SELECT (*)
FROM
WHERE
Any of the above options, you can list columns wherever you want to in a SELECT statement.
Incorrect. See Section 16
16. When listing columns in the SELECT list, what should you use to separate the columns? Markeren voor nakijken(1) Punten
Commas (*)
Semicolons
Dashes
Underscores
Correct.
17. In the default order of precedence, which operator would be evaluated first? Markeren voor nakijken(1) Punten
Subtractions
Multiplications (*)
Additions
Divisions
Incorrect. See Section 16
18. If a SQL statement returns data from two or more tables, which SQL capability is being used? Markeren voor nakijken(1) Punten
Selection
Projection
Joining (*)
Insertion
Incorrect. See Section 16
19. The SELECT statement retrieves information from the database. In a SELECT statement, you can do all of the following EXCEPT: Markeren voor nakijken(1) Punten
Projection
Manipulation (*)
Joining
Selection
Incorrect. See Section 16
20. Which SQL statement will return an error? Markeren voor nakijken(1) Punten
SEL * FR sky; (*)
select star from sky;
SELECT star FROM sky;
SELECT * FROM sky;
Correct.
Section 16
21. In a SELECT statement Additions are evaluated before Multiplications. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct.
22. You cannot use computers unless you completely understand exactly how they work. True or False? Markeren voor nakijken(1) Punten
Waar
Niet waar (*)
Correct.
Section 17
23. Where in a SQL statement can you not use arithmetic operators? Markeren voor nakijken(1) Punten
SELECT
FROM (*)
WHERE
NONE
Incorrect. See Section 17.
24. Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10? Markeren voor nakijken(1) Punten
WHERE (*)
FROM
SELECT
IS
Correct.
25. Which of the following elements cannot be included in a WHERE clause? Markeren voor nakijken(1) Punten
A column alias (*)
A column name
A comparison condition
A constant
Incorrect. See Section 17.
26. Which operator is used to combine columns of character strings to other columns? Markeren voor nakijken(1) Punten
*
/
+
|| (*)
Incorrect. See Section 17
27. What does the DISTINCT keyword do when it is used in a SELECT clause? Markeren voor nakijken(1) Punten
Hides NULL values
Eliminates all unique values and compares values
Eliminates duplicate rows in the result (*)
Eliminates only unique rows in the result
Correct. See Section 17
28. You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use? Markeren voor nakijken(1) Punten
IN
LIKE
BETWEEN…AND… (*)
IS NULL
Incorrect. See Section 17.
29. Evaluate this SELECT statement:SELECT *FROM employeesWHERE department_id IN(10, 20, 30)AND salary > 20000;Which values would cause the logical condition to return TRUE? Markeren voor nakijken(1) Punten
DEPARTMENT_ID = 10 and SALARY = 20000
DEPARTMENT_ID = 20 and SALARY = 20000
DEPARTMENT_ID = null and SALARY = 20001
DEPARTMENT_ID = 10 and SALARY = 20001 (*)
Incorrect. See Section 17
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? Markeren voor nakijken(1) Punten
AND
IN
BETWEEN
LIKE (*)
Correct. See Section 17
Section 17
31. You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values? Markeren voor nakijken(1) Punten
=
!=
IN (*)
BETWEEN..AND..
Incorrect. See Section 17.
32. 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? Markeren voor nakijken(1) Punten
% (*)
~
#
*
Correct. See Section 17
33. You want to determine the orders that have been placed by customers who reside in Chicago. You write this partial SELECT statement:SELECT orderid, orderdate, totalFROM orders;What should you include in your SELECT statement to achieve the desired results? Markeren voor nakijken(1) Punten
AND city = Chicago;
AND city = ‘Chicago’;
WHERE city = ‘Chicago’; (*)
WHERE city = Chicago;
Correct.
34. The EMPLOYEES table contains these columns:LAST_NAME VARCHAR2(25)FIRST_NAME VARCHAR2(25)EMAIL VARCHAR2(50)You are writing a SELECT statement to retrieve the names of employees that have an email address.SELECT last_name||’, ‘||first_name “Employee Name”FROM employees;Which WHERE clause should you use to complete this statement? Markeren voor nakijken(1) Punten
WHERE email = NULL;
WHERE email != NULL;
WHERE email IS NULL;
WHERE email IS NOT NULL; (*)
Incorrect. See Section 17.
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 KEYLAST_NAME VARCHAR2(35)HIREDATE DATEDEPARTMENT_ID NUMBER(4)The SALARY table contains these columns:SALARYID VARCHAR2(5) PRIMARY KEYSALARY NUMBER(5, 2)EMPLOYEE_ID VARCHAR2(5) FOREIGN KEYWhich query should you issue? Markeren voor nakijken(1) Punten
SELECT last_name, hiredate, salaryFROM employees NATURAL JOIN salary USING employee_idWHERE hiredate 50000;
SELECT last_name, hiredate, salaryFROM employees JOIN salaryON employee_id = employee_idWHERE hiredate 50000;
SELECT last_name, hiredate, salaryFROM employees NATURAL JOIN salaryWHERE hiredate 50000;(*)
SELECT last_name, hiredate, salaryFROM employees (+) salaryWHERE hiredate 50000;
Incorrect
36. The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9) PrimaryKeyLAST_NAME VARCHAR2 (20)FIRST_NAME VARCHAR2 (20)DEPARTMENT_ID NUMBER(5) NOT NULLMANAGER_ID NUMBER(9) NOT NULLEvaluate 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? Markeren voor nakijken(1) Punten
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 EMPLOYEES table
The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.
Incorrect. See Section 17
Section 18
37. 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 first name. Which statement should you use to achieve the required results? Markeren voor nakijken(1) Punten
SELECT last_name, first_nameFROM playersWHERE position_id >= 6900ORDER BY last_name, first_name;(*)
SELECT last_name, first_nameFROM playersWHERE position_id > 6900ORDER BY last_name, first_name;
SELECT last_name, first_nameFROM playersWHERE position_id = 6900ORDER BY last_name DESC, first_name;
Correct.
38. The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9) PKLAST_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_nameFROM employeesORDER BY department_id;2.SELECT department_id DEPT, last_name, first_nameFROM employeesORDER BY DEPT;How will the results differ? Markeren voor nakijken(1) Punten
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.
Incorrect! See Section 18.
39. Which logical operator returns TRUE if either condition is true? Markeren voor nakijken(1) Punten
OR (*)
AND
NOT
BOTH
Incorrect. See Section 18
40. Which statement about the logical operators is true? Markeren voor nakijken(1) Punten
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. (*)
Incorrect. See Section 18
Test: Final Exam Semester 1
Bekijk uw antwoorden, feedback en scores hieronder. Een asterisk (*) geeft een goed antwoord aan.
Semester 1 Final Term Exam covers Sections 11-18 of Database Design.
Section 18
41. From left to right, what is the correct order of Precedence? Markeren voor nakijken(1) Punten
Arithmetic, Concatenation, Comparison, OR (*)
NOT, AND, OR, Arithmetic
Arithmetic, NOT, Logical, Comparison
Arithmetic, NOT, Concatenation, Logical
Incorrect. See Section 18
42. The ORDER BY clause always comes last. True or False? Markeren voor nakijken(1) Punten
Waar (*)
Niet waar
Correct.
43. 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? Markeren voor nakijken(1) Punten
DESC (*)
ASC
SORT
CHANGE
Correct.
44. Which comparison condition means “Less Than or Equal To?” Markeren voor nakijken(1) Punten
“=)”
“+=”
” 50);Which two values could the statement return? (Choose two.) Markeren voor nakijken(1) Punten
(Kies alle goede antwoorden.)
1
50
25 (*)
10
250 (*)
100
Incorrect! See Section 18.
48. 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 Salary14837 – Smith 10-MAY-92 / 5000Which SELECT statement could you use? Markeren voor nakijken(1) Punten
SELECT employee_id || – || last_name “Employee”,hire_date || / || salary “Start Date and SalaryFROM employeesWHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' '|| last_name "Employee",hire_date ||' '|| salary "Start Date and Salary"FROM employeesWHERE hire_date <= 01-JAN-96';
SELECT employee_id ||'"- "|| last_name "Employee",hire_date ||" / "|| salary Start Date and Salary"FROM employeesWHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' – '|| last_name 'Employee',hire_date ||' / '|| salary 'Start Date and Salary"FROM employeesWHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' – '|| last_name "Employee",hire_date ||' / '|| salary "Start Date and Salary"FROM employeesWHERE hire_date <= '01-JAN-96';(*)
Incorrect! See Section 18.
49. Evaluate this SELECT statement:SELECT last_name, first_name, salaryFROM employees;How will the results of this query be sorted? Markeren voor nakijken(1) Punten
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.
Correct.
50. Which SELECT statement should you use to limit the display of product information to those products with a price of less than 50? Markeren voor nakijken(1) Punten
SELECT product_id, product_nameFROM productsWHERE price < 50;(*)
SELECT product_id, product_nameFROM productsHAVING price < 50;
SELECT product_id, product_nameFROM productsWHERE price <= 50;
SELECT product_id, product_nameFROM productsGROUP BY price < 50;
SELECT product_id, product_nameFROM productsWHERE price < 50.00GROUP BY price;
Correct.
Evaluate this SELECT statement:SELECT last_name, first_name, salaryFROM 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. (*)
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_nameFROM productsWHERE price < 50;(*)
Attributes become tables in a database. True or False?False
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?False
An “Arc Implementation” can be done just like any other Relationship – you simply add the required Foreign Keys. True or False?False