Вы находитесь на странице: 1из 32

Test: English Database Design and Database

Programming with SQL Custom Event Final Exam


Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Database Design Section 2
(Answer all questions in this section)
1.In a physical data model, an entity becomes a/an?

Mark for Review


(1) Points

Experience
Instance
Table (*)
None of the above
Correct
2.The entity/relationship model is created before the physical database design model?
True or False?

Mark for Review


(1) Points

True (*)
False
Correct

Database Design Section 3


(Answer all questions in this section)
3.Which of the following are true about Cardinality? (Choose two)

Mark for Review


(1) Points

(Choose all correct answers)


Cardinality tells "how many". (*)
Cardinality specifies only singularity or plurality, but not a specific plural
number. (*)
Cardinality specifies a counting number (like 1, 2, 3, 4 etc.) in a relationship.
Cardinality specifies whether something is required or not.

Correct
4.Matrix Diagrams are mandatory when doing data modelling. True or False?

Mark for Review


(1) Points

True
False (*)
Correct

Database Design Section 4


(Answer all questions in this section)
5.A supertype can only have two subtypes and no more. True or False?

Mark for Review


(1) Points

True
False (*)
Correct
Database Design Section 4
(Answer all questions in this section)
6. All ER diagrams must have one of each of the following: (Choose two)

Mark for Review


(1) Points

(Choose all correct answers)


One or more Entities (*)
Relationships between entities (*)
Arcs
At least one supertype and subtype
Correct
7. A new system would have a mixture of both Procedural and Structural Business
Rules as part of the documentation of that new system. True or False?

Mark for Review


(1) Points

True (*)
False

Correct

Database Design Section 5


(Answer all questions in this section)
8. Intersection Entities often have the relationships participating in the UID, so the
relationships are often barred. True or False?

Mark for Review


(1) Points

True (*)
False
Correct
9. Which of the following pairs of entities is most likely to be modeled as a M:M
relationship?

Mark for Review


(1) Points

CAR and WHEEL


TREE and BRANCH
PERSON and FINGERPRINT
TEACHER and SUBJECT AREA (*)
Correct
10A non-transferable relationship means the detail can be changed to point to a new
. master. True or False?

Mark for Review


(1) Points

True
False (*)
Incorrect. Refer to Section 5 Lesson 1.
Database Design Section 6
(Answer all questions in this section)
11.The candidate UID that is chosen to identify an entity is called the
Primary UID; other candidate UIDs are called Secondary UIDs.

Mark for Review


(1) Points

Yes, this is the way UID's are named. (*)


No, it is not possible to have more than one UID for an Entity.
No, after UIDs are first sorted, the first one is called the Primary
UID, the second is the Secondary UID, etc.
No, each Entity can only have one UID, the secondary one.

Correct
12Normalizing an Entity to 1st Normal Form is done by removing any
. attributes that contain muliple values. True or False?

Mark for Review


(1) Points

True (*)
False
Correct
13Any Non-UID attribute must be dependent upon the entire UID. True
. or False?

Mark for Review


(1) Points

True (*)
False
Correct
14No commercial database systems in the world will accept tables that
. are not on 3rd Normal Form. True or False?

Mark for Review


(1) Points

True
False (*)
Correct

Database Design Section 7


(Answer all questions in this section)
15Which of the following would be good as a Unique Identifier for its
. Entity? (Choose Three)

Mark for Review


(1) Points

(Choose all correct answers)


Personal Identification number for Person (*)
Vehicle Registration Number for Car (*)
ISBN Number for Book (*)
Date of birth for Baby
Correct
Database Design Section 7

(Answer all questions in this section)


16Historical data must never be kept. True or False?
.

Mark for Review


(1) Points

True
False (*)
Correct
17Primary UIDs are:
.

Mark for Review


(1) Points

Something that each Entity should have, but is not mandatory (*)
Useful as an alternative means of identifying instances of an entity, independent
of their datatype
Mandatory in data modeling
Always comprised of numbers
Correct
18All relationships participating in an arc must be mandatory. True or False?
.

Mark for Review


(1) Points

True
False (*)
Correct

Database Design Section 9


(Answer all questions in this section)
19All systems must have an entity called WEEK with a holiday attribute, so you know
. when to give your employees a holiday. True or False?

Mark for Review


(1) Points

