Professional Documents
Culture Documents
7. What do you create when you transform a many to many relationship from your ER
diagram into a physical design? Mark for Review
(1) Points
Unique key constraints
Intersection entity
Intersection table (*)
Two tables with Foreign key constraints between them
Correct
8. 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
9. 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
Section 13
12. 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 (*)
Incorrect. Refer to Section 13
13. 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.
Section 16
14. Would it be a good idea to model age as an attribute of STUDENT? Mark for
Review
(1) Points
Yes
Maybe it could stop us having to calculate someone's age every time we need it
Sometimes
No - it breaks the Normalization rules (*)
Incorrect. Refer to Section 6
15. When is an entity in 2nd Normal Form? Mark for Review
(1) Points
When all non-UID attributes are dependent upon the entire UID. (*)
When no attritibutes are mutually independant and fully independent on the primary
key.
When no attritibutes are mutually independent and all are fully dependent on the
primary key.
None of the Above.
Correct
16. You query the database with this SQL statement:
SELECT *
FROM transaction
WHERE product_id = 4569;
Which SQL SELECT statement capabilities are achieved when this statement is
executed?
Mark for Review
(1) Points
Selection only (*)
Projection only
Selection and projection only
Projection, selection and joining
Correct.
17. Which SQL statement will return an error? Mark for Review
(1) Points
SEL * FR sky; (*)
select star from sky;
SELECT star FROM sky;
To insert data
To view data (*)
To display the table structure
To delete data
Correct.
20. When listing columns in the SELECT list, what should you use to separate the
columns? Mark for Review
(1) Points
Commas (*)
Semicolons
Dashes
Underscores
Incorrect. See Section 16
Section 16
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
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?
Mark for Review
(1) Points
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.
Incorrect. See Section 16
22. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review
(1) Points
6
8 (*)
10
13
Correct.
Section 17
23. Evaluate this SELECT statement:
SELECT last_name, first_name, salary
FROM 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.
Incorrect. See Section 17.
24. 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_'
Incorrect. See Section 17
25. 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, total
FROM orders;
What should you include in your SELECT statement to achieve the desired results?
Mark for Review
(1) Points
AND city = Chicago;
AND city = 'Chicago';
WHERE city = 'Chicago'; (*)
WHERE city = Chicago;
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. The PLAYERS table contains these columns:
PLAYER_ID NUMBER(9)
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?
Mark for Review
(1) Points
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;
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?
Mark for Review
(1) Points
WHERE email = NULL;
WHERE email != NULL;
WHERE email IS NULL;
WHERE email IS NOT NULL; (*)
Incorrect. See Section 17.
Section 17
31. The Concatenation Operator does which of the following? Mark for Review
(1) Points
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.
Incorrect. See Section 17
32. 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? Mark for Review
(1) Points
ONLY
UNIQUE
DISTINCT (*)
DISTINCTROW
Correct. See Section 17
33. Which statement best describes how column headings are displayed by default in
Oracle Application Express: Mark for Review
(1) Points
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.
Correct. See Section 17
34. 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.
35. When using the LIKE condition, which symbol represents any sequence of none,
one or more characters? Mark for Review
(1) Points
_
% (*)
#
&
Correct.
36. Which comparison condition would you use to select rows that match a character
pattern? Mark for Review
(1) Points
IN
LIKE (*)
ALMOST
SIMILAR
Correct.
Section 18
37. The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9) PK
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
Compare these two SQL statements:
1.
SELECT DISTINCT department_id DEPT, last_name, first_name
FROM employees
ORDER BY department_id;
2.
SELECT department_id DEPT, last_name, first_name
FROM employees
ORDER BY DEPT;
How will the results differ?
Mark for Review
(1) Points
One of the statements will return a syntax error.
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.
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, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary;
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary DESC;
(*)
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id ASC, salary DESC;
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id DESC, salary DESC;
ORDER BY (*)
WHERE
FROM
HAVING
Correct.
45.Evaluate this SELECT statement:
SELECT last_name, first_name, department_id, manager_id
FROM employees;
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
Correct.
50.You need to create a report to display all employees that
were hired on or after 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?
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';
(*)
Correct.