Oracle Mid Exam
Oracle Mid Exam
True
False (*)
2. A foreign key cannot refer to a primary key in the same table. True or False? Mark for Review (1) Points
True
False (*)
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 a letter requesting the return of the BOOKS; this will require extra programming to enforce. Mark for Review (1) Points
Entity integrity
Column integrity
Referential integrity
Correct
4. A table must have at least one candidate key, as well as its primary key. True or False? Mark for Review (1) Points
True
False (*)
Correct
5. Foreign keys must be null. True or False? Mark for Review (1) Points
True
False (*)
Correct
6. Which of the following is a valid reason for considering a Subtype Implementation? Mark for Review (1) Points
The resulting table will reside in a single database and be used by just ONE user.
Business functionality, business rules, access paths, and frequency of access are all very different between the subtypes. (*)
7. In a physical data model, a relationship is represented as a combination of: (Choose Two) Mark for Review (1) Points
Column
Correct
8. The transformation from an ER diagram to a physical design involves changing terminology. Secondary Unique Identifiers become Mark for Review (1) Points
Columns
Tables
Correct
9. Attributes become tables in a database. True or False? Mark for Review (1) Points
True
False (*)
10. To resolve a many to many relationship in a physical model you create a/an ___________________? Mark for Review (1) Points
Intersection entity
Correct
Section 11
11. In a conceptual model, many-to-many relationships are resolved via a structure called a/an: ________________ Mark for Review (1) Points
Supertype
Intersection Table
Subtype
12. During which phases of the System Development Life Cycle would you test the system before rolling it out to the users? Mark for Review (1) Points
Correct.
13. In the Analysis phase, the tables are created and populated with test data. True or False? Mark for Review (1) Points
True
False (*)
Correct.
14. 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.
15. 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.
16. What command will return data from the database to you? Mark for Review (1) Points
FETCH
GET
SELECT (*)
RETURN
Correct.
17. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid statement. True or False? Mark for Review (1) Points
True
False (*)
Correct.
18. The f_customers table contains the following data: ID Name Address City State Zip 1 Cole Bee 123 Main Street Orlando FL 32838
2 Zoe Twee 1009 Oliver Avenue Boston MA 02116 3 Sandra Lee 22 Main Street Tampa FL 32444
If you run the following statement: DELETE FROM F_CUSTOMERS WHERE ID <= 2;
How many rows will be left in the table? Mark for Review (1) Points
1 (*)
Correct.
19. 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? Mark for Review (1) Points
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? Mark for Review (1) Points
Joining only
Selection only
Correct.
21. 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
22. In which clause of a SELECT statement would you specify the name of the table or tables being queried? Mark for Review (1) Points
Any of the above options; you can list tables wherever you want in a SELECT statement.
Correct.
23. If a SQL statement returns data from two or more tables, which SQL capability is being used? Mark for Review (1) Points
Selection
Projection
Joining (*)
Insertion
Correct.
24. In the default order of precedence, which operator would be evaluated first? Mark for Review (1) Points
Subtractions and Additions are at the same level and would be evaluated first based on left to right order
Multiplications and Divisions are at the same level and would be evaluated first based on left to right order (*)
Additions and Multiplications are at the same level and would be evaluated first based on left to right order
Divisions and Subtractions are at the same level and would be evaluated first based on left to right order
Correct.
Section 16
25. 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.
Which WHERE clause should you use to complete this statement? Mark for Review (1) Points
26. 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.
27. Where in a SQL statement can you not use arithmetic operators? Mark for Review (1) Points
SELECT
FROM (*)
WHERE
NONE
Correct.
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? Mark for Review (1) Points
WHERE department_id < 50 <br> AND salary BETWEEN 10000 AND 25000
Correct.
29. When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE option? Mark for Review (1) Points
&
\ (*)
Correct.
30. Which comparison condition would you use to select rows that match a character pattern? Mark for Review (1) Points
IN
LIKE (*)
ALMOST
SIMILAR
Correct.
31. 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? Mark for Review (1) Points
"= NULL"
NULL!
ISNULL
IS NULL (*)
Correct.
32. Which operator is used to combine columns of character strings to other columns? Mark for Review (1) Points
|| (*)
Correct.
33. 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 Length EMPLOYEE_ID NUMBER 22 FIRST_NAME VARCHAR2 20 LAST_NAME VARCHAR2 25 EMAIL VARCHAR2 25 PHONE_NUMBER VARCHAR2 20 SALARY NUMBER 22 COMMISSION_PCT NUMBER 22 MANAGER_ID NUMBER 22 DEPARTMENT_ID NUMBER 22
Correct.
34. Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id IN(10, 20, 30) AND salary > 20000;
Which values would cause the logical condition to return TRUE? Mark for Review
(1) Points
Correct.
35. You need to display all the employees whose last names (of any length) start with the letters 'Sm' . Which WHERE clause should you use? Mark for Review (1) Points
36. You want to determine the orders that have been placed by customers who reside in the city of 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? Mark for Review (1) Points
Correct.
37. From left to right, what is the correct order of Precedence? Mark for Review (1) Points
Correct.
38. Which comparison condition means "Less Than or Equal To"? Mark for Review (1) Points
"=)"
"+<"
">="
"<=" (*)
Correct.
39. Which statement about the ORDER BY clause is true? Mark for Review (1) Points
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.
40. Which of the following are TRUE regarding the logical AND operator? Mark for Review (1) Points
Correct.
41. Which logical operator returns TRUE if either condition is true? Mark for Review (1) Points
OR (*)
AND
NOT
BOTH
Correct.
42. Which statement about the default sort order is true? Mark for Review (1) Points
Correct.
43. What value will the following SQL statement return? SELECT employee_id FROM employees WHERE employee_id BETWEEN 100 AND 150 OR employee_id IN(119, 175, 205) AND (employee_id BETWEEN 150 AND 200);
19
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
Correct.
44. Evaluate this SELECT statement: SELECT first_name, last_name, email FROM employees ORDER BY last_name;
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
Correct.
45. You query the database with this SQL statement: SELECT price FROM products WHERE price IN(1, 25, 50, 250) AND (price BETWEEN 25 AND 40 OR price > 50);
Which two values could the statement return? (Choose two.) Mark for Review (1) Points
50
25 (*)
10
250 (*)
Correct.
46. 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:
Which SELECT statement could you use? Mark for Review (1) Points
SELECT employee_id || - || last_name "Employee", hire_date || / || salary "Start Date and Salary FROM employees WHERE hire_date <= '01-JAN-1996';
SELECT employee_id ||' '|| last_name "Employee", hire_date ||' '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= 01-JAN-1996';
SELECT employee_id ||'"- "|| last_name "Employee", hire_date ||" / "|| salary Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-1996';
hire_date ||' / '|| salary 'Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-1996';
SELECT employee_id ||' - '|| last_name "Employee", hire_date ||' / '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-1996'; (*)
Correct.
47. Which SELECT statement should you use to limit the display of product information to those products with a price of less than 50? Mark for Review (1) Points
SELECT product_id, product_name FROM products WHERE price < 50; (*)
SELECT product_id, product_name FROM products WHERE price < 50.00 GROUP BY price;
Correct.
48. 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
This statement fails when executed. Which change will correct the problem? Mark for Review (1) Points
Correct.
49. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(9) PK LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) Compare these two SQL statements:
How will the results differ? Mark for Review (1) Points
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 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? Mark for Review (1) Points
SELECT last_name, first_name FROM players WHERE position_id >= 6900 ORDER BY last_name, first_name; (*)
SELECT last_name, first_name FROM players WHERE position_id > 6900 ORDER BY last_name, first_name;
SELECT last_name, first_name FROM players WHERE position_id >= 6900 ORDER BY last_name DESC, first_name;
Correct.