True
False (*)
Correct
20Which of the following is a logical constraint that could result from considering
. how time impacts an example of data storage?

Mark for Review


(1) Points

An ASSIGNMENT may only refer to an EMPLOYEE with a valid employee


record at the Start Date of the ASSIGNMENT. (*)
EMPLOYEE periods can overlap causing the database to crash.
End Date must be before the Start Date.
Dates must be stored with Time.
Correct
Database Design Section 10
(Answer all questions in this section)
21A datamodel containing generic modeling techniques must not be mixed in with
. non-generic models. The generic entities MUST be drawn on a diagram of their
own. True or False?

Mark for Review


(1) Points

True
False (*)
Correct

Database Design Section 11


(Answer all questions in this section)
22In an Oracle database, why would 1_TABLE not work as a table name?
.

Mark for Review


(1) Points

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
23Why 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.


It is too long.
The Plus sign + is not allowed in object names. (*)
None of the above.
Correct

24The explanation below is a User Defined integrity rule and must, therefore, be
. manually coded; the Database cannot enforce this rule automatically. True or False?
A primary key must be unique, and no part of the primary key can be null.

Mark for Review


(1) Points

True
False (*)
Correct
25A 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

Database Design Section 11


(Answer all questions in this section)
26The 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

Database Design Section 12


(Answer all questions in this section)
27System Documentation is developed right at the end once the system has gone live
. and users have been using it for a little while. You are more likely to get it correct
that way. True or False?
True
False (*)
Correct.

Mark for Review


(1) Points

Database Design Section 15


(Answer all questions in this section)
28Which 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.
29You query the database with this SQL statement:
. SELECT * FROM students;
Why would you use this statement?

Mark for Review


(1) Points

To insert data
To view data (*)
To display the table structure
To delete data
Correct.

Database Design Section 16


(Answer all questions in this section)
30The EMPLOYEES table includes these columns:
.
EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL
You want to produce a report that provides the last names, first names, and hire
dates of those employees who were hired between March 1, 2000, and August 30,
2000. Which statements can you issue to accomplish this task?
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN '01-MAR-2000' AND '30-AUG-2000';
(*)

Mark for Review


(1) Points

SELECT last_name, first_name, hire_date


FROM employees
WHERE hire_date BETWEEN '30-AUG-2000' AND '01-MAR-2000';
SELECT last_name, first_name, hire_date
FROM employees
GROUP BY hire_date >= '01-MAR-2000' and hire_date <= '30- AUG-2000';
SELECT last_name, first_name, hire_date
FROM employees
AND hire_date >= '01-MAR-2000' and hire_date <= '30-AUG-2000';
Correct.
Database Design Section 16
(Answer all questions in this section)
31The 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)

Mark for Review


(1) Points

Which SELECT statement should you use if you want to display unique
combinations of the TEAM_ID and MANAGER_ID columns?
SELECT * FROM players;
SELECT team_id, manager_id FROM players;
SELECT DISTINCT team_id, manager_id FROM players; (*)
SELECT team_id, DISTINCT manager_id FROM players;
SELECT team_id, manager_id DISTINCT FROM players;
Correct.

Database Design Section 17


(Answer all questions in this section)
32Which 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.
33Which 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
Correct.
34You 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);

Mark for Review


(1) Points

Which two values could the statement return? (Choose two.)


(Choose all correct answers)
1
50
25 (*)
10
250 (*)
Correct.

Database Programming with SQL Section 1


(Answer all questions in this section)
35Which SQL function is used to return the position where a specific character string
. begins within a larger character string?

Mark for Review


(1) Points

CONCAT
INSTR (*)
LENGTH
SUBSTR

Correct
Database Programming with SQL Section 1
(Answer all questions in this section)
36The PRICE table contains this data:
MANUFACTURER_ID
. PRODUCT_ID
86950

59604

Mark for Review


(1) Points

You query the database and return the value 95. Which script did you use?
SELECT SUBSTR(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
(*)
SELECT LENGTH(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
SELECT SUBSTR(product_id, -1, 3)
FROM price
WHERE manufacturer_id = 59604;
SELECT TRIM(product_id, -3, 2)
FROM price
WHERE manufacturer_id = 59604;
Correct
37You issue this SQL statement:
.
SELECT TRUNC(751.367,-1) FROM dual;
Which value does this statement display?

Mark for Review


(1) Points

700
750 (*)
751
751.3
Incorrect. Refer to Section 1 Lesson 2.
38Which of the following SQL statements will correctly display the last name and the
. number of weeks employed for all employees in department 90?

Mark for Review


(1) Points

SELECT last_name, (SYSDATE-hire_date)/7 AS WEEKS


FROM employees

WHERE department_id = 90;


(*)
SELECT last name, (SYSDATE-hire_date)/7 DISPLAY WEEKS
FROM employees
WHERE department id = 90;
SELECT last_name, # of WEEKS
FROM employees
WHERE department_id = 90;
SELECT last_name, (SYSDATE-hire_date)AS WEEK
FROM employees
WHERE department_id = 90;
Correct
39You need to display the current year as a character value (for example: Two
. Thousand and One). Which element would you use?

Mark for Review


(1) Points

RR
YY
YYYY
YEAR (*)
Incorrect. Refer to Section 1 Lesson 3.

Database Programming with SQL Section 2


(Answer all questions in this section)
40Which arithmetic operation will return a numeric value?
.

Mark for Review


(1) Points

TO_DATE('01-JUN-2004') - TO_DATE('01-OCT-2004') (*)


NEXT_DAY(hire_date) + 5
SYSDATE - 6
SYSDATE + 30 / 24
Correct
Database Programming with SQL Section 2
(Answer all questions in this section)
41Which statement concerning single row functions is true?
.

Mark for Review


(1) Points

Single row functions can accept only one argument, but can return multiple
values.
Single row functions cannot modify a data type.
Single row functions can be nested. (*)
Single row functions return one or more results per row.
Correct
42The PRODUCT table contains this column: PRICE NUMBER(7,2)
. Evaluate this statement:
SELECT NVL(10 / price, '0')
FROM PRODUCT;

Mark for Review


(1) Points

What would happen if the PRICE column contains null values?


The statement would fail because values cannot be divided by 0.
A value of 0 would be displayed. (*)
A value of 10 would be displayed.
The statement would fail because values cannot be divided by null.
Correct

Database Programming with SQL Section 3


(Answer all questions in this section)
43You need to join the EMPLOYEE_HIST and EMPLOYEES tables. The
. EMPLOYEE_HIST table will be the first table in the FROM clause. All the
matched and unmatched rows in the EMPLOYEES table need to be displayed.
Which type of join will you use?

Mark for Review


(1) Points

A cross join
An inner join
A left outer join
A right outer join (*)
Correct
44Which SELECT statement implements a self join?
.

Mark for Review


(1) Points

SELECT p.part_id, t.product_id


FROM part p, part t
WHERE p.part_id = t.product_id;

(*)
SELECT p.part_id, t.product_id
FROM part p, product t
WHERE p.part_id = t.product_id;
SELECT p.part_id, t.product_id
FROM part p, product t
WHERE p.part_id = t.product_id (+);
SELECT p.part_id, t.product_id
FROM part p, product t
WHERE p.part_id =! t.product_id;
Incorrect. Refer to Section 3 Lesson 4.
45You created the CUSTOMERS and ORDERS tables by issuing these CREATE
. TABLE statements in sequence:
CREATE TABLE customers
(custid varchar2(5),
companyname varchar2(30),
contactname varchar2(30),
address varchar2(30),
city varchar2(20),
state varchar2(30),
phone varchar2(20),
constraint pk_customers_01 primary key (custid));
CREATE TABLE orders
(orderid varchar2(5) constraint pk_orders_01 primary key,
orderdate date,
total number(15),
custid varchar2(5) references customers (custid));
You have been instructed to compile a report to present the information about orders
placed by customers who reside in Nashville. Which query should you issue to
achieve the desired results?
SELECT custid, companyname
FROM customers
WHERE city = 'Nashville';
SELECT orderid, orderdate, total
FROM orders o
NATURAL JOIN customers c ON o.custid = c.custid
WHERE city = 'Nashville';
SELECT orderid, orderdate, total
FROM orders o
JOIN customers c ON o.custid = c.custid
WHERE city = 'Nashville';

Mark for Review


(1) Points

(*)
SELECT orderid, orderdate, total
FROM orders
WHERE city = 'Nashville';
Correct
Database Programming with SQL Section 3
(Answer all questions in this section)
46The primary advantages of using JOIN ON is: (Select two)
.

Mark for Review


(1) Points

(Choose all correct answers)


The join happens automatically based on matching column names and data
types.
It will display rows that do not meet the join condition.
It permits columns with different names to be joined. (*)
It permits columns that don t have matching data types to be joined. (*)
Correct
47You want to create a report that displays all employees who were hired before
. January 1, 2000 and whose annual salaries are greater than 50000.
The EMPLOYEES table contains these columns:
EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY
LAST_NAME VARCHAR2(35)
HIREDATE DATE
DEPARTMENT_ID NUMBER(4)
The SALARY table contains these columns:
SALARYID VARCHAR2(5) PRIMARY KEY
SALARY NUMBER(5, 2)
EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY
Which query should you issue?
SELECT last_name, hiredate, salary
FROM employees NATURAL JOIN salary USING employee_id
WHERE hiredate < 01-jan-2000 AND salary > 50000;
SELECT last_name, hiredate, salary
FROM employees JOIN salary

Mark for Review


(1) Points

ON employee_id = employee_id
WHERE hiredate < '01-jan-2000' AND salary > 50000;
SELECT last_name, hiredate, salary
FROM employees NATURAL JOIN salary
WHERE hiredate < '01-jan-2000' AND salary > 50000;
(*)
SELECT last_name, hiredate, salary
FROM employees (+) salary
WHERE hiredate < '01-jan-2000' AND salary > 50000;
Correct

Database Programming with SQL Section 4


(Answer all questions in this section)
48Which statement about the COUNT function is true?
.

Mark for Review


(1) Points

The COUNT function ignores duplicates by default.


The COUNT function always ignores null values by default. (*)
The COUNT function can be used to find the maximum value in each column.
The COUNT function can be used to determine the number of unique, non-null
values in a column.
Incorrect. Refer to Section 4 Lesson 3.
49The AVG, SUM, VARIANCE, and STDDEV functions can be used with which of
. the following?

Mark for Review


(1) Points

Only numeric data types (*)


Integers only
Any data type
All except numeric
Correct
50Group functions return a value for ________________ and ________________ null
. values in their computations.

Mark for Review


(1) Points

a row set, ignore (*)


each row, ignore
a row set, include

each row, include


Correct
Database Programming with SQL Section 5
(Answer all questions in this section)
51Evaluate this SELECT statement:
.
SELECT SUM(salary), department_id, department_name
FROM employees
WHERE department_id = 1
GROUP BY department;

Mark for Review


(1) Points

Which clause of the SELECT statement contains a syntax error?


SELECT
FROM
WHERE
GROUP BY (*)
Correct
52You want to write a report that returns the average salary of all employees in the
. company, sorted by departments.
The EMPLOYEES table contains the following columns:
EMPLOYEES:
EMP_ID NUMBER(10) PRIMARY KEY
LNAME VARCHAR2(20)
FNAME VARCHAR2(20)
DEPT VARCHAR2(20)
HIRE_DATE DATE
SALARY NUMBER(10)
Which SELECT statement will return the information that you require?
SELECT salary(AVG), dept
FROM employees
GROUP BY dept;
SELECT dept, AVG(salary)
FROM employees
GROUP BY dept;
(*)
SELECT AVG (salary)
FROM employees

Mark for Review


(1) Points

BY dept;
SELECT AVG salary
FROM employees
BY dept;
Correct
53What is the best explanation as to why this SQL statement will NOT execute?
.
SELECT department_id "Department", AVG (salary)"Average"
FROM employees
GROUP BY Department;

Mark for Review


(1) Points

Salaries cannot be averaged as not all the numbers will divide evenly.
You cannot use a column alias in the GROUP BY clause. (*)
The GROUP BY clause must have something to GROUP.
The department id is not listed in the departments table.
Incorrect. Refer to Section 5 Lesson 1.
54You use GROUPING functions to ______ database rows from tabulated rows.
.

Mark for Review


(1) Points

CREATE
DISTINGUISH (*)
COMPUTE
COUNT
Correct
55CUBE can be applied to all aggregate functions including AVG, SUM, MIN, MAX,
. and COUNT. True or False?

Mark for Review


(1) Points

True (*)
False
Correct
Database Programming with SQL Section 5
(Answer all questions in this section)
56When using SET operators, the names of the matching columns must be identical in
. all of the SELECT statements used in the query. True or False?

Mark for Review


(1) Points

True
False (*)
Incorrect. Refer to Section 5 Lesson 3.

Database Programming with SQL Section 6


(Answer all questions in this section)
57If a single-row subquery returns a null value and uses the equality comparison
. operator, what will the outer query return?

Mark for Review


(1) Points

No rows (*)
All the rows in the table
A null value
An error
Incorrect. Refer to Section 6 Lesson 2.
58Oracle allows you to write named subqueries in one single statement, as long as you
. start your statement with the keyword WITH. True or False?

Mark for Review


(1) Points

True (*)
False
Correct
59You need to display all the players whose salaries are greater than or equal to John
. Brown's salary. Which comparison operator should you use?

Mark for Review


(1) Points

=
>
<=
>= (*)
Correct
60Which comparison operator would you use to compare a value to every value
. returned by a subquery?

Mark for Review


(1) Points

SOME
ANY
ALL (*)

IN
Incorrect. Refer to Section 6 Lesson 3.
Database Programming with SQL Section 7
(Answer all questions in this section)
61Which statement about the VALUES clause of an INSERT statement is true?
.

Mark for Review


(1) Points

If no column list is specified, the values must be listed in the same order that
the columns are listed in the table. (*)
The VALUES clause in an INSERT statement is mandatory in a subquery.
Character, date, and numeric data must be enclosed within single quotes in the
VALUES clause.
To specify a null value in the VALUES clause, use an empty string (" ").
Correct
62Assume all the column names are correct. The following SQL statement will
. execute which of the following?
INSERT INTO departments
(department_id, department_name, manager_id, location_id)
VALUES (70, 'Public Relations', 100, 1700);

Mark for Review


(1) Points

100 will be inserted into the department_id column.


1700 will be inserted into the manager_id column.
70 will be inserted into the department_id column. (*)
"Public Relations" will be inserted into the manager_name column.
Correct
63Multi-table inserts are used when the same source data should be inserted into
. _____________ target table.

Mark for Review


(1) Points

Ten
A very large
More than one (*)
A data warehouse
Correct
64Aliases can be used with MERGE statements. True or False?
.

Mark for Review

(1) Points
True (*)
False
Correct
65Which of the following represents the correct syntax for an INSERT statement?
.

Mark for Review


(1) Points

INSERT VALUES INTO customers (3178 J. Smith 123 Main Street Nashville
TN 37777;
INSERT INTO customers VALUES '3178' 'J.' 'Smith' '123 Main Street'
'Nashville' 'TN' '37777';
INSERT INTO customers VALUES ('3178', 'J.', 'Smith', '123 Main Street',
'Nashville', 'TN', '37777'); (*)
INSERT customers VALUES 3178, J., Smith, 123 Main Street, Nashville, TN,
37777;
Correct
Database Programming with SQL Section 7
(Answer all questions in this section)
66When the WHERE clause is missing in a DELETE statement, what is the result?
.

Mark for Review


(1) Points

All rows are deleted from the table. (*)


The table is removed from the database.
An error message is displayed indicating incorrect syntax.
Nothing. The statement will not execute.
Correct

Database Programming with SQL Section 8


(Answer all questions in this section)
67Which data types stores variable-length character data? Select two.
.

Mark for Review


(1) Points

(Choose all correct answers)


CHAR
NCHAR

CLOB (*)
VARCHAR2 (*)
Incorrect. Refer to Section 8 Lesson 2.
68Evaluate this statement:
.
ALTER TABLE inventory
MODIFY backorder_amount NUMBER(8,2);

Mark for Review


(1) Points

Which task will this statement accomplish?


Alters the definition of the BACKORDER_AMOUNT column to NUMBER(8
2)
Alters the definition of the BACKORDER_AMOUNT column to NUMBER
Alters the definition of the BACKORDER_AMOUNT column to
NUMBER(2,8)
Alters the definition of the BACKORDER_AMOUNT column to
NUMBER(8.2)
Changes the definition of the BACKORDER_AMOUNT column to
NUMBER(8,2) (*)
Correct
69You need to remove all the data in the SCHEDULE table, the structure of the table,
. and the indexes associated with the table. Which statement should you use?

Mark for Review


(1) Points

DROP TABLE (*)


TRUNCATE TABLE
ALTER TABLE
DELETE TABLE
Correct
70You want to create a database table that will contain information regarding products
. that your company released during 2001. Which name can you assign to the table
that you create?
2001_PRODUCTS
PRODUCTS_2001 (*)
PRODUCTS_(2001)
PRODUCTS--2001
Correct
Database Programming with SQL Section 8

Mark for Review


(1) Points

(Answer all questions in this section)


71You want to create a table named TRAVEL that is a child of the EMPLOYEES
. table. Which of the following statements should you issue?

Mark for Review


(1) Points

CREATE TABLE travel


(destination_id primary key, departure_date date, return_date date, emp_id
REFERENCES employees (emp_id));
CREATE TABLE travel
(destination_id number primary key, departure_date date, return_date date,
t.emp_id = e.emp_id);
CREATE TABLE travel
(destination_id number primary key, departure_date date, return_date date,
JOIN emp_id number(10) ON employees (emp_id));
CREATE TABLE travel
(destination_id number primary key, departure_date date, return_date date,
emp_id number(10) REFERENCES employees (emp_id));
(*)
Incorrect. Refer to Section 8 Lesson 1.

Database Programming with SQL Section 10


(Answer all questions in this section)
72What is the syntax for removing a PRIMARY KEY constraint and all its dependent
. constraints?

Mark for Review


(1) Points

ALTER TABLE table_name


DROP CONSTRAINT constraint_name CASCADE;
(*)
ALTER TABLE table_name
DROP CONSTRAINT FOREIGN KEY CASCADE;
DROP CONSTRAINT table_name (constraint_name);
ALTER TABLE table_name
DROP CONSTRAINT constraint_name;
Correct
73You need to add a NOT NULL constraint to the EMAIL column in the
. EMPLOYEES table. Which clause should you use?

Mark for Review


(1) Points

ADD

CHANGE
MODIFY (*)
DISABLE
Correct
74You need to remove the EMP_FK_DEPT constraint from the EMPLOYEE table in
. your schema. Which statement should you use?

Mark for Review


(1) Points

DROP CONSTRAINT EMP_FK_DEPT FROM employees;


DELETE CONSTRAINT EMP_FK_DEPT FROM employees;
ALTER TABLE employees DROP CONSTRAINT EMP_FK_DEPT; (*)
ALTER TABLE employees REMOVE CONSTRAINT EMP_FK_DEPT;
Correct
75Which clause could you use to ensure that cost values are greater than 1.00?
.

Mark for Review


(1) Points

CONSTRAINT CHECK cost > 1.00


CONSTRAINT part_cost_ck CHECK (cost > 1.00) (*)
CHECK CONSTRAINT part_cost_ck (cost > 1.00)
CONSTRAINT CHECK part_cost_ck (cost > 1.00)
Incorrect. Refer to Section 10 Lesson 2.
Database Programming with SQL Section 10
(Answer all questions in this section)
76Which of the following best describes the function of a CHECK constraint?
.

Mark for Review


(1) Points

A CHECK constraint enforces referential data integrity.


A CHECK constraint defines restrictions on the values that can be entered in a
column or combination of columns. (*)
A CHECK constraint enforces uniqueness of the values that can be entered in a
column or combination of columns.
A CHECK constraint is created automatically when a PRIMARY KEY
constraint is created.
Incorrect. Refer to Section 10 Lesson 2.
77What must exist on the Parent table before Oracle will allow you to create a
. FOREIGN KEY constraint from a Child table?

Mark for Review

(1) Points
A FOREIGN KEY constraint allows the constrained column to contain values
that exist in the primary key column of the parent table.
A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. (*)
An index must exist on the Parent table
A CHECK constraint must exist on the Parent table.
Correct
78Which constraint can only be created at the column level?
.

Mark for Review


(1) Points

NOT NULL (*)


FOREIGN KEY
UNIQUE
CHECK
Incorrect. Refer to Section 10 Lesson 1.
79You need to ensure that the LAST_NAME column only contains certain character
. values. No numbers or special characters are allowed.
Which type of constraint should you define on the LAST_NAME column?

Mark for Review


(1) Points

CHECK (*)
UNIQUE
NOT NULL
PRIMARY KEY
Correct
80You need to ensure that each value in the SEAT_ID column is unique or null. Which
. constraint should you define on the SEAT_ID column?

Mark for Review


(1) Points

CHECK
UNIQUE (*)
NOT NULL
PRIMARY KEY
Correct
Database Programming with SQL Section 11
(Answer all questions in this section)

81The CUSTOMER_FINANCE table contains these columns:


.
CUSTOMER_ID NUMBER(9)
NEW_BALANCE NUMBER(7,2)
PREV_BALANCE NUMBER(7,2)
PAYMENTS NUMBER(7,2)
FINANCE_CHARGE NUMBER(7,2)
CREDIT_LIMIT NUMBER(7)

Mark for Review


(1) Points

You created a Top-n query report that displays the account numbers and new
balance of the 800 accounts that have the highest new balance value. The results are
sorted by payments value from highest to lowest.
Which SELECT statement clause is included in your query?
Inner query: ORDER BY new_balance DESC (*)
Inner query: WHERE ROWNUM = 800
Outer query: ORDER BY new_balance DESC
Inner query: SELECT customer_id, new_balance ROWNUM
Incorrect. Refer to Section 11 Lesson 3.
82The CUSTOMER_FINANCE table contains these columns:
.
CUSTOMER_ID NUMBER(9)
NEW_BALANCE NUMBER(7,2)
PREV_BALANCE NUMBER(7,2)
PAYMENTS NUMBER(7,2)
FINANCE_CHARGE NUMBER(7,2)
CREDIT_LIMIT NUMBER(7)
You execute this statement:
SELECT ROWNUM "Rank", customer_id, new_balance
FROM (SELECT customer_id, new_balance FROM customer_finance)
WHERE ROWNUM <= 25
ORDER BY new_balance DESC;
What statement is true?
The statement failed to execute because an inline view was used.
The statement will not necessarily return the 25 highest new balance values, as
the inline view has no ORDER BY clause. (*)
The 25 greatest new balance values were displayed from the highest to the
lowest.
The statement failed to execute because the ORDER BY clause does NOT use
the Top-n column.

Mark for Review


(1) Points

Incorrect. Refer to Section 11 Lesson 3.


83Evaluate this CREATE VIEW statement:
.
CREATE VIEW emp_view
AS SELECT SUM(salary)
FROM employees;

Mark for Review


(1) Points

Which statement is true?


You cannot update data in the EMPLOYEES table using the EMP_VIEW view.
(*)
You can update any data in the EMPLOYEES table using the EMP_VIEW
view.
You can delete records from the EMPLOYEES table using the EMP_VIEW
view.
You can update only the SALARY column in the EMPLOYEES table using the
EMP_VIEW view.
Correct
84Evaluate this CREATE VIEW statement:
.
CREATE VIEW pt_view AS
(SELECT first_name, last_name, status, courseid, subject, term
FROM faculty f, course c
WHERE f.facultyid = c.facultyid);

Mark for Review


(1) Points

Which type of view will this statement create?


Nested
Simple
Inline
Complex (*)
Correct
85Which keyword(s) would you include in a CREATE VIEW statement to create the
. view whether or not the base table exists?

Mark for Review


(1) Points

FORCE (*)
NOFORCE
OR REPLACE
WITH READ ONLY
Correct

Database Programming with SQL Section 11


(Answer all questions in this section)
86You need to create a new view on the EMPLOYEES table to update salary
. information for employees in Department 50. You need to ensure that DML
operations through the view can not change salary values in other departments.
Which clause should be included in the CREATE VIEW statement?

Mark for Review


(1) Points

FORCE
OR REPLACE
WITH READ ONLY
WITH CHECK OPTION (*)
Incorrect. Refer to Section 11 Lesson 2.
87You create a view on the EMPLOYEES and DEPARTMENTS tables to display
. salary information per department.
What will happen if you issue the following statement?

Mark for Review


(1) Points

CREATE OR REPLACE VIEW sal_dept


AS SELECT SUM(e.salary) sal, d.department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id
GROUP BY d.department_name
ORDER BY d.department_name;
A complex view is created that returns the sum of salaries per department,
sorted by department name. (*)
A simple view is created that returns the sum of salaries per department, sorted
by department name.
A complex view is created that returns the sum of salaries per department,
sorted by department id.
Nothing, as the statement contains an error and will fail.
Incorrect. Refer to Section 11 Lesson 2.
88Which option would you use when creating a view to ensure that no DML
. operations occur on the view?

Mark for Review


(1) Points

FORCE
NOFORCE
WITH READ ONLY (*)
WITH ADMIN OPTION
Incorrect. Refer to Section 11 Lesson 2.

Database Programming with SQL Section 12


(Answer all questions in this section)
89Evaluate this CREATE SEQUENCE statement:
.
CREATE SEQUENCE line_item_id_seq CYCLE;

Mark for Review


(1) Points

Which statement is true?


The sequence cannot be used with more than one table.
The sequence preallocates values and retains them in memory.
The sequence cannot generate additional values after reaching its maximum
value.
The sequence will continue to generate values after the maximum sequence
value has been generated. (*)
Correct
90The CUSTOMERS table exists in user Mary's schema. Which statement should you
. use to create a synonym for all database users on the CUSTOMERS table?

Mark for Review


(1) Points

CREATE PUBLIC SYNONYM cust ON mary.customers;


CREATE PUBLIC SYNONYM cust FOR mary.customers;
(*)
CREATE SYNONYM cust ON mary.customers FOR PUBLIC;
CREATE SYNONYM cust ON mary.customers;
GRANT SELECT ON cust TO PUBLIC;
Correct
Database Programming with SQL Section 12
(Answer all questions in this section)
91You need to determine the table name and column name(s) on which the
. SALES_IDX index is defined. Which data dictionary view would you query?

Mark for Review


(1) Points

USER_INDEXES
USER_TABLES
USER_OBJECTS
USER_IND_COLUMNS (*)
Incorrect. Refer to Section 12 Lesson 2.

Database Programming with SQL Section 13


(Answer all questions in this section)
92Regular expressions used as check constraints are another way to ensure data is
. formatted correctly prior to being written into the database table. True or False?

Mark for Review


(1) Points

True (*)
False
Correct
93Which statement would you use to remove an object privilege granted to a user?
.

Mark for Review


(1) Points

ALTER USER
REVOKE (*)
REMOVE
DROP
Correct
94Which statement would you use to grant a role to users?
.

Mark for Review


(1) Points

GRANT (*)
ALTER USER
CREATE USER
ASSIGN
Correct
95You want to grant privileges to user CHAN that will allow CHAN to update the
. data in the EMPLOYEES table. Which type of privileges will you grant to CHAN?

Mark for Review


(1) Points

User privileges
Object privileges (*)
System privileges
Administrator privileges
Incorrect. Refer to Section 13 Lesson 1.
Database Programming with SQL Section 13

(Answer all questions in this section)


96. User CHANG has been granted SELECT, UPDATE, INSERT, and DELETE
privileges on the EMPLOYEES table. You now want to prevent Chang from
adding or deleting rows from the table, while still allowing him to read and modify
existing rows. Which statement should you use to do this?

Mark for Review


(1) Points

REVOKE ALL ON employees FROM chang;


REVOKE INSERT, DELETE ON employees FROM chang; (*)
REMOVE INSERT, DELETE ON employees FROM chang;
REVOKE INSERT AND DELETE ON employees FROM chang;
Incorrect. Refer to Section 13 Lesson 1.

Database Programming with SQL Section 14


(Answer all questions in this section)
97. Table MYTAB contains only one column of datatype CHAR(1). A user executes
the following statements in the order shown.
INSERT INTO mytab VALUES ('A');
INSERT INTO mytab VALUES ('B');
COMMIT;
INSERT INTO mytab VALUES ('C');
ROLLBACK;

Mark for Review


(1) Points

Which rows does the table now contain?


A, B, and C
A and B (*)
C
None of the above
Incorrect. Refer to Section 14 Lesson 1.

Database Programming with SQL Section 15


(Answer all questions in this section)
98. Using Oracle Proprietary join syntax, which two operators can be used in an outer
join condition using the outer join operator (+)?

Mark for Review


(1) Points

AND and = (*)


OR and =

BETWEEN...AND... and IN
IN and =
Correct
99. What is the minimum number of join conditions required to join 5 tables together?

Mark for Review


(1) Points

3
4 (*)
5
One more than the number of tables
Correct
100You need to join the EMPLOYEES table and the SCHEDULES table, but the two
. tables do not have any corresponding columns. Which type of join will you create?

Mark for Review


(1) Points

An equijoin
It is not possible to join these two tables.
A non-equijoin (*)
A full outer join
Incorrect. Refer to Section 15 Lesson 2.

Вам также может понравиться