Section 1 1. The first step in system development is to document the requirements. Why?

Mark for Review (1) Points Wrong. A blueprint for the database design is not needed. We can just start coding straight away. It clarifies what a business wants to accomplish, and provides measures for deciding if the system delivers all that is required. (*) It allows application development to be conducted without having to consider database design. It keeps businesses honest. Correct 2. Oracle Database Software provides which of the following functionality? (Choose two) Mark for Review (1) Points (Choose all correct answers) Graphical User Interface (*) Internet Browser Server (*) Operating System Incorrect. Refer to Section 1 Lesson 4. 3. Consider your school library. It will have a database with transaction details of which student borrows which books. Is details of the total number of books out on loan in one given month Data or Information? Mark for Review (1) Points Data Information (*) Both

Neither Incorrect. Refer to Section 1 Lesson 2. 4. The main subject areas taught by the Oracle Academy are: Mark for Review (1) Points Computer Repairs Database performance tuning. Data Modeling, SQL and PL/SQL (*) Systems programming and computer architecture Correct

Section 2 5. An entity is instantiated as a ? Mark for Review (1) Points Experience Instance Table (*) None of the above Correct 6. Which of the following entities most likely contains valid attributes? (Choose two) Mark for Review (1) Points (Choose all correct answers) Entity: Home. Attributes: Number of Bedrooms, Owner, Address, Date Built (*) Entity: Pet. Attributes: Name, Birthdate, Owner (*)

Entity: Car. Attributes: Owner Occupation, Owner Salary, Speed Entity: Mother. Attributes: Name, Birthdate, Occupation, Salary Correct 7. Relationship names are usually verbs. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 2 Lesson 2. 8. All of the following could be attributes of an ENTITY called PERSON except one. Select the incorrect one: Mark for Review (1) Points Haircolor Weight Gender Natacha Hansen (*) Correct 9. Which of the following statements about relationships are true? (Choose Two) Mark for Review (1) Points (Choose all correct answers) They become foreign keys in the database. (*) They must be mandatory to be created in the database. They can be either mandatory or optional. (*) They must exist between two different Entities.

Correct 10. The Physical Model is derived from the Conceptual Model. True or False? Mark for Review (1) Points True (*) False Correct Section 2 11. Entity and Attribute names are usually Nouns. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 2 Lesson 3.

Section 3 12. Entity names are always singular. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 3 Lesson 2. 13. Two entities can ONLY have one relationship between them. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 3 Lesson 3. 14. Which of the following are valid relationship degrees? (Choose two) Mark for Review (1) Points (Choose all correct answers) 1:1 (*) 1:M (*) 1:O O:O Incorrect. Refer to Section 3 Lesson 1. 15. Relationships represents something of significance to the business. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 3 Lesson 1. 16. Matrix Diagrams are developed BEFORE the ERD. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 3 Lesson 4.

Section 4 17. A business rule such as "We only ship goods after customers have completely paid any outstanding balances on their account" is best enforced by: Mark for Review

(1) Points Making the payment attribute null. Making the payment attribute optional. We need to trust our customers, and we know they will pay some day. Hiring a programmer to create additional programming code to verify no goods are shipped until the account has been settled in full. (*) Incorrect. Refer to Section 4 Lesson 2. 18. A supertype can only have two subtypes and no more. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 4 Lesson 1. 19. Which of the following is true about subtypes? Mark for Review (1) Points One instance may belong to two subtypes of the same supertype. Subtypes must be mutually exclusive. (*) Subtypes must not be mutually exclusive. Subtype entities may not have relationships to the other subtype entities, only the supertype itself. Incorrect. Refer to Section 4 Lesson 1. 20. Which of the following are suitable Entity names? (Choose Two) Mark for Review (1) Points (Choose all correct answers) DOGS ANIMAL (*)

ANIMALS DOG (*) Incorrect. Refer to Section 4 Lesson 1.

Page 2 of 5 Section 4 21. All instances of a subtype may be an instance of the supertype but does not have to. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 4 Lesson 1. 22. The "Other" subtype is mandatory. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 4 Lesson 1.

Section 5 23. Relationships can be Redundant. True or False? Mark for Review (1) Points True (*) False

Incorrect. Refer to Section 5 Lesson 2. 24. How do you include a relationship as part of the UID for an entity? Mark for Review (1) Points By barring the relationship in question (*) By reporting it in an external document By including the UID from the parent entity as an attribute in the entity You cannot model that. Incorrect. Refer to Section 5 Lesson 2. 25. 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 (*) Incorrect. Refer to Section 5 Lesson 2. 26. If two entities have two relationships between them, these relationships can be either _____________ or _____________ ? Mark for Review (1) Points Redundant or Required (*) Replicated or Required Resourced and Really Good Redundant and Replicated Incorrect. Refer to Section 5 Lesson 2.

27. Intersection Entities are at the Master end in the relationships between it and the original entities. So the original entities are details or children of the newly created intersection entity. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 5 Lesson 3. 28. When you resolve a M-M you simply re-draw the relationships between the two original entities, no new entities are created. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 5 Lesson 3. 29. 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 Incorrect. Refer to Section 5 Lesson 3. 30. Transferable relationships can only be mandatory, not optional. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 5 Lesson 1. Section 6

31. Until all attributes are single-valued, the database model is said to be: Mark for Review (1) Points Normalized Not Normalized (*) 1st Normal Form 2nd Normal Form Incorrect. Refer to Section 6 Lesson 2. 32. The is no limit to how may UID's an entity can have. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 6 Lesson 1. 33. The first UID for an entity is called the Primary UID, the second is called Secondary UID and so on. 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. Yes, but then it stops. No entities can have more than two UID's. No, each Entity can only have one UID, the secondary one. Incorrect. Refer to Section 6 Lesson 1. 34. All instances of the subtypes must be an instance of the supertype. Mark for Review (1) Points True False

Incorrect. Refer to Section 6 Lesson 4. 35. 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. Incorrect. Refer to Section 6 Lesson 3.

Section 7 36. A particular problem may be solved using either a Recursive Realtionship or a Hierachy, though not at the same time. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 7 Lesson 2. 37. Which of the following would best be represented by an arc? Mark for Review (1) Points TEACHER (Female, Bob) DELIVERY ADDRESS (Home, Office) (*) PARENT (Girl, Bob) STUDENT (Grade A student, Average Student) Incorrect. Refer to Section 7 Lesson 1.

38. All relationships participating in an arc must be mandatory. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 7 Lesson 1. 39. An arc can also be modelled as Supertype and Subtypes. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 7 Lesson 1. 40. Primary 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 Incorrect. Refer to Section 7 Lesson 1. Section 7 41. No parts of an UID are mandatory. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 7 Lesson 1.

42. If Audit trail attributes are added to an entity they must be in the entities they are auditing. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 7 Lesson 3.

Section 9 43. You are doing a data model for a computer sales company, where the price of postage is dependent on what day of the week goods are shipped. So shipping is more expensive if the customer wants a delivery to take place on a Saturday or Sunday. What would be the best way to model this? Mark for Review (1) Points Use a Delivery Day entity, which holds prices against week days, and ensure the we also have an attribute for the Requested Delivery Day in the Order Entity. (*) Email current price to all employees whenever the prices change. Update the prices in the system, print out the current prices when they change and pin them on the company noticeboard Allow them to enter whatever ever delivery charge they want. Incorrect. Refer to Section 9 Lesson 2. 44. Which 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.

Incorrect. Refer to Section 9 Lesson 2. 45. If a system includes the concept of time and it stores Start Dates, then End Dates becomes Mandatory. For each Start Date attribute you create, you MUST create an End Date attribute and it must be mandatory. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 9 Lesson 1. 46. When you add the concept of time to your data model, your model becomes more complex. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 9 Lesson 1.

Section 10 47. There are formal rules for how to draw ERD's, even though they are only guidelines, you should always try to follow them. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 11 Lesson 1. 48. There is no point in trying to group your entities together on your diagram according to volume. Making a diagram pretty is a waste of time. True or False? Mark for Review (1) Points

True False (*) Incorrect. Refer to Section 11 Lesson 1. 49. All datamodels must be transformed from specifiec to generic. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 10 Lesson 2. 50. A datamodel containing generic modelling techniques must not be mixed in with nongeneric models. The generic entities MUST be drawn on a diagram of their own. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 10 Lesson

Test: Mid Term Exam - Database Design

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 1 Lesson 1 1. Once you have learned how to write programs and build systems, you no longer need any input or involvement from any users, as you are perfectly capable of delivering the systems the business needs and wants. Mark for Review (1) Points True. All that perfect systems need are correct programs.

False. Business requirements can and will change. For instance new legal requirements may arise. (*) True. All users do is delay systems delivery with their forever changing minds and new requirements. True. Users never know what they want anyway, so building systems are best left to the professionals. Section 1 Lesson 2 2. Consider your school library. It will have a database with transaction details of which student borrows which books. Is a record of one student borrowing one book Data or Information? Mark for Review (1) Points Data (*) Information Both Neither

3. What is the difference between "information" and "data"? Mark for Review (1) Points Data is held and understood only by Users Information is held and understood only by users Information and data have no differences - they are two words for the same thing Data turns into information when it is stored in a database and accessed by systems and users (*)

Section 1 Lesson 3 4. The first step in system development is to document the requirements. Why? Mark for Review (1) Points Wrong. A blueprint for the database design is not needed. We can just start coding straight away.

It clarifies what a business wants to accomplish, and provides measures for deciding if the system delivers all that is required. (*) It allows application development to be conducted without having to consider database design. It keeps businesses honest.

Section 1 Lesson 4 5. Databases perform these functions.... Mark for Review (1) Points Running multiple applications on multiple client-servers Providing integrated software on fast processing servers Providing software running on a variety of platforms and configurations allowing companies a structured way to access and manage their data (*) They run purely as client-based software on personal computers

6. Which of the following are types of databases? Mark for Review (1) Points (Choose all correct answers) Hierarchical (*) Relational (*) SQL Network (*) Section 2 Lesson 2 (Answer all questions in this section) 7. An entity can have many Unique Identifiers. True or False? Mark for Review (1) Points

True (*) False 8. Which of the following statements about relationships are true? (Choose Two) Mark for Review (1) Points (Choose all correct answers) They become Foreign Keys in the database. (*) They Must be Mandatory to be created in the database. They can be either mandatory or optional. (*) They must exist between two different Entities.

9. The entity/relationship model is created before the physical database design model. True or False? Mark for Review (1) Points True (*) False

10. Primary Unique Identifiers... (Choose Two) Mark for Review (1) Points (Choose all correct answers) Are Required. The data model is not complete until all entities have a Primary UID. (*) Distinguish each instance of an entity from all others (*) Are not required You may create more than one Primary Unique Identifier for an entity

Page 1 of 5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 2 Lesson 2 (Answer all questions in this section) 11. A/an _________ is a picture of all the information that will form the basis for the finished system. Mark for Review (1) Points ERD (*) Process Table Attribute

12. All of the following would be instances of the entity ANIMAL SPECIES except which? Mark for Review (1) Points Dog Bird Elephant Leaf (*)

13. An entity is instantiated as a ? Mark for Review (1) Points experience instance table (*) none of the above

Section 3 Lesson 1 (Answer all questions in this section) 14. One Relationship can be both mandatory and optional at different ends. True or False? Mark for Review (1) Points True (*) False

15. Relationships represents something of significance to the business? True or False? Mark for Review (1) Points True (*) False

Section 3 Lesson 2 (Answer all questions in this section) 16. Entity Boxes are drawn with 90 degree angles, also known as Hard Boxes. True or False? Mark for Review (1) Points True False (*) 17. The single end of a Relationship is called: Mark for Review (1) Points Single Toe (*) Big Toe Single Foot Crows Foot

Section 3 Lesson 3 (Answer all questions in this section) 18. When reading an ERD including Relationships you are said to be speaking: Mark for Review (1) Points Relationship-ish Gibberish ERDish (*) Entity-ish

Section 4 Lesson 1 (Answer all questions in this section) 19. Which of the following are suitable Entity names? (Choose Two) Mark for Review (1) Points (Choose all correct answers) DOGS ANIMAL (*) ANIMALS DOG (*) Incorrect. Refer to Section 4 20. All instances of a subtypes may be an instance of the supertype but does not have to. True or False? Mark for Review (1) Points

True False (*)

Section 4 Lesson 1 (Answer all questions in this section) 21. The "Other" subtype is mandatory. True or False? Mark for Review (1) Points True False (*)

22. When creating entities you must follow these rules: (Choose Two) Mark for Review (1) Points (Choose all correct answers) Name them in Plural Name them in Singular (*) Exclude Attributes Include Attributes (*)

23. A Supertype can have only one subtype. True or False? Mark for Review (1) Points True False (*)

Section 4 Lesson 2 (Answer all questions in this section)

24. "Only teachers may supervise exams" is an example of which of the following? Mark for Review (1) Points A procedural business rule (*) An attribute that should be stored on the PERSON entity A structural business rule An attribute that is not be inherited from the PERSON supertype and is unique to the TEACHER subtype

25. How would you model a business rule that states that girls and boys may not attend classes together? Mark for Review (1) Points Use a supertype Use two subtypes with relationships from class to student gender (*) Make the attribute Gender mandatory You cannot model this. You need to document it.

26. A business rule such as "We only ship goods after customers have completely paid any outstanding balances on their account" is best enforced by: Mark for Review (1) Points Making the payment attribute null. Making the payment attribute optional. We need to trust our customers, and we know they will pay some day. Hiring a programmer to create additional programming code to verify no goods are shipped until the account has been settled in full. (*) Incorrect. Refer to Section 4 27. Business rules are important to data modelers. True or False? Mark for Review (1) Points

True (*) False

Section 5 Lesson 1 (Answer all questions in this section) 28. Transferable relationships can only be mandatory, not optional. True or False? Mark for Review (1) Points True False (*)

Section 5 Lesson 2 (Answer all questions in this section) 29. 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 (*)

30. How do you include a relationship as part of the UID for an entity? Mark for Review (1) Points By barring the relationship in question (*) By reporting it in an external document By including the UID from the parent entity as an attribute in the entity

You cannot model that. Page 3 of 5 Section 5 Lesson 2 (Answer all questions in this section) 31. Many to many relationships must be left in the Model. It is important to have them documented as M-M. True or False? Mark for Review (1) Points True False (*) 32. A relationship from an entity back to itself is called a ___________ relationship. Mark for Review (1) Points Mandatory Recursive (*) Many to Many Optional Transferrable

Section 6 Lesson 1 (Answer all questions in this section) 33. The is no limit to how may UID's an entity can have. True or False? Mark for Review (1) Points True (*) False

Section 6 Lesson 2 (Answer all questions in this section) 34. An entity without repeated values is said to be on 1st Normal Form. True or False? Mark for Review (1) Points True (*)

False

Section 6 Lesson 3 (Answer all questions in this section) 35. 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 someones age every time we need it Sometimes No - it breaks the Normalization rules (*)

Section 7 Lesson 1 (Answer all questions in this section) 36. Consider the entity ADDRESS with the attributes: ADDRESS: # House Number * Street * Town * City * Year of Build o City Population This entity is NOT in 3rd Normal Form ("no non-UID attribute can be dependent on another non-UID attribute). True or False? Mark for Review (1) Points True (*) False

37. Arcs are used to visually represent _________ between two or more relationships in an ERD. Mark for Review (1) Points Sameness Differencies Exclusivity (*) An Arc is what Noah sailed on with all the animals.

38. Arcs are Mandatory in Data modelling. All ERD's must have at least one Arc. True or False? Mark for Review (1) Points True False (*)

39. Which of the following would best be represented by an arc? Mark for Review (1) Points TEACHER (Female, Bob) DELIVERY ADDRESS ( Home, Office) (*) PARENT (Girl, Bob) STUDENT (Grade A student, Average Student)

40. An arc can be modelled as Supertype and Subtypes. True or False? Mark for Review (1) Points True (*) False

Page 4 of 5 Section 7 Lesson 2 (Answer all questions in this section) 41. A relationship can be both Recursive and Hierarchal at the same time. True or False? Mark for Review (1) Points True False (*)

Section 7 Lesson 3 (Answer all questions in this section) 42. If Audit trail attributes are added to an entity they must be in the entities they are auditing. True or False? Mark for Review (1) Points True (*) False

Section 8 Lesson 1 (Answer all questions in this section) 43. Communication Skills, Team-working and Presentations skills are all important for Consultants. True or False? Mark for Review (1) Points True (*) False

Section 8 Lesson 2 (Answer all questions in this section) 44. Which of the following are NOT valid techniques for effective public speaking? (Choose Two) Mark for Review (1) Points (Choose all correct answers) Whispering (*) Using specialist language and technical abbreviations when communicating technical information (*) Being enthusiastic All of the Above

Section 10 Lesson 1 (Answer all questions in this section) 45. What do users of a system without the concept of time loose? Mark for Review (1) Points Journalling becomes much easier. Journalling becomes slightly harder. The ability to track data over time. (*) Nothing is lost if a system does not track time.

46. When you add the concept of time to your data model, your model becomes more complex. True or False? Mark for Review (1) Points True (*) False

47. Modeling historical data is Optional. True or False? Mark for Review (1) Points True (*) False

48. If a system includes the concept of time, and it stores Start Dates, then End Dates becomes Mandatory. For each Start Date attribute you create, you MUST create an End Date attribute and it must be mandatory. True or False? Mark for Review (1) Points True False (*)

Section 10 Lesson 2 (Answer all questions in this section) 49. You are doing a data model for a computer sales company, where the price of postage is dependant on what day of the week goods are shipped. So shipping is more expensive if the customer wants a delivery to take place on a Saturday or Sunday. What would be the best way to model this? Mark for Review (1) Points Use a Delivery Day entity, which holds prices against week days, and ensure the we also have an attribute for the Requested Delivery Day in the Order Entity. (*) Email current price to all employees whenever the prices change. Update the prices in the system, print out the current prices when they change and pin them on the company noticeboard Allow them to enter whatever delivery charge they want.

50. All systems must include functionality to provide logging or journaling in conceptual data models. True or False? Mark for Review (1) Points True False (*)

sectiunea 17 1. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"? Mark for Review (1) Points SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees; SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*) SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp; SELECT last_name||","|| job_id "Employee and Title" FROM employees;

2. 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;

3. 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.. 4. 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_'

5. 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? Mark for Review (1) Points AND IN BETWEEN LIKE (*)

6. Which comparison condition would you use to select rows that match a character pattern? Mark for Review (1) Points IN

LIKE (*) ALMOST SIMILAR

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

8. 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 AND salary BETWEEN 10000 AND 25000 WHERE department_id > 50 AND salary BETWEEN 10000 AND 25000 WHERE department_id = 50 AND salary BETWEEN 25001 AND 10001 WHERE department_id = 50 AND salary BETWEEN 25000 AND 10000 (*)

9. Which symbol represents the not equal to condition? Mark for Review (1) Points #

'+' != (*) ~

10. When using the LIKE condition, which symbol represents any sequence of none, one or more characters? Mark for Review (1) Points _ % (*) # &

11. 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

12. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(9) PrimaryKey LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) DEPARTMENT_ID NUMBER(5) NOT NULL MANAGER_ID NUMBER(9) NOT NULL Evaluate these two SELECT statements: 1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees; 2. SELECT employee_id, department_id, manager_id FROM employees; Which of the following statements is true? 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.

13. You want to create a report that displays all employees who were hired before January 1, 2000 and whose annual salaries are greater than 50000. The EMPLOYEES table contains these columns: EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY LAST_NAME VARCHAR2(35) 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? Mark for Review (1) Points SELECT last_name, hiredate, salary FROM employees NATURAL JOIN salary USING employee_id WHERE hiredate < 01-jan-00 AND salary > 50000; SELECT last_name, hiredate, salary FROM employees JOIN salary ON employee_id = employee_id WHERE hiredate < '01-jan-00' AND salary > 50000; SELECT last_name, hiredate, salary FROM employees NATURAL JOIN salary WHERE hiredate < '01-jan-00' AND salary > 50000; (*) SELECT last_name, hiredate, salary

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

14. The STUDENT table contains these columns: STUDENT_ID NUMBER(10) Primary Key LAST_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_id FROM 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.

15. 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 (*)

16. The EMPLOYEES table includes these columns: EMPLOYEE_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL

You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task? Mark for Review (1) Points SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00'; (*) SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00'; SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00'; SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

17. 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? Mark for Review (1) Points WHERE email = NULL; WHERE email != NULL; WHERE email IS NULL;

WHERE email IS NOT NULL; (*)

18. What will the result of the following SELECT statement be: SELECT last_name, salary, salary + 300 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 Display the last name, salary and the results of adding 300 to each salary for all the employees (*) Modify the salary column by adding 300 and displaying the last name, salary and the new salary. Modify the salary column by adding 300 and only display the last name and the new salary. Display the last name, salary and the results of adding 300 to the salary of the first employee row

19. 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 % (*) ~ # * 20. 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;

21. 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 DEPARTMENT_ID = 10 and SALARY = 20000 DEPARTMENT_ID = 20 and SALARY = 20000 DEPARTMENT_ID = null and SALARY = 20001 DEPARTMENT_ID = 10 and SALARY = 20001 (*)

22. 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

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

24. You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use? Mark for Review (1) Points > "=>" >= (*) != 25. The PRODUCT table contains these columns: PRODUCT_ID NUMBER(9) DESCRIPTION VARCHAR2(20) COST NUMBER(5,2) LOCATION_ID VARCHAR2(10) You want to display product costs with these desired results: 1. The cost displayed for each product is increased by 10 percent. 2. The product location id must be 4859, 9789, or 9898. 3. Ten percent of the original cost is less than $10. Which statement should you issue? Mark for Review (1) Points SELECT product_id, cost * 1.10 FROM product WHERE cost * .10 < 10.00 AND location_id IN (4859, 9789, 9898); (*) SELECT product_id, cost * .10 FROM product WHERE cost * 1.10 > 10.00 AND location_id IN (4859, 9789, 9898);

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

26. When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE option? Mark for Review (1) Points % ^ & \ (*) 27. Which operator is used to combine columns of character strings to other columns? Mark for Review (1) Points * / + || (*)

28. 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.

29. Where in a SQL statement can you not use arithmetic operators? Mark for Review (1) Points SELECT FROM (*) WHERE NONE

30. 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 (\) (*)

31. 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

32. 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 Mark for Review (1) Points SELECT last_name, department_id FROM employees WHERE employee_id = 176; (*) SELECT last_name, department_id FROM employees WHERE employee_id equals 176; SELECT first_name, employee_id FROM employees WHERE employee_id = 176; SELECT last_name, employee_id FROM employees WHERE employee_id equals 176;

33. You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and display the columns as a combined character string. Which operator should you use? Mark for Review (1) Points + |

|| (*) AND

34. 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.

35. 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;

36. 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 (*) 37.

sectiunea 12 1. 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 (*)

2. An "Arc Implementation" can be done just like any other Relationship - you simply add the required Foreign Keys. True or False? Mark for Review (1) Points True False (*)

3. 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 (*)

4. 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 (*)

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? Mark for Review (1) Points True (*) False

6. 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 (*)

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. Mark for Review (1) Points Entity integrity User-defined integrity (*) Column integrity Referential integrity

8. 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 (*)

9. The transformation from an ER diagram to a physical design involves changing terminology. Primary Unique Identifiers in the ER diagram become __________ and relationships become ____________. Mark for Review (1) Points Foreign keys, Primary keys Primary keys, Foreign keys (*) Foreign keys, mandatory business rules Unique Keys, Primary keys

10. 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 (*)

11. 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

12. 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 (*) 13. 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 (*)

14. Foreign keys must be null. True or False? Mark for Review (1) Points True False (*) 15. A table must have a primary key. True or False? Mark for Review (1) Points True False (*) 17. If a primary key is a set of columns then one column must be null. True or False? Mark for Review (1) Points True False (*)

18. Attributes become tables in a database. True or False? Mark for Review (1) Points True False (*) 19. In a physical data model, an attribute becomes a _____________. Mark for Review (1) Points Table Foreign Key Constraint Column (*) 20. 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 21. 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. (*)

22. 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 (*) 23. Many to many relationships are implemented via a structure called a: ________________ Mark for Review (1) Points Supertype Intersection Table (*) Intersection Entity Subtype 24. In 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 25. The transformation from an ER diagram to a physical design involves changing terminology. Secondary Unique Identifiers become Mark for Review (1) Points Columns Tables Unique Constraints (*)

Primary Key Constraints 26. 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 27. 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 (*)

28. A foreign key cannot refer to a primary key in the same table. True or False? Mark for Review (1) Points True False (*) 29. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? Mark for Review (1) Points True False (*) sectiunea 13 1. What command will return data from the database to you? Mark for Review

(1) Points FETCH GET SELECT (*) RETURN

2. 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 (*) 3. The DESCRIBE command returns all rows from a table. True or False? Mark for Review (1) Points True False (*) 4. 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 1. You cannot use computers unless you completely understand exactly how they work. True or False? Mark for Review (1) Points True

False (*)

2. All computers in the world speak the same languages, so you only need to learn one programming language - Oracle SQL. True or False? Mark for Review (1) Points True False (*)

3. When listing columns in the SELECT list, what should you use to separate the columns? Mark for Review (1) Points Commas (*) Semicolons Dashes Underscores

4. 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

5. Which statement best describes how arithmetic expressions are handled? Mark for Review (1) Points 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. (*) 6. What would you use in the SELECT clause to return all the columns in the table? Mark for Review (1) Points An asterisk (*) (*) A minus sign (-) A plus sign (+) The ALL keyword

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

8. 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

9. 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 10. In a SELECT statement Additions are evaluated before Multiplications. True or False? Mark for Review (1) Points True False (*) 11. Evaluate this SELECT statement: SELECT (salary * raise_percent) raise FROM employees; If the RAISE_PERCENT column only contains null values, what will the statement return? Mark for Review (1) Points Only zeroes

Only null values (*) A null value or a zero depending on the value of the SALARY column A null value or a numeric value depending on the value of the SALARY column 12. Which SQL statement will return an error? Mark for Review (1) Points SEL * FR sky; (*) select star from sky; SELECT star FROM sky; SELECT * FROM sky; 13. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review (1) Points 6 8 (*) 10 13 14. You want to create a list of all albums that have been produced by the company. The list should include the title of the album, the artist's name, and the date the album was released. The ALBUMS table includes the following columns: ALB_TITLE VARCHAR2(150) NOT NULL ALB_ARTIST VARCHAR2(150) NOT NULL ALB_DATE DATE NOT NULL Which statement can you use to retrieve the necessary information? Mark for Review (1) Points SELECT * FROM albums; (*) SELECT alb_title, alb_artist, alb_dates

FROM album; SELECT alb_title, alb_artist, alb_dates FROM albums; SELECT alb_title; alb_artist; alb_date FROM albums; 15. 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 16. In the default order of precedence, which operator would be evaluated first? Mark for Review (1) Points Subtractions Multiplications (*) Additions Divisions 17. You 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 18. There is only one kind of software used by all computers. True or False? Mark for Review (1) Points True False (*) 19. 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. 20. 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 21. 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 sectiunea 18 1. Evaluate this SELECT statement: SELECT last_name, first_name, email FROM employees ORDER BY email; If the EMAIL column contains null values, which statement is true? 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.

2. 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); 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

3. Evaluate this SQL statement: SELECT product_id, product_name, price FROM products ORDER 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. (*)

4. Evaluate this SELECT statement: SELECT * FROM employees WHERE salary > 30000 AND department_id = 10 OR 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

5. 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 HAVING price < 50; SELECT product_id, product_name FROM products WHERE price <= 50; SELECT product_id, product_name FROM products GROUP BY price < 50; SELECT product_id, product_name FROM products WHERE price < 50.00 GROUP BY price;

6. Evaluate this SELECT statement: SELECT first_name, last_name, email FROM employees ORDER BY last_name; Which statement is true? Mark for Review (1) Points The rows will not be sorted. The rows will be sorted alphabetically by the LAST_NAME values. (*) The rows will be sorted in reverse alphabetical order by the LAST_NAME values. The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values

7. The ORDER BY clause always comes last. True or False? Mark for Review (1) Points True (*) False

8. 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 (*)

9. 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

10. 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

11. Which statement about the logical operators is true? Mark for Review (1) Points 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. (*)

12. Which comparison condition means "Less Than or Equal To?" Mark for Review (1) Points "=)" "+<" ">=" "<=" (*)

13. Evaluate this SQL statement: SELECT e.employee_id, e.last_name, e.first_name, m.manager_id FROM employees e, employees m ORDER BY e.last_name, e.first_name WHERE e.employee_id = m.manager_id; This statement fails when executed. Which change will correct the problem? 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.

14. 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, first_name; SELECT last_name, first_name FROM players WHERE position_id >= 6900 ORDER BY last_name DESC, first_name;

15. From left to right, what is the correct order of Precedence? Mark for Review (1) Points Arithmetic, Concatenation, Comparison, OR (*) NOT, AND, OR, Arithmetic

Arithmetic, NOT, Logical, Comparison Arithmetic, NOT, Concatenation, Logical

16. 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

17. 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.

18. Which logical operator returns TRUE if either condition is true? Mark for Review (1) Points OR (*) AND NOT BOTH

19. 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. 20. 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 (Choose all correct answers) 1 50 25 (*) 10 250 (*)

100

21. You attempt to query the database with this SQL statement: SELECT product_id "Product Number", category_id "Category", price "Price" FROM products WHERE "Category" = 5570 ORDER BY "Product Number"; This statement fails when executed. Which clause contains a syntax error? Mark for Review (1) Points SELECT product_id "Product Number", category_id "Category", price "price" ORDER BY "Product Number"; FROM products WHERE "Category" = 5570 (*) 22. You need to create a report to display all employees that were hired on or before January 1, 1996. The data should display in this format: Employee Start Date and Salary 14837 - Smith 10-MAY-92 / 5000 Which SELECT statement could you use? 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-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'; (*)

23. Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id = 34 OR department_id = 45 OR 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

24. Evaluate this SELECT statement: SELECT last_name, first_name, department_id, manager_id FROM employees; You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use? 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

25. 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.

26. Evaluate this SELECT statement: SELECT last_name, first_name, salary FROM employees; How will the results of this query be sorted? Mark for Review (1) Points 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.

27. Evaluate this SELECT statement: SELECT employee_id, last_name, first_name, salary 'Yearly Salary' FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3; Which clause contains an error? Mark for Review (1) Points SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*) FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3; 28. 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. 29. 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.

30. From left to right, what is the correct order of Precedence? Mark for Review (1) Points Arithmetic, Concatenation, Comparison, OR (*) NOT, AND, OR, Arithmetic Arithmetic, NOT, Logical, Comparison Arithmetic, NOT, Concatenation, Logical Test: Final Exam Semester 2 - Part I

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Semester 2 Final Exam Part I covers Sections 8-10 of Database Programming with SQL. Section 8 1. You need to store the SEASONAL data in months and years. Which data type should you use? Mark for Review (1) Points DATE TIMESTAMP INTERVAL YEAR TO MONTH (*) INTERVAL DAY TO SECOND Incorrect. Refer to Section 8 Lesson 2. 2. You need to store the HIRE_DATE value with a time zone displacement value and allow data to be returned in the user's local session time zone. Which data type should you use? Mark for Review (1) Points DATETIME TIMESTAMP TIMESTAMP WITH TIME ZONE

TIMESTAMP WITH LOCAL TIME ZONE (*) Correct 3. The TIMESTAMP data type allows what? Mark for Review (1) Points Time to be stored as an interval of years and months. Time to be stored as a date with fractional seconds. (*) Time to be stored as an interval of days to hours, minutes and seconds. None of the above. Incorrect. Refer to Section 8 Lesson 2. 4. Evaluate this CREATE TABLE statement: CREATE TABLE sales (sales_id NUMBER, customer_id NUMBER, employee_id NUMBER, sale_date TIMESTAMP WITH LOCAL TIME ZONE, sale_amount NUMBER(7,2)); Which statement about the SALE_DATE column is true? Mark for Review (1) Points Data will be normalized to the client time zone. Data stored will not include seconds. Data will be stored using a fractional seconds precision of 5. Data stored in the column will be returned in the database's local time zone. (*) Correct 5. The SPEED_TIME column should store a fractional second value. Which data type should you use? Mark for Review (1) Points

DATE DATETIME TIMESTAMP (*) INTERVAL DAY TO SECOND Incorrect. Refer to Section 8 Lesson 2. 6. Evaluate this CREATE TABLE statement: CREATE TABLE sales ( sales_id NUMBER(9), customer_id NUMBER(9), employee_id NUMBER(9), description VARCHAR2(30), sale_date TIMESTAMP WITH LOCAL TIME ZONE DEFAULT SYSDATE, sale_amount NUMBER(7,2)); Which business requirement will this statement accomplish? Mark for Review (1) Points Sales identification values could be either numbers or characters, or a combination of both. All employee identification values are only 6 digits so the column should be variable in length. Description values can range from 0 to 30 characters so the column should be fixed in length. Today's date should be used if no value is provided for the sale date. (*) Incorrect. Refer to Section 8 Lesson 2. 7. To store time with fractions of seconds, which datatype should be used for a table column? Mark for Review (1) Points DATE INTERVAL YEAR TO MONTH TIMESTAMP (*) INTERVAL DAY TO SECOND

Incorrect. Refer to Section 8 Lesson 2. 8. Which statement about creating a table is true? Mark for Review (1) Points With a CREATE TABLE statement, a table will always be created in the current user's schema. If no schema is explicitly included in a CREATE TABLE statement, the table is created in the current user's schema. (*) If no schema is explicitly included in a CREATE TABLE statement, the CREATE TABLE statement will fail. If a schema is explicitly included in a CREATE TABLE statement and the schema does not exist, it will be created. Incorrect. Refer to Section 8 Lesson 1. 9. Which statement about table and column names is true? Mark for Review (1) Points Table and column names must begin with a letter. (*) Table and column names can begin with a letter or a number. Table and column names cannot include special characters. If any character other than letters or numbers is used in a table or column name, the name must be enclosed in double quotation marks. Correct 10. Which CREATE TABLE statement will fail? Mark for Review (1) Points CREATE TABLE date_1 (date_1 DATE); CREATE TABLE date (date_id NUMBER(9)); (*) CREATE TABLE time (time_id NUMBER(9)); CREATE TABLE time_date (time NUMBER(9));

Correct

Page 1 of 5 11. Which SQL statement below will correctly create the EMP table based on the structure of the EMPLOYEES table? Include only the EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY, and DEPARTMENT_ID columns. Mark for Review (1) Points CREATE TABLE employee AS SELECT employee_id, first_name, last_name, salary, department_id FROM employees; CREATE TABLE emp (employee_id, first_name, last_name, salary, department_id); CREATE TABLE emp SELECT (employee_id, first_name, last_name, salary, department_id FROM employees); CREATE TABLE emp AS SELECT employee_id, first_name, last_name, salary, department_id FROM employees; (*)

Incorrect. Refer to Section 8 Lesson 1. 12. You are creating the EMPLOYEES table. This table should contain the COMMISSION_PCT column and use a value of 10 percent if no commission value is provided when a record is inserted. Which line should you include in the CREATE TABLE statement to accomplish this task? Mark for Review (1) Points commission_pct NUMBER(4,2) DEFAULT 0.10 (*) commission_pct NUMBER(4,2) DEFAULT = 0.10 commission_pct NUMBER(4,2) DEFAULT (0.10) commission_pct NUMBER(4,2) (DEFAULT, 0.10)

Incorrect. Refer to Section 8 Lesson 1. 13. You 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? Mark for Review (1) Points 2001_PRODUCTS PRODUCTS_2001 (*) PRODUCTS_(2001) PRODUCTS--2001 Correct 14. Comments on tables and columns can be stored for documentation by: Mark for Review (1) Points Embedding /* comment */ within the definition of the table. Using the ALTER TABLE CREATE COMMENT syntax Using the COMMENT ON TABLE or COMMENT on COLUMN (*) Using an UPDATE statement on the USER_COMMENTS table Incorrect. Refer to Section 8 Lesson 3. 15. The PLAYERS table contains these columns: PLAYER_ID NUMBER(9) PRIMARY KEY LAST_NAME VARCHAR2(20) FIRST_NAME VARCHAR2(20) TEAM_ID NUMBER(4) SALARY NUMBER(9,2) Which statement should you use to decrease the width of the FIRST_NAME column to 10 if the column currently contains 1500 records, but none are longer than 10 bytes or characters? Mark for Review (1) Points ALTER players TABLE MODIFY COLUMN first_name VARCHAR2(10);

ALTER players TABLE MODIFY COLUMN (first_name VARCHAR2(10)); ALTER TABLE players RENAME first_name VARCHAR2(10); ALTER TABLE players MODIFY (first_name VARCHAR2(10)); (*) Incorrect. Refer to Section 8 Lesson 3. 16. Which command could you use to quickly remove all data from the rows in a table without deleting the table itself? Mark for Review (1) Points ALTER TABLE DROP TABLE MODIFY TRUNCATE TABLE (*) Incorrect. Refer to Section 8 Lesson 3. 17. Evaluate this statement: ALTER TABLE inventory MODIFY backorder_amount NUMBER(8,2); Which task will this statement accomplish? Mark for Review (1) Points 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 18. You need to truncate the EMPLOYEES table. The EMPLOYEES table is not in your schema. Which privilege must you have to truncate the table? Mark for Review (1) Points The DROP ANY TABLE system privilege (*) The TRUNCATE ANY TABLE system privilege The CREATE ANY TABLE system privilege The ALTER ANY TABLE system privilege Incorrect. Refer to Section 8 Lesson 3. 19. Which statement about a column is NOT true? Mark for Review (1) Points You can increase the width of a CHAR column. You can modify the data type of a column if the column contains non-null data. (*) You can convert a CHAR data type column to the VARCHAR2 data type. You can convert a DATE date type column to a VARCHAR2 column. Incorrect. Refer to Section 8 Lesson 3. 20. Evaluate the structure of the EMPLOYEE table: EMPLOYEE_ID NUMBER(9) LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) MANAGER_ID NUMBER(9) SALARY NUMBER(7,2) Which statement should you use to increase the LAST_NAME column length to 35 if the column currently contains 200 records? Mark for Review (1) Points ALTER employee TABLE

ALTER COLUMN (last_name VARCHAR2(35)); ALTER TABLE employee RENAME last_name VARCHAR2(35); ALTER TABLE employee MODIFY (last_name VARCHAR2(35)); (*) You CANNOT increase the width of the LAST_NAME column. Incorrect. Refer to Section 8 Lesson 3. 21. The previous administrator created a table named CONTACTS, which contains outdated data. You want to remove the table and its data from the database. Which statement should you issue? Mark for Review (1) Points DROP TABLE (*) DELETE TRUNCATE TABLE ALTER TABLE Correct 22. Evaluate the structure of the EMPLOYEE table: EMPLOYEE_ID NUMBER(9) LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) MANAGER_ID NUMBER(9) SALARY NUMBER(7,2) The EMPLOYEE_ID column currently contains 500 employee identification numbers. Business requirements have changed and you need to allow users to include text characters in the identification values. Which statement should you use to change this column's data type? Mark for Review (1) Points ALTER TABLE employee MODIFY (employee_id VARCHAR2(9));

ALTER TABLE employee REPLACE (employee_id VARCHAR2(9)); ALTER employee TABLE MODIFY COLUMN (employee_id VARCHAR2(15)); You CANNOT modify the data type of the EMPLOYEE_ID column, as the table is not empty. (*) Correct 23. The TEAMS table contains these columns: TEAM_ID NUMBER(4) Primary Key TEAM_NAME VARCHAR2(20) MGR_ID NUMBER(9) The TEAMS table is currently empty. You need to allow users to include text characters in the manager identification values. Which statement should you use to implement this? Mark for Review (1) Points ALTER teams MODIFY (mgr_id VARCHAR2(15)); ALTER TABLE teams MODIFY (mgr_id VARCHAR2(15)); (*) ALTER TABLE teams REPLACE (mgr_id VARCHAR2(15)); ALTER teams TABLE MODIFY COLUMN (mgr_id VARCHAR2(15)); You CANNOT modify the data type of the MGR_ID column. Incorrect. Refer to Section 8 Lesson 3.

24. Which statement about decreasing the width of a column is true? Mark for Review (1) Points When a character column contains data, you cannot decrease the width of the column. When a character column contains data, you can decrease the width of the column without any restrictions. When a character column contains data, you can decrease the width of the column if the existing data does not violate the new size. (*) You cannot decrease the width of a character column unless the table in which the column resides is empty. Incorrect. Refer to Section 8 Lesson 3.

Section 10 25. Which statement about a FOREIGN KEY constraint is true? Mark for Review (1) Points An index is automatically created for a FOREIGN KEY constraint. A FOREIGN KEY constraint requires the constrained column to contain values that exist in the referenced Primary or Unique key column of the parent table. (*) A FOREIGN KEY constraint allows that a list of allowed values be checked before a value can be added to the constrained column. A FOREIGN KEY column can have a different data type from the primary key column that it references. Correct 26. What 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. Incorrect. Refer to Section 10 Lesson 2. 27. You need to create a composite primary key constraint on the EMPLOYEES table. Which statement is true? Mark for Review (1) Points The PRIMARY KEY constraint must be defined at the table level. (*) A PRIMARY KEY constraint must be defined for each column in the composite primary key. The PRIMARY KEY constraint must be defined for the first column of the composite primary key. The PRIMARY KEY constraint must be defined at the table level and for each column in the composite primary key. Incorrect. Refer to Section 10 Lesson 2. 28. When creating the EMPLOYEES table, which clause could you use to ensure that salary values are 1000.00 or more? Mark for Review (1) Points CONSTRAINT CHECK salary > 1000 CHECK CONSTRAINT (salary > 1000) CONSTRAINT employee_salary_min CHECK salary > 1000 CONSTRAINT employee_salary_min CHECK (salary >= 1000) (*) CHECK CONSTRAINT employee_salary_min (salary > 1000) Correct 29. How many PRIMARY KEY constraints can be created for each table? Mark for Review (1) Points None

One and only one (*) One or two Unlimited Incorrect. Refer to Section 10 Lesson 2. 30. What is an attribute of data that is entered into a primary key column? Mark for Review (1) Points Null and non-unique values cannot be entered into a primary key column. (*) Data that is entered into a primary key column automatically increments by a value of 1 each time a new record is entered into the table. Data that is entered into a primary key column references a column of the same datatype in another table. Data that is entered into a primary key column is restricted to a range of numbers that is defined by the local Oracle database. Incorrect. Refer to Section 10 Lesson 2. 31. Which 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. 32. Which 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. 33. Which statement about a non-mandatory foreign key constraint is true? Mark for Review (1) Points A foreign key value cannot be null. A foreign key value must be unique. A foreign key value must match an existing value in the parent table. A foreign key value must either be null or match an existing value in the parent table. (*) Correct 34. The DEPARTMENTS table contains these columns: DEPARTMENT_ID NUMBER, Primary Key DEPARTMENT_ABBR VARCHAR2(4) DEPARTMENT_NAME VARCHAR2(30) MANAGER_ID NUMBER The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER JOB_ID NUMBER MANAGER_ID NUMBER SALARY NUMBER(9,2) HIRE_DATE DATE Evaluate this statement: ALTER TABLE employees ADD CONSTRAINT REFERENTIAL (manager_id) TO departments(manager_id);

Which statement is true? Mark for Review (1) Points The ALTER TABLE statement creates a referential constraint from the EMPLOYEES table to the DEPARTMENTS table. The ALTER TABLE statement creates a referential constraint from the DEPARTMENTS table to the EMPLOYEES table. The ALTER TABLE statement fails because the ADD CONSTRAINT clause contains a syntax error. (*) The ALTER TABLE statement succeeds, but does NOT recreate a referential constraint. Correct 35. The LINE_ITEM table contains these columns: LINE_ITEM_ID NUMBER PRIMARY KEY PRODUCT_ID NUMBER(9) FOREIGN KEY references the ID column of the PRODUCT table QUANTITY NUMBER(9) UNIT_PRICE NUMBER(5,2) You need to disable the FOREIGN KEY constraint. Which statement should you use? Mark for Review (1) Points ALTER TABLE line_item DISABLE CONSTRAINT product_id_fk; (*) ALTER TABLE line_item DROP CONSTRAINT product_id_fk; ALTER TABLE line_item ENABLE CONSTRAINT product_id_fk; ALTER TABLE line_item DELETE CONSTRAINT product_id_fk;

Correct

36. Which of the following would definitely cause an integrity constraint error? Mark for Review (1) Points Using a subquery in an INSERT statement. Using the MERGE statement to conditionally insert or update rows. Using the DELETE command on a row that contains a primary key with a dependent foreign key declared without either an ON DELETE CASCADE or ON DELETE SET NULL. (*) Using the UPDATE command on rows based in another table. Incorrect. Refer to Section 10 Lesson 3. 37. You disabled the EMPLOYEE_ID_PK PRIMARY KEY constraint on the ID column in the EMPLOYEES table and imported 100 records. You need to enable the constraint and verify that the new and existing ID column values do not violate the PRIMARY KEY constraint. Evaluate this statement: ALTER TABLE employees ENABLE employee_id_pk; Which statement is true? Mark for Review (1) Points The statement will achieve the desired result. The statement will execute, but will ensure that the new ID values are unique. The statement will execute, but will not verify that the existing values are unique. The statement will NOT execute because it contains a syntax error. (*) Incorrect. Refer to Section 10 Lesson 3. 38. When dropping a constraint, which keyword(s) specifies that all the referential integrity constraints that refer to the primary and unique keys defined on the dropped columns are dropped as well? Mark for Review (1) Points FOREIGN KEY

REFERENCES CASCADE (*) ON DELETE SET NULL Incorrect. Refer to Section 10 Lesson 3. 39. You successfully create a table named SALARY in your company's database. Now, you want to establish a parent/child relationship between the EMPLOYEES table and the SALARY table by adding a FOREIGN KEY constraint to the SALARY table that references its matching column in the EMPLOYEES table. You have not added any data to the SALARY table. Which of the following statements should you issue? Mark for Review (1) Points ALTER TABLE salary ADD CONSTRAINT fk_employee_id_01 FOREIGN KEY (employee_id) REFERENCES employees (employee_id); (*) ALTER TABLE salary ADD CONSTRAINT fk_employee_id_ FOREIGN KEY BETWEEN salary (employee_id) AND employees (employee_id); ALTER TABLE salary FOREIGN KEY CONSTRAINT fk_employee_id_ REFERENCES employees (employee_id); ALTER TABLE salary ADD CONSTRAINT fk_employee_id_ FOREIGN KEY salary (employee_id) = employees (employee_id);

Incorrect. Refer to Section 10 Lesson 3. 40. The PO_DETAILS table contains these columns: PO_NUM NUMBER NOT NULL, Primary Key PO_LINE_ID NUMBER NOT NULL, Primary Key PRODUCT_ID NUMBER Foreign Key to PRODUCT_ID column of the PRODUCTS table QUANTITY NUMBER UNIT_PRICE NUMBER(5,2) Evaluate this statement:

ALTER TABLE po_details DISABLE CONSTRAINT product_id_pk CASCADE; For which task would you issue this statement? Mark for Review (1) Points To create a new PRIMARY KEY constraint on the PO_NUM column To drop and recreate the PRIMARY KEY constraint on the PO_NUM column To disable the PRIMARY KEY and any FOREIGN KEY constraints that are dependent on the PO_NUM column (*) To disable the constraint on the PO_NUM column while creating a PRIMARY KEY index Incorrect. Refer to Section 10 Lesson 3. 41. What actions can be performed on or with Constraints? Mark for Review (1) Points Add, Drop, Enable, Disable, Cascade (*) Add, Minus, Enable, Disable, Collapse Add, Subtract, Enable, Cascade Add, Drop, Disable, Disregard Correct 42. Evaluate this statement ALTER TABLE employees ENABLE CONSTRAINT emp_id_pk; For which task would you issue this statement? Mark for Review (1) Points To add a new constraint to the EMPLOYEES table To disable an existing constraint on the EMPLOYEES table To activate a new constraint while preventing the creation of a PRIMARY KEY index

To activate the previously disabled constraint on the EMPLOYEE_ID column while creating a PRIMARY KEY index (*) Correct 43. You need to add a PRIMARY KEY constraint on the EMP_ID column of the EMPLOYEES table. Which ALTER TABLE statement should you use? Mark for Review (1) Points ALTER TABLE employees ADD CONSTRAINT PRIMARY KEY (emp_id); (*) ALTER TABLE ADD CONSTRAINT emp_emp_id_pk PRIMARY KEY employees(emp_id); ALTER TABLE employees MODIFY emp_id PRIMARY KEY; ALTER TABLE employees MODIFY CONSTRAINT PRIMARY KEY (emp_id);

Correct 44. Evaluate this CREATE TABLE statement: CREATE TABLE customers (customer_id NUMBER, customer_name VARCHAR2(25), address VARCHAR2(25), city VARCHAR2(25), region VARCHAR2(25), postal_code VARCHAR2(11), CONSTRAINT customer_id_un UNIQUE(customer_id), CONSTRAINT customer_name_nn NOT NULL(customer_name)); Why does this statement fail when executed? Mark for Review (1) Points The NUMBER data types require precision values. UNIQUE constraints must be defined at the column level.

The CREATE TABLE statement does NOT define a PRIMARY KEY. NOT NULL constraints CANNOT be defined at the table level. (*) Correct 45. Which statement about constraints is true? Mark for Review (1) Points A single column can have only one constraint applied. PRIMARY KEY constraints can only be specified at the column level. NOT NULL constraints can only be specified at the column level. (*) UNIQUE constraints are identical to PRIMARY KEY constraints. Incorrect. Refer to Section 10 Lesson 1. 46. Primary Key, Foreign Key, Unique Key and Check Constraints can be added at which two levels? (Choose two) Mark for Review (1) Points (Choose all correct answers) Null Field Table (*) Row Dictionary Column (*) Correct 47. You 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 48. What is the highest number of NOT NULL constraints you can have on a table? Mark for Review (1) Points 5 10 3 You can have as many NOT NULL constraints as you have columns in your table. (*) Correct 49. Which statement about the NOT NULL constraint is true? Mark for Review (1) Points The NOT NULL constraint must be defined at the column level. (*) The NOT NULL constraint can be defined at either the column level or the table level. The NOT NULL constraint requires a column to contain alphanumeric values. The NOT NULL constraint prevents a column from containing alphanumeric values. Incorrect. Refer to Section 10 Lesson 1. 50. You 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 Incorrect. Refer to Section 10 Lesson 1. Test: Final Exam Semester 2 - Part II

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Semester 2 Final Exam Part II covers Sections 11-16 of Database Programming with SQL also. Section 11 1. You need to create a view that when queried will display the name, employee identification number, first and last name, salary, and department identification number. When queried, the display should be sorted by salary from lowest to highest, then by last name and first name alphabetically. The view definition should be created regardless of the existence of the EMPLOYEES table. No DML may be performed when using this view. Evaluate these statements: CREATE OR REPLACE NOFORCE VIEW EMP_SALARY_V AS SELECT employee_id, last_name, first_name, salary, department_id FROM employees WITH READ ONLY; SELECT * FROM emp_salary_v ORDER BY salary, last_name, first_name; Which statement is true? Mark for Review (1) Points When both statements are executed all of the desired results are achieved. The CREATE VIEW statement will fail if the EMPLOYEES table does not exist. (*) The statements will NOT return all of the desired results because the WITH CHECK OPTION clause is NOT included in the CREATE VIEW statement. To achieve all of the desired results this ORDER ON clause should be added to the CREATE VIEW statement: 'ORDER ON salary, last_name, first_name?. Incorrect. Refer to Section 11 Lesson 1.

2. Evaluate this view definition: CREATE OR REPLACE VIEW part_name_v AS SELECT DISTINCT part_name FROM parts WHERE cost >= 45; Which of the following statements using the PART_NAME_V view will execute successfully? Mark for Review (1) Points SELECT * FROM part_name_v; (*) UPDATE part_name_v SET cost = cost * 1.23 WHERE part_id = 56990; DELETE FROM part_name_v WHERE part_id = 56897; INSERT INTO part_name_v (part_id, part_name, product_id, cost) VALUES (857986, 'cylinder', 8790, 3.45);

Incorrect. Refer to Section 11 Lesson 1. 3. Which of the following keywords cannot be used when creating a view? Mark for Review (1) Points HAVING WHERE ORDER BY They are all valid keywords when creating views. (*) Correct

4. In order to query a database using a view, which of the following statements applies? Mark for Review (1) Points Use special VIEW SELECT keywords. You can retrieve data from a view as you would from any table. (*) You can never see all the rows in the table through the view. The tables you are selecting from can be empty, yet the view still returns the original data from those tables. Correct 5. Views must be used to select data from a table. As soon as a view is created on a table, you can no longer select directly from the table. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 11 Lesson 1. 6. Which option would you use to modify a view rather than dropping it and recreating it? Mark for Review (1) Points FORCE NOFORCE CREATE OR REPLACE (*) WITH ADMIN OPTION Incorrect. Refer to Section 11 Lesson 1. 7. Which statement about the CREATE VIEW statement is true? Mark for Review (1) Points A CREATE VIEW statement CAN contain a join query. (*)

A CREATE VIEW statement CANNOT contain an ORDER BY clause. A CREATE VIEW statement CANNOT contain a function. A CREATE VIEW statement CANNOT contain a GROUP BY clause. Incorrect. Refer to Section 11 Lesson 1. 8. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER JOB_ID NUMBER MANAGER_ID NUMBER SALARY NUMBER(9,2) COMMISSOIN NUMBER(7,2) HIRE_DATE DATE Which SELECT statement could be used to display the 10 lowest paid clerks that belong to department 70? Mark for Review (1) Points SELECT ROWNUM "Ranking", last_name||' ,'||first_name "Employee", salary "Salary" FROM (SELECT last_name, first_name, salary FROM employees ORDER BY salary) WHERE ROWNUM <=10 AND job_id LIKE 'CLERK' AND department_id = 70; SELECT ROWNUM "Ranking",last_name||','||first_name "Employee", salary "Salary" FROM (SELECT last_name, first_name, salary, job_id FROM employees WHERE job_id LIKE 'CLERK' AND department_id = 70 ORDER BY salary) WHERE ROWNUM <=10; (*) SELECT ROWNUM "Ranking", last_name||' ,'||first_name "Employee", salary "Salary" FROM (SELECT last_name, first_name, salary, job_id, dept_id FROM employees WHERE ROWNUM <=10 ORDER BY salary)

WHERE job_id LIKE 'CLERK' AND department_id = 70; The only way is to use the data dictionary. Incorrect. Refer to Section 11 Lesson 3. 9. The 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? Mark for Review (1) Points 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. (*) The 25 greatest new balance values were displayed from the highest to the lowest. The statement failed to execute because the ORDER BY does NOT use the Top-n column. Incorrect. Refer to Section 11 Lesson 3. 10. An inline view is an unnamed select statement found: Mark for Review (1) Points In the user_views data dictionary view In a special database column of a users table Enclosed in parentheses within the select list of a surrounding query

Enclosed in parentheses within the from clause of a surrounding query (*) Incorrect. Refer to Section 11 Lesson 3 Section 11 11. The EMP_HIST_V view is no longer needed. Which statement should you use to the remove this view? Mark for Review (1) Points DROP emp_hist_v; DELETE emp_hist_v; REMOVE emp_hist_v; DROP VIEW emp_hist_v; (*) Incorrect. Refer to Section 11 Lesson 3. 12. Which of the following describes a top-N query? Mark for Review (1) Points A top-N query returns the bottom 15 records from the specified table. A top-N query returns the top 15 records from the specified table. A top-N query returns a result set that is sorted according to the specified column values. A top-N query returns a limited result set, returning data based on highest or lowest criteria. (*) Incorrect. Refer to Section 11 Lesson 3. 13. You create a view on the EMPLOYEES and DEPARTMENTS tables to display salary information per department. What will happen if you issue the following statement: 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; Mark for Review (1) Points

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 constains an error and will fail. Incorrect. Refer to Section 11 Lesson 2. 14. For a View created using the WITH CHECK OPTION keywords, which of the following statements are true? Mark for Review (1) Points The view will allow the user to check it against the data dictionary Prohibits changing rows not returned by the subquery in the view definition. (*) Prohibits DML actions without administrator CHECK approval Allows for DELETES from other tables, including ones not listed in subquery Incorrect. Refer to Section 11 Lesson 2. 15. Your manager has just asked you to create a report that illustrates the salary range of all the employees at your company. Which of the following SQL statements will create a view called SALARY_VU based on the employee last names, department names, salaries, and salary grades for all employees? Use the EMPLOYEES, DEPARTMENTS, and JOB_GRADES tables. Label the columns Employee, Department, Salary, and Grade, respectively. Mark for Review (1) Points CREATE OR REPLACE VIEW salary_vu AS SELECT e.last_name "Employee", d.department_name "Department", e.salary "Salary", j. grade_level "Grade" FROM employees e, departments d, job_grades j WHERE e.department_id equals d.department_id AND e.salary BETWEEN j.lowest_sal and j.highest_sal; CREATE OR REPLACE VIEW salary_vu AS SELECT e.empid "Employee", d.department_name "Department", e.salary "Salary", j. grade_level "Grade"

FROM employees e, departments d, job_grades j WHERE e.department_id = d.department_id NOT e.salary BETWEEN j.lowest_sal and j.highest_sal; CREATE OR REPLACE VIEW salary_vu AS SELECT e.last_name "Employee", d.department_name "Department", e.salary "Salary", j. grade_level "Grade" FROM employees e, departments d, job_grades j WHERE e.department_id = d.department_id AND e.salary BETWEEN j.lowest_sal and j.highest_sal; (*) CREATE OR REPLACE VIEW salary_vu AS (SELECT e.last_name "Employee", d.department_name "Department", e.salary "Salary", j. grade_level "Grade" FROM employees emp, departments d, job grades j WHERE e.department_id = d.department_id AND e.salary BETWEEN j.lowest_sal and j.highest_sal);

Correct 16. Which 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 Correct 17. You 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 do not change the result set of the view. Which clause should include 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. 18. You cannot insert data through a view if the view includes ______. Mark for Review (1) Points A WHERE clause A join A column alias A GROUP BY clause (*) Incorrect. Refer to Section 11 Lesson 2. 19. Which of the following is TRUE regarding simple views? Mark for Review (1) Points They derive data from many tables, so they typically contain joins. They contain functions or groups of data They can perform DML operations through the view (*) They are not stored in the Data Dictionary Correct

Section 12 20. You issue this statement: ALTER SEQUENCE po_sequence INCREMENT BY 2; Which statement is true? Mark for Review (1) Points

Sequence numbers will be cached. Future sequence numbers generated will increase by 2 each time a number is generated. (*) If the PO_SEQUENCE sequence does not exist, it will be created. The statement fails if the current value of the sequence is greater than the START WITH value. Correct

Page 2 of 5

Section 12 21. Which statement would you use to remove the EMP_ID_SEQ sequence? Mark for Review (1) Points DELETE SEQUENCE emp_id_seq; DROP SEQUENCE emp_id_seq; (*) ALTER SEQUENCE emp_id_seq ?; REMOVE SEQUENCE emp_id_seq; Incorrect. Refer to Section 12 Lesson 1. 22. What would you create to make the following statement execute faster? SELECT * FROM employees WHERE LOWER(last_name) = 'chang'; Mark for Review (1) Points A synonym. An index, either a normal or a function_based index. (*)

A composite index. Nothing; the performance of this statement cannot be improved. Incorrect. Refer to Section 12 Lesson 2. 23. Which statement about an index is true? Mark for Review (1) Points An index can only be created on a single table column. Creating an index will always improve query performance. Creating an index reorders the data in the underlying table. An index created on multiple columns is called a composite or concatenated index. (*) Incorrect. Refer to Section 12 Lesson 2. 24. The following indexes exist on the EMPLOYEES table: A unique index on the EMPLOYEE_ID primary key column A non-unique index on the JOB_ID column A composite index on the FIRST_NAME and LAST_NAME columns. If the EMPLOYEES table is dropped, which indexes are automatically dropped at the same time? Mark for Review (1) Points EMP_ID only JOB_ID only DEPT_ID only EMP_ID and JOB_ID All Indexes (*) Incorrect. Refer to Section 12 Lesson 2. 25. You want to create a composite index on the FIRST_NAME and LAST_NAME columns of the EMPLOYEES table. Which SQL statement will accomplish this task? Mark for Review

(1) Points CREATE INDEX fl_idx ON employees(first_name || last_name); CREATE INDEX fl_idx ON employees(first_name), employees(last_name); CREATE INDEX fl_idx ON employees(first_name,last_name); (*) CREATE INDEX fl_idx ON employees(first_name); CREATE INDEX fl_idx ON employees(last_name);

Incorrect. Refer to Section 12 Lesson 2. 26. For which column would you create an index? Mark for Review (1) Points A column which has only 4 distinct values. A column that is updated frequently A column with a large number of null values (*) A column that is infrequently used as a query search condition Incorrect. Refer to Section 12 Lesson 2.

Section 13 27. Granting an object privilege WITH GRANT OPTION allows the recipient to grant other object privileges on the table to other users. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 13 Lesson 2. 28. Which keyword would you use to grant an object privilege to all database users? Mark for Review (1) Points ADMIN ALL PUBLIC (*) USERS Correct 29. Which statement would you use to add privileges to a role? Mark for Review (1) Points CREATE ROLE ALTER ROLE GRANT (*) ASSIGN Incorrect. Refer to Section 13 Lesson 2. 30. Which statement would you use to grant a role to users? Mark for Review (1) Points GRANT (*) ALTER USER CREATE USER ASSIGN Incorrect. Refer to Section 13 Lesson 2. Section 13

31. Which data dictionary view shows which system privileges have been granted to a user? Mark for Review (1) Points USER_TAB_PRIVS USER_SYS_PRIVS (*) USER_SYSTEM_PRIVS USER_SYSTEM_PRIVILEGES Incorrect. Refer to Section 13 Lesson 2. 32. Which of the following best describes the purpose of the REFERENCES object privilege on a table? Mark for Review (1) Points It allows a user's session to read from the table but only so that foreign key constraints can be checked. (*) It allows a user to refer to the table in a SELECT statement. It allows a user to create foreign key constraints on the table. It allows the user to create new tables which contain the same data as the referenced table. Incorrect. Refer to Section 13 Lesson 2. 33. User SUSAN creates an EMPLOYEES table, and then creates a view EMP_VIEW which shows only the FIRST_NAME and LAST_NAME columns of EMPLOYEES. User RUDI needs to be able to access employees' names but no other data from EMPLOYEES. Which statement should SUSAN execute to allow this? Mark for Review (1) Points SELECT * FROM emp_view FOR rudi; CREATE SYNONYM emp_view FOR employees; GRANT SELECT ON emp_view TO rudi; (*) GRANT SELECT ON emp_view ONLY TO rudi; Correct

34. Evaluate this statement: ALTER USER bob IDENTIFIED BY jim; Which statement about the result of executing this statement is true? Mark for Review (1) Points A new password is assign to user BOB. (*) A new user JIM is created from user BOB's profile. The user BOB is assigned the same privileges as user JIM. The user BOB is renamed and is accessible as user JIM. Incorrect. Refer to Section 13 Lesson 1. 35. User Kate wants to create indexes on tables in her schema. What privilege must be granted to Kate so that she can do this? Mark for Review (1) Points CREATE INDEX CREATE ANY INDEX ALTER TABLE None; users do not need extra privileges to create indexes on tables in their own schema (*) Correct 36. User JAMES has created a CUSTOMERS table and wants to allow all other users to SELECT from it. Which command should JAMES use to do this? Mark for Review (1) Points GRANT customers(SELECT) TO PUBLIC; GRANT SELECT ON customers TO ALL; GRANT SELECT ON customers TO PUBLIC; (*) CREATE PUBLIC SYNONYM customers FOR james.customers;

Correct 37. You want to grant user BOB the ability to change other users' passwords. Which privilege should you grant to BOB? Mark for Review (1) Points The ALTER USER privilege (*) The CREATE USER privilege The DROP USER privilege The CREATE PROFILE privilege Incorrect. Refer to Section 13 Lesson 1. 38. Which of these SQL functions used to manipulate strings is not a valid regular expression function? Mark for Review (1) Points REGEXP_REPLACE REGEXP_LIKE REGEXP (*) REGEXP_SUBSTR Incorrect. Refer to Section 13 Lesson 3. 39. _________________ are special characters that have a special meaning, such as a wildcard character, a repeating character, a non-matching character, or a range of characters. You can use several of these symbols in pattern matching. Mark for Review (1) Points Clip art Meta characters (*) Alphanumeric values Reference checks Correct

40. Regular expressions are a method of describing both simple and complex patterns for searching and manipulating. True or False? Mark for Review (1) Points True (*) False Correct Section 14 41. A transaction makes several successive changes to a table. If required, you want to be able to rollback the later changes while keeping the earlier changes. What must you include in your code to do this? Mark for Review (1) Points An update statement A savepoint (*) An object privilege A database link A sequence Incorrect. Refer to Section 14 Lesson 1. 42. Steven King's row in the EMPLOYEES table has EMPLOYEE_ID = 100 and SALARY = 24000. A user issues the following statements in the order shown: UPDATE employees SET salary = salary * 2 WHERE employee_id = 100; COMMIT; UPDATE employees SET salary = 30000 WHERE employee_id = 100; The user's database session now ends abnormally. What is now King's salary in the table? Mark for Review (1) Points

48000 (*) 30000 24000 78000 Incorrect. Refer to Section 14 Lesson 1.

Section 15 43. You 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 A cross join A non-equijoin (*) A full outer join Incorrect. Refer to Section 15 Lesson 2. 44. What is produced when a join condition is not specified in a multiple-table query using Oracle proprietary Join syntax? Mark for Review (1) Points A self-join An outer join An equijoin A Cartesian product (*) Incorrect. Refer to Section 15 Lesson 1.

45. You have two tables named EMPLOYEES and SALES. You want to identify the sales representatives who have generated at least $100,000 in revenue. Which query should you issue? Mark for Review (1) Points SELECT e.first_name, e.last_name, s.sales FROM employees e, sales s WHERE e.employee_id = s.employee_id AND revenue > 100000; SELECT e.first_name, e.last_name, s.sales FROM employees e, sales s WHERE e.employee_id = s.employee_id AND revenue >= 100000; (*) SELECT e.first_name, e.last_name, s.sales FROM employees, sales WHERE e.employee_id = s.employee_id AND revenue >= 100000; SELECT first_name, last_name, sales FROM employees e, sales s WHERE e.employee_id = s.employee_id AND revenue > 100000;

Incorrect. Refer to Section 15 Lesson 1. 46. You have the following EMPLOYEES table: EMPLOYEE_ID NUMBER(5) NOT NULL PRIMARY KEY FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) ADDRESS VARCHAR2(35) CITY VARCHAR2(25) STATE VARCHAR2(2) ZIP NUMBER(9) TELEPHONE NUMBER(10) DEPARTMENT_ID NUMBER(5) NOT NULL FOREIGN KEY The BONUS table includes the following columns: BONUS_ID NUMBER(5) NOT NULL PRIMARY KEY ANNUAL_SALARY NUMBER(10) BONUS_PCT NUMBER(3, 2) EMPLOYEE_ID VARCHAR2(5) NOT NULL FOREIGN KEY You want to determine the amount of each employee's bonus as a calculation of salary times bonus. Which of the following queries should you issue?

Mark for Review (1) Points SELECT e.first_name, e.last_name, b.annual_salary * b. bonus_pct FROM employees e, bonus b WHERE e.employee_id = b.employee_id; (*) SELECT e.first_name, e.last_name, b.annual_salary, b. bonus_pct FROM employees e, bonus b WHERE e.employee_id = b.employee_id; SELECT e.first_name, e.last_name, b.annual_salary, b. bonus_pct FROM employees, bonus WHERE e.employee_id = b.employee_id; SELECT first_name, last_name, annual_salary * bonus_pct FROM employees, bonus NATURAL JOIN;

Incorrect. Refer to Section 15 Lesson 1. 47. The CUSTOMERS and SALES tables contain these columns: CUSTOMERS CUST_ID NUMBER(10) PRIMARY KEY COMPANY VARCHAR2(30) LOCATION VARCHAR2(20) SALES SALES_ID NUMBER(5) PRIMARY KEY CUST_ID NUMBER(10) FOREIGN KEY TOTAL_SALES NUMBER(30) Which SELECT statement will return the customer ID, the company and the total sales? Mark for Review (1) Points SELECT c.cust_id, c.company, s.total_sales FROM customers c, sales s WHERE c.cust_id = s.cust_id (+); SELECT cust_id, company, total_sales FROM customers, sales WHERE cust_id = cust_id;

SELECT c.cust_id, c.company, s.total_sales FROM customers c, sales s WHERE c.cust_id = s.cust_id; (*) SELECT cust_id, company, total_sales FROM customers c, sales s WHERE c.cust_id = s.cust_id;

Incorrect. Refer to Section 15 Lesson 1. 48. Using Oracle Proprietary join syntax, which operator would you use after one of the column names in the WHERE clause when creating an outer join? Mark for Review (1) Points (+) (*) * + = Correct 49. The EMPLOYEE_ID column in the EMPLOYEES table corresponds to the EMPLOYEE_ID column of the ORDERS table. The EMPLOYEE_ID column in the ORDERS table contains null values for rows that you need to display. Which type of join should you use to display the data? Mark for Review (1) Points Natural join Self-join Outer join (*) Equijoin Incorrect. Refer to Section 15 Lesson 3.

Section 16 50. Unit testing is done prior to a database going into production to ensure a random number of business requirements functions properly. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 16 Lesson 1. Section 12 Lesson 1 1. The explanation below is a column integrity constraint: A column must contain only values consistent with the defined data format of the column. True or False? True (*) 2. A table must have a primary key. True or False? False (*) 3. The explanation below is a userdefined integrity rule: A primary key must be unique, and no part of the primary key can be null. True or False? False (*) 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. Referential integrity (*) Section 12 Lesson 2 5. Attributes become tables in a database. True or False? False (*) 6. In a physical data model, a relationship is represented as a combination of: Primary Key or Unique Key (*) Foreign Key (*) 7. The transformation from an ER diagram to a physical design involves changing terminology. Secondary Unique Identifiers becomes

Unique Constraints (*) 8. One-to-One relationships are transformed into Check Constraints in the tables created at either end of that relationship. True or False? False (*) 9. What do you create when you transform a one to one relationship from your ER diagram into a physical design? Intersection table (*) 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? False (*) Section 12 Lesson 4 11. An "Arc Implementation" can be done just like any other Relationship - you simply add the required Foreign Keys. True or False? False (*) Section 13 Lesson 1 12. What command will return data from the database to you? SELECT (*) 13. The _______ clause can be added to a select statement to return a subset of the data. WHERE (*) Section 16 Lesson 1 14. In a SQL statement, which clause specifies one or more columns to be returned by the query? SELECT (*) Section 16 Lesson 1 15. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL query? AS (*) Section 16 Lesson 1

16. In the default order of precedence, which operator would be evaluated first? Multiplications (*) 17. You query the database with this SQL statement: SELECT * FROM students; Why would you use this statement? To view data (*) 18. Which keyword can be used to specify a column alias? AS (*) 19. 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? 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. 20. In which clause of a SELECT statement would you specify the name of the table or tables being queried? the FROM clause (*) 21. All computers in the world speaks the same languages, so you only need to learn one programming language - Oracle SQL. True or False? False (*) Section 17 Lesson 1 23.

Which comparison operator searches for a specified character pattern? LIKE (*) 24. Where in a SQL statement can you not use arithmetic operators? FROM (*) 25. 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? DISTINCT (*) 26. When using the LIKE condition to search for _ symbols, which character can you use as the ESCAPE option? \ (*) 27. You need to combine the first and last name values in the EMPLOYEE table and display the values as a combined character string. Which operator should you use? || (*)

Section 17 Lesson 1 28. Which comparison condition would you use to select rows that match a character pattern? LIKE (*) 29. 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? IN (*) 30. The PLAYERS table contains these columns: PLAYER_ID NUMBER (9) Primary Key LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) TEAM_ID NUMBER (4) MANAGER_ID NUMBER (9) POSITION_ID NUMBER (4) Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID and MANAGER_ID columns? SELECT DISTINCT team_id, manager_id FROM players; (*)

31. 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 SELECT last_name, department_id FROM employees WHERE employee_id = 176; 31. 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 SELECT last_name, department_id FROM employees WHERE employee_id = 176; (*) 32. Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPT_ID values from the EMPLOYEES table? SELECT manager_id, department_id FROM employees; (*) 33. 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? % (*)

34. You want to create a report that displays all employees who were hired before January 1, 2000 and whose annual salaries are greater than 50000. The EMPLOYEES table contains these columns: EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY LAST_NAME VARCHAR2(35) 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 WHERE hiredate < '01-jan-00' AND salary > 50000; (*) Section 17 Lesson 3 35. The STUDENT table contains these columns: STUDENT_ID NUMBER(10) Primary Key LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) MAJOR_ID NUMBER(3) ADVISOR_ID NUMBER(5) Evaluate this statement: SELECT DISTINCT advisor_id, major_id FROM student; Which statement is true? Each MAJOR_ID can be displayed more than once per ADVISOR_ID. (*) Section 17 Lesson 3 36. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(9) PrimaryKey LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) DEPARTMENT_ID NUMBER(5) NOT NULL MANAGER_ID NUMBER(9) NOT NULL Evaluate these two SELECT statements: 1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees; 2. SELECT employee_id, department_id, manager_id FROM employees; Which of the following statements is true? The two statements will display the same data. (*)

Section 18 Lesson 1 37. You need to override the default sort order of the ORDER BY clause so that the data is displayed in reverse alphabetical order. Which keyword should you include in the ORDER BY clause? DESC (*) 38. Which statement about the default sort order is true? The earliest date values are displayed first. (*) 39. Which logical operator returns TRUE if either condition is true? OR (*) 40. Which statement about the logical operators is true? The order of operator precedence is NOT, AND, and OR. (*) 41. Which of the following best describes the meaning of the LIKE operator? True (*) 42. The ORDER BY clause always comes last. True or False? True (*) Section 18 Lesson 2 43. Evaluate this SELECT statement: SELECT emp_id, last_name, first_name, salary 'Yearly Salary' FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3; Which clause contains an error? SELECT emp_id, last_name, first_name, salary 'Yearly Salary' (*) 44. Evaluate this SQL statement: SELECT product_id, product_name, price FROM products ORDER BY product_name, price; What occurs when the statement is executed? The results are sorted alphabetically and then numerically. (*)

Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id = 34 OR department_id = 45 OR department_id = 67; Which operator is the equivalent of the OR conditions used in this SELECT statement? IN (*) 46. Evaluate this SELECT statement: SELECT last_name, first_name, email FROM employees ORDER BY email; If the EMAIL column contains null values, which statement is true? Null email values will be displayed last in the result. (*) 47. Evaluate this SELECT statement: SELECT last_name, first_name, salary FROM employees; How will the results of this query be sorted? The database will display the rows in whatever order it finds it in the database, so no particular order. (*) 48. Evaluate this SELECT statement: SELECT last_name, first_name, department_id, manager_id FROM employees; You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use? ORDER BY manager_id, last_name, first_name (*) Section 18 Lesson 3 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 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? SELECT last_name, first_name FROM players WHERE position_id >= 6900 ORDER BY last_name, first_name; (*) 50. 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? There is no difference in the result between the two statements. (*)

1. The explanation below is an example of what constraint type: The value in the dept_no column of the EMPLOYEES table must match a value in the dept_no column in the DEPARTMENTS table. Mark for Review (1) Points Referential integrity (*) 2. One or more columns in a primary key can be null. True or False? Mark for Review (1) Points

False (*) 3. The explanation below defines which constraint type: A primary key must be unique, and no part of the primary key can be null. Mark for Review (1) Points Entity integrity (*) 4. The explanation below is an example of what constraint type: If the value in the balance column of the ACCOUNTS table is below 100, we must send a letter to the account owner which will require extra programming to enforce. Mark for Review (1) Points User-defined integrity (*) 5. A table does not have to have a primary key. True or False? Mark for Review (1) Points True (*) 6. A foreign key always refers to a primary key in the same table. True or False? Mark for Review (1) Points False (*) 7. Identify all of the correct 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 row in a table (*) A set of columns that uniquely identifies each row in a table (*)

8. Foreign keys cannot be null when Mark for Review (1) Points It is part of a primary key (*)

9. The explanation below defines which constraint type: A column must contain only values consistent with the defined data format of the column Mark for Review Column integrity (*) 10. Column integrity refers to Mark for Review Columns always containing values consistent with the defined data format (*) 1. Why would this table name NOT work in an Oracle database? 2007_EMPLOYEES Mark for Review Table names must start with an alphabetic character (*) 2. In a physical data model, an entity becomes a _____________. Mark for Review (1) Points Table (*) 3. The transformation from an ER diagram to a physical design involves changing terminology. Entities in the ER diagram become __________ , and attributes become ____________. Mark for Review (1) Points Tables, Columns (*) 4. In a physical data model, a relationship is represented as a: Mark for Review (1) Points Foreign Key (*) 5. The transformation from an ER diagram to a physical design involves changing terminology. Relationships in the ER diagram become __________ , and primary unique identifiers become ____________. Mark for Review (1) Points Foreign keys, primary keys (*) 6. In an Oracle database, why would the following table name not be allowed 'EMPLOYEE JOBS'? Mark for Review You cannot have spaces between words in a table name (*)

7. Attributes become columns in a database table. True or False? Mark for Review (1) Points True (*) 1. Relationships on an ERD can only be transformed into UIDs in the physical model? True or False? Mark for Review (1) Points False (*) 2. One-to-Many Optional to Mandatory becomes a _______________ on the Master table. Mark for Review (1) Points Nothing (There are no new columns created on the Master table) (*) 3. Two entities A and B have an optional (A) to Mandatory (B) One-to-One relationship. When they are transformed, the Foreign Key(s) is placed on: Mark for Review (1) Points The table B (*) 4. 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 Intersection table (*) 5. A barrred Relationship will result in a Foreign Key column that also is part of: Mark for Review (1) Points The Primary Key (*) 6. One-to-One relationships are transformed into Foreign Keys in the tables created at either end of that relationship? True or False? Mark for Review (1) Points False (*)

1. 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 optional. True or False? Mark for Review (1) Points True (*) 2. The "Arc Implementation" is a synonym for what type of implementation? Mark for Review (1) Points Supertype and Subtype Implementation (*) 3. Which of the following are reasons you should consider when using a Subtype Implementation? Mark for Review When the common access paths for the subtypes are different. (*) Most of the relationships are at the subtype level (*) 4. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. What additional step must you take with the created foreign keys to ensure the exclusivity principle of arc relationships? (Assume that you are implementing an Exclusive Design) (Choose Two) Mark for Review Make all relationships optional (*) Create an additional check constraint to verify that one foreign key is populated and the others are not (*) 1. Examine the follolowing SELECT statement. SELECT * FROM employees; This statement will retrieve all the rows in the employees table. True or False? Mark for Review (1) Points True (*) False Correct

2. What command can be added to a select statement to return a subset of the data? Mark for Review (1) Points WHERE (*) WHEN ALL EVERYONE Correct 3. What command retrieves data from the database? Mark for Review (1) Points ALTER SELECT (*) DESCRIBE INSERT Correct 4. What command can be used to show information about the structure of a table? Mark for Review (1) Points ALTER SELECT DESCRIBE (*) INSERT Correct 5. What command do you use to add rows to a table Mark for Review (1) Points

INSERT (*) ADD ADD_ROW NEW_ROW Incorrect. Refer to Section 12 Lesson 1. 1. The SQL statement ALTER TABLE EMPLOYEES DROP COLUMN SALARY will delete all of the rows in the employees table. True or False? Mark for Review (1) Points True False (*) Correct 2. 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 STATE='FL'; how many rows will be left in the table? Mark for Review (1) Points 0 1 (*) 2 3 Incorrect. Refer to Section 12 Lesson 2.

3. What will the following statement do to the employee table? ALTER TABLE employees ADD (gender VARCHAR2(1)) Mark for Review (1) Points Add a new row to the EMPLOYEES table Rename a column in the EMPLOYEES table Change the datatype of the GENDER column Add a new column called GENDER to the EMPLOYEES table (*) Correct 1. In which phases of the System Development Life Cycle will we need to use SQL as a language? (Choose Two) Mark for Review (1) Points Transition (*) Build and Document (*) 2. The data model can be used to... Mark for Review (1) Points All of the Above (*) 3. During which phases of the System Development Life Cycle would you roll out the system to the users? Mark for Review (1) Points Transition and Production (*)

1. In which phases of the System Development Life Cycle will we need to use SQL as a language? (Choose Two) Mark for Review (1) Points Transition (*)

Build and Document (*) 2. The data model can be used to... Mark for Review (1) Points All of the Above (*) 3. During which phases of the System Development Life Cycle would you roll out the system to the users? Mark for Review (1) Points Transition and Production (*)

1. SELECT * FROM departments; is a: Mark for Review (1) Points Statement (*) 2. What is a NULL value? Mark for Review An unknown value (*) 3. The order of operator precedence is Mark for Review * / + - (*)

4. The SQL SELECT statement is capable of: Mark for Review (1) Points Selection and projection (*) 5. If you want to see just a subset of the columns in a table, you use what symbol? Mark for Review (1) Points None of the above, instead of using a symbol you name the columns you want to see the data for. (*)

1. RDBMS stands for Mark for Review (1) Points Relational Database manipulation system Relational Database management system (*) Relational Database mutilation system Relational database management style Correct 2. Once data has been created in a RDBMS, the ony way of getting it out again is by writing a Java or C program. No other languages can be used to access that data. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 15 Lesson 4. 3. The following table creation statement is valid. True or False? CREATE TABLE country ( ID NUMBER(6) NOT NULL, NAME VARCHAR2(30) NOT NULL, LOC VARCHAR2(40), REG_ID NUMBER, NAME VARCHAR2(25)) Mark for Review (1) Points True False (*) Incorrect. Refer to Section 15 Lesson 4. 4. The following statements are true regarding tables in a RDBMS: (Choose Two) Mark for Review

(1) Points (Choose all correct answers) A table is a logical object only. They cannot be created in a RDBMS. A table holds all the data necessary about something in the real world, such as employees, invoices or customers. (*) Tables contain fields, which can be found at the intersection of a row and a column. (*) It is not possible to relate multiple tables within an RDBMS. Correct

1. The concatenation operator ... Mark for Review (1) Points All of the above (*) 2. The following is a valid SQL SELECT statement. True or False? SELECT first_name || ' ' || last_name alias AS Employee_Name FROM employees: Mark for Review False (*) 3. In order to eliminate duplicate rows use the ________ keyword Mark for Review (1) Points DISTINCT (*) 4. The structure of the table can be displayed with the _________ command: Mark for Review (1) Points Desc and Describe (*) 5. Which of the following is NOT BEING DONE in this SQL statement? SELECT first_name || ' ' || last_name "Name" FROM employees; Mark for Review

(1) Points Concatenating first name, middle name and last name (*) 1. Which query would give the following result? LAST_NAME FIRST_NAME DEPARTMENT_ID King Steven 90 SELECT last_name, first_name, department_id FROM employees WHERE last_name = 'King'; (*)

2. Which example would limit the number of rows returned? Mark for Review (1) Points SELECT title FROM d_songs WHERE type_code = 88; (*) 3. Which of the following are true? (Choose Two) Mark for Review (1) Points Date values are enclosed in single quotation marks (*) Date values are format-sensitive (*) 4. Which of the following statements will work? Mark for Review (1) Points SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT, salary*12 "ANNUAL SALARY" FROM employees WHERE last_name = 'King'; (*)

5. To restrict the rows returned from an SQL Query, you should use the _____ clause: Mark for Review (1) Points WHERE (*) 6. How can you write not equal to in the WHERE-clause Mark for Review

(1) Points != ^= <> All of the above (*) 7. Which of the following is true? Mark for Review (1) Points Date values are enclosed in single quotation marks (*)

8. Which of the following would be returned by this SELECT statement: SELECT last_name, salary FROM employees WHERE salary < 3500; Mark for Review (1) Points LAST_NAME SALARY Davies 3100 (*) 1. When using the "LIKE" operator, the % and _ symbols can be used to do a patternmatching, wild card search. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 16 Lesson 3. 2. Which of the following WHERE clauses would not select the number 10? Mark for Review (1) Points WHERE hours BETWEEN 10 AND 20 WHERE hours <= 10

WHERE hours <>10 (*) WHERE hours IN (8,9,10) Correct 3. Which of the following are examples of comparison operators used in the WHERE clause? Mark for Review (1) Points =, >, <, <=, >=, <> between ___ and ___ in (..,..,.. ) like is null all of the above (*) Correct 4. Which two statements would select salaries that are greater than or equal to 2500 and less than or equal to 3500? (Choose two) Mark for Review (1) Points (Choose all correct answers) WHERE salary >= 2500 AND salary <= 3500 (*) WHERE salary <=2500 AND salary >= 3500 WHERE salary BETWEEN 2500 AND 3500 (*) WHERE salary BETWEEN 3500 AND 2500 Correct 1. Which of the following is earliest in the rules of precedence? Mark for Review Arithmetic operator (*)

2. Which of the following statements best describes the rules of precedence when using SQL? Mark for Review (1) Points The order in which the expressions are evaluated and calculated (*) 3. Which symbol in the WHERE clause means "Not Equal To"? (Choose Two) Mark for Review (1) Points (Choose all correct answers) NOT IN (...) (*) <> (*) 4. Find the clause that will give the same results as: SELECT * FROM d_cds WHERE cd_id NOT IN(90, 91, 92); Mark for Review (1) Points WHERE cd_id != 90 and cd_id != 91 and cd_id != 92; (*) 5. Which of the following are examples of logical operators that might be used in a WHERE clause. (Choose Two) Mark for Review (1) Points (Choose all correct answers) AND, OR (*) NOT (*) 6. Which of the following would be returned by this SQL statement: SELECT First_name, last_name, department_id FROM employees WHERE department_id IN(50,80) AND first_name LIKE 'C%' OR last_name LIKE '%s%' Mark for Review (1) Points FIRST_NAME LAST_NAME DEPARTMENT_ID Shelly Higgins 110

FIRST_NAME LAST_NAME DEPARTMENT_ID Curtis Davies 50

FIRST_NAME LAST_NAME DEPARTMENT_ID Randall Matos 50

FIRST_NAME LAST_NAME DEPARTMENT_ID Michael Hartstein 20

All of the above (*) 7. What will be the results of the following selection? SELECT * FROM employees WHERE last_name NOT LIKE 'A%' AND last_name NOT LIKE 'B%' All last names that do not begin with A or B (*) 1. Which of the following is true of the ORDER BY clause: (Choose Two) Mark for Review (1) Points (Choose all correct answers) Must be the last clause of the SQL statement (*) Displays the fetched rows in no particular order Defaults to a descending order (DESC) Defaults to an ascending order (ASC) (*) Incorrect. Refer to Section 17 Lesson 2. 2. A column alias can be specified in an ORDER BY Clause. True or False? Mark for Review (1) Points

True (*) False Correct 3. What columns can be added to the following SELECT statement in its ORDER BY clause? (Choose Three) SELECT first_name, last_name, salary, hire_date FROM employees WHERE department_id = 50 ORDER BY ?????; Mark for Review (1) Points (Choose all correct answers) last_name, first_name (*) All columns in the EMPLOYEES table (*) The table name, EMPLOYEES, which would then automatically sort by all columns in the table Any column in the EMPLOYEES table, any expression in the SELECT list or any ALIAS in the SELECT list (*) All the columns in the database Incorrect. Refer to Section 17 Lesson 2. 4. What clause must you place in a SQL statement to have your results sorted from highest to lowest salary? Mark for Review (1) Points ORDER BY salary ASC ORDER BY salary DESC (*) ORDER salary BY DESC None, the database always sorts from highest to lowest on the salary column. Correct

1. The conversion function TO_CHAR is a single row function. True or False? Mark for Review (1) Points True (*) 2. The function COUNT is a single row function. True or False? Mark for Review False (*) 3. The following statement represents a multi-row function. True or False? SELECT UPPER(last_name) FROM employees; False (*) 4. Will the following statement return one row? SELECT MAX(salary), MIN(Salary), AVG(SALARY) FROM employees; Mark for Review Yes, it will return the highest salary, the lowest salary and the average salary from all employees (*) 5. The following statement represents a multi-row function. True or False? SELECT MAX(salary) FROM employees Mark for Review (1) Points True (*) Section 1 (Answer all questions in this section) 1. Which of the following are types of SQL functions? (Choose two correct answers.) Mark for Review (1) Points (Choose all correct answers) Multi-Row Functions (*) Column-Row Functions Single-Row Functions (*) Many-to-Many Functions

Incorrect. Refer to Section 1 Lesson 1. 2. Character functions accept character arguments and only return character values. True or False? Mark for Review (1) Points True False (*) Correct 3. Which query selects the first names of the DJ On Demand clients who have a first name beginning with "A"? Mark for Review (1) Points SELECT UPPER(first_name) FROM d_clients WHERE first_name LIKE %a% SELECT UPPER(first_name) FROM d_clients v WHERE first_name LIKE '%a%' SELECT UPPER(first_name) FROM d_clients WHERE first_name LIKE 'a%' SELECT UPPER(first_name) FROM d_clients WHERE LOWER(first_name) LIKE 'a%' (*)

Incorrect. Refer to Section 1 Lesson 1. 4. Which query would return a user password combining the ID of an employee and the first 4 characters of the last name? Mark for Review (1) Points SELECT CONCAT (employee_id, SUBSTR(last_name,4,1))

AS "User Passwords" FROM employees SELECT CONCAT (employee_id, INSTR(last_name,4,1)) AS "User Passwords" FROM employees SELECT CONCAT (employee_id, INSTR(last_name,1,4)) AS "User Passwords" FROM employees SELECT CONCAT (employee_id, SUBSTR(last_name,1,4)) AS "User Passwords" FROM employees (*)

Incorrect. Refer to Section 1 Lesson 1. 5. Identify the output from the following SQL statement: SELECT RPAD('SQL',6, '*') FROM DUAL; Mark for Review (1) Points ******SQL ***SQL SQL*** (*) SQL****** Incorrect. Refer to Section 1 Lesson 1. 6. Which character manipulation function always returns a numerical value? Mark for Review (1) Points TRIM LPAD

LENGTH (*) SUBSTR Correct 7. Which of the following SQL statements would correctly return a song title identified in the database as "All These Years"? Mark for Review (1) Points WHERE title CONTAINS 'Years'; WHERE title LIKE LOWER('all these years'); WHERE title IN('All','These','Years'); WHERE title LIKE INITCAP('%all these years'); (*) Incorrect. Refer to Section 1 Lesson 1. 8. What does the following SQL SELECT statement return? SELECT UPPER( SUBSTR('Database Programming', INSTR('Database Programming','P'),20)) FROM dual; Mark for Review (1) Points Programming PROGRAMMING (*) Database DATABASE Incorrect. Refer to Section 1 Lesson 1 The answer to the following script is 456. True or False? SELECT TRUNC(ROUND(456.98)) FROM dual Mark for Review (1) Points True

False (*) Incorrect. Refer to Section 1 Lesson 2. 2. ROUND and TRUNC functions can be used with which of the following Datatypes? Mark for Review (1) Points Dates and numbers (*) Dates and characters Numbers and characters None of the above Correct 3. Which number function may be used to determine if a value is odd or even? Mark for Review (1) Points MOD (*) TRUNC ROUND BINARY Incorrect. Refer to Section 1 Lesson 2. 4. What is the result of the following SQL Statement: SELECT ROUND(45.923,-1) FROM DUAL; Mark for Review (1) Points 46 45.9 50 (*) None of the above

Incorrect. Refer to Section 1 Lesson 2 1. What is the result of the following query? SELECT ADD_YEARS ('11-JAN-94',6) FROM dual; Mark for Review (1) Points This in not a valid SQL statement. (*) 7/11/1995 1/11/2000 7/11/2000 Incorrect. Refer to Section 1 Lesson 3. 2. If hire_date has a value of '03-July-03', then what is the output from this code SELECT ROUND(hire_date, 'Year') FROM employees; Mark for Review (1) Points 01-JAN-04 (*) 01-JAN-03 01-JUL-03 01-AUG-03 Incorrect. Refer to Section 1 Lesson 3. 3. What function would you use to return the highest date in a month? Mark for Review (1) Points FINAL_DAY END_DAY HIGHEST_DAY LAST_DAY (*) 1. The following script will run successfully. True or False? SELECT TO_CHAR(TO_DATE("25-DEC-04" ,'dd-MON-yy'))

FROM dual Mark for Review (1) Points True False (*) Incorrect. Refer to Section 2 Lesson 1. 2. Which statement is true about SQL functions? Mark for Review (1) Points Functions can convert values or text to another data type. Functions can round a number to a specified decimal place. Functions can convert upper case characters to lower case characters. a, b and c are true. (*) None of the above statements are true. Incorrect. Refer to Section 2 Lesson 1. 3. Sysdate is 12-MAY-2004. You need to store the following date: 7-DEC-89 Which statement about the date format for this value is true? Mark for Review (1) Points Both the YY and RR date formats will interpret the year as 1989 Both the YY and RR date formats will interpret the year as 2089 The RR date format will interpret the year as 1989, and the YY date format will interpret the year as 2089 (*) The RR date format will interpret the year as 2089, and the YY date format will interpret the year as 1989 Incorrect. Refer to Section 2 Lesson 1. 4. A table has the following definition: EMPLOYEES( EMPLOYEE_ID NUMBER(6) NOT NULL,

NAME VARCHAR2(10) NOT NULL, MANAGER_ID VARCHAR2(6)) and contains the following rows: (1001, 'Bob Bevan', '200') (200, 'Natacha Hansen', null) Will the following query work? SELECT * FROM employees WHERE employee_id = manager_id; Mark for Review (1) Points No, because the WHERE-clause will not find any matching data No, because the datatypes of ID and MANAGER are different. Yes, Oracle will perform implicit datatype conversion. (*) No. You will have to re-write the statement and perform explicit datatype conversion. Correct 5. Which statement will return the salary of e.g. 6000 from the Employees table in the following format $6000.00? Mark for Review (1) Points SELECT TO_CHAR(salary, '$99999.00') SALARY FROM employees (*) SELECT TO_CHAR(salary, '99999.00') SALARY FROM employees SELECT TO_CHAR(salary, '$99999') SALARY FROM employees SELECT TO_CHAR(sal, '$99999.00') SALARY FROM employees

Correct

6. You need to display the HIRE_DATE values in this format: 25th of July 2002. Which SELECT statement would you use? Mark for Review (1) Points SELECT enroll_date(hire_date, 'DDspth "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'ddth "of" Month YYYY') FROM employees; (*) SELECT TO_CHAR(hire_date, 'DDTH "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'DDspth 'of' Month RRRR') FROM employees;

Incorrect. Refer to Section 2 Lesson 1. Incorrect. Refer to Section 1 Lesson 3. 4. Which query would return a whole number if the sysdate is 26-MAY-04? Mark for Review (1) Points SELECT TRUNC(MONTHS_BETWEEN(SYSDATE,'19-MAR-79') /12) AS YEARS FROM DUAL; (*) SELECT TRUNC(YEARS_BETWEEN(SYSDATE,'19-MAR-79') /12) AS YEARS FROM DUAL; SELECT MONTHS_BETWEEN(SYSDATE,'19-MAR-79') /12 AS YEARS FROM DUAL; None of the above

Incorrect. Refer to Section 1 Lesson 3. 5. Round and Trunc can be used on Date datatypes. True or False? Mark for Review (1) Points True (*) False Correct 6. What is the result of the following query? SELECT ADD_MONTHS ('11-JAN-94',6) FROM dual; Mark for Review (1) Points 17-JAN-1994 11-JAN-1995 11-JUL-1994 (*) 17-JUL-1994 1. Sysdate is 12-MAY-2004. You need to store the following date: 7-DEC-89 Which statement about the date format for this value is true? Mark for Review (1) Points Both the YY and RR date formats will interpret the year as 1989 Both the YY and RR date formats will interpret the year as 2089 The RR date format will interpret the year as 1989, and the YY date format will interpret the year as 2089 The RR date format will interpret the year as 2089, and the YY date format will interpret the year as 1989 2. You need to display the HIRE_DATE values in this format: 25th of July 2002. Which SELECT statement would you use? Mark for Review (1) Points

SELECT enroll_date(hire_date, 'DDspth "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'ddth "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'DDTH "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'DDspth 'of' Month RRRR') FROM employees;

3. Which statement will return the salary of e.g. 6000 from the Employees table in the following format $6000.00? Mark for Review (1) Points SELECT TO_CHAR(salary, '$99999.00') SALARY FROM employees SELECT TO_CHAR(salary, '99999.00') SALARY FROM employees SELECT TO_CHAR(salary, '$99999') SALARY FROM employees SELECT TO_CHAR(sal, '$99999.00') SALARY FROM employees

4. The following script will run successfully. True or False? SELECT TO_CHAR(TO_DATE("25-DEC-04" ,'dd-MON-yy')) FROM dual Mark for Review (1) Points True False 5. A table has the following definition: EMPLOYEES( EMPLOYEE_ID NUMBER(6) NOT NULL,

NAME VARCHAR2(10) NOT NULL, MANAGER_ID VARCHAR2(6)) and contains the following rows: (1001, 'Bob Bevan', '200') (200, 'Natacha Hansen', null) Will the following query work? SELECT * FROM employees WHERE employee_id = manager_id; Mark for Review (1) Points No, because the WHERE-clause will not find any matching data No, because the datatypes of ID and MANAGER are different. Yes, Oracle will perform implicit datatype conversion. No. You will have to re-write the statement and perform explicit datatype conversion. 6. Which statement is true about SQL functions? Mark for Review (1) Points Functions can convert values or text to another data type. Functions can round a number to a specified decimal place. Functions can convert upper case characters to lower case characters. a, b and c are true. None of the above statements are true. 1. The following statement returns 0 (zero). True or False? SELECT 121/NULL FROM dual; Mark for Review (1) Points True False (*) Incorrect. Refer to Section 2 Lesson 2.

2. Consider the following data in Employees table: (last_name, commission_pct, manager_id) DATA: King,null,null Kochhar, null,100 Vargas, null, 124 Zlotkey,.2, 100 What is the result of the following statement: SELECT last_name, COALESCE(commission_pct, manager_id, -1) comm FROM employees ; Mark for Review (1) Points Statement will fail King, -1 Kochhar, 100 Vargas, 124 Zlotkey, .2 (*) King, -1 Kochhar, 100 Vargas, 124 Zlotkey, 100 King, null Kochhar, 100 Vargas, 124 Zlotkey, .2

Incorrect. Refer to Section 2 Lesson 2. 3. If quantity is a number datatype, what is the result of this statement? SELECT NVL(200/quantity, 'zero') FROM inventory; Mark for Review (1) Points zero ZERO The statement fails (*)

Null Incorrect. Refer to Section 2 Lesson 2. 4. Which function compares two expressions? Mark for Review (1) Points NVL NULLIF (*) NVL2 NULL Correct 5. With the following data in Employees (last_name, commission_pct, manager_id) what is the result of the following statement? DATA: King,null,null Kochhar, null,100 Vargas, null, 124 Zlotkey,.2, 100 SELECT last_name, NVL2(commission_pct, manager_id, -1) comm FROM employees ; Mark for Review (1) Points King, -1 Kochhar, -1 Vargas, -1 Zlotkey, .2 Statement will fail. King, -1 Kochhar, 100 Vargas, 124 Zlotkey, .2 King, -1 Kochhar, -1 Vargas, -1

Zlotkey, 100 (*) . Which statement will return a listing of last names, salaries and a rating of 'Low', 'Medium', 'Good' or 'Excellent' depending on the salary value? Mark for Review (1) Points SELECT last_name,salary, (CASE WHEN salary<5000 THEN 'Low' WHEN salary<10000 THEN 'Medium' WHEN salary<20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; (*) SELECT last_name,salary, (CASE WHEN salary<5000 THEN 'Low' WHEN sal <10000 THEN 'Medium' WHEN sal <20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; SELECT last_name,sal, (CASE WHEN sal<5000 THEN 'Low' WHEN sal<10000 THEN 'Medium' WHEN sal<20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; SELECT last_name,salary, (RATING WHEN salary<5000 THEN 'Low' WHEN salary<10000 THEN 'Medium' WHEN salary<20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees;

Correct

2. For the given data from Employees (last_name, manager_id) what is the result of the following statement: DATA:( King, null Kochhar, 100 De Haan, 100 Hunold, 102 Ernst, 103) SELECT last_name, DECODE(manager_id, 100, 'King', 'A N Other') "Works For?" FROM employees Mark for Review (1) Points King, Null Kochhar, King De Haan, King Hunold, A N Other Ernst, A N Other King, A N Other Kochhar, King De Haan, King Hunold, A N Other Ernst, A N Other (*) Invalid statement. King, A N Other Kochhar, King De Haan, King Hunold, Kochhar Ernst, De Haan

Incorrect. Refer to Section 2 Lesson 3. 3. CASE and DECODE evaluate expressions in a similar way to IF-THEN-ELSE logic. However, DECODE is specific to Oracle syntax. True or False? Mark for Review (1) Points True (*) False

Correct 4. Which of the following is a conditional expression used in SQL? Mark for Review (1) Points CASE (*) DESCRIBE WHERE NULLIF Incorrect. Refer to Section 2 Lesson 3 . The join column must be included in the select statement when you use the NATURAL JOIN clause. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 3 Lesson 1. 2. The ___________ join is the ANSI-standard syntax used to generate a Cartesian product. Mark for Review (1) Points NATURAL ALL FULL CROSS (*) Incorrect. Refer to Section 3 Lesson 1. 3. What happens when you create a Cartesian product? Mark for Review (1) Points All rows from one table are joined to all rows of another table (*)

No rows are returned as you entered wrong join-criteria The table is joined to itself, one column to the next column, exhausting all possibilities All rows that do not match in the WHERE clause are displayed Incorrect. Refer to Section 3 Lesson 1. 4. A NATURAL JOIN is based on: Mark for Review (1) Points Columns with the same name and datatype (*) Columns with the same name Columns with the same datatype and width Tables with the same structure Incorrect. Refer to Section 3 Lesson 1. Table aliases MUST be used with columns referenced in the JOIN USING clause. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 3 Lesson 2. 2. You can do nonequi-joins with ANSI-Syntax. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 3 Lesson 2. 3. The keywords JOIN _____________ should be used to join tables with the same column names but different datatypes. Mark for Review (1) Points

NATURAL ON ON WHEN USING (*) Incorrect. Refer to Section 3 Lesson 2. 4. The following is a valid SQL statement. SELECT e.employee_id, e.last_name, d.location_id, department_id FROM employees e JOIN departments d USING (department_id) ; True or False? Mark for Review (1) Points True (*) False Correct 5. The primary advantage of using JOIN ON is: Mark for Review (1) Points The join happens automatically based on matching column names and data types It will display rows that do not meet the join condition It easily produces a Cartesian product between the tables in the statement It permits columns that don't have matching data types to be joined It permits columns with different names to be joined (*) Incorrect. Refer to Section 3 Lesson 2. 1. EMPLOYEES Table: Name Null? Type EMPLOYEE_ID NOT NULL NUMBER(6)

FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) DEPARTMENT_ID NUMBER (4) DEPARTMENTS Table: Name Null? Type DEPARTMENT_ID NOT NULL NUMBER 4 DEPARTMENT_NAME NOT NULL VARCHAR2(30) MANAGER_ID NUMBER (6) A query is needed to display each department and its manager name from the above tables. However, not all departments have a manager but we want departments returned in all cases. Which of the following SQL: 1999 syntax scripts will accomplish the task? Mark for Review (1) Points SELECT d.department_id, e.first_name, e.last_name FROM employees e RIGHT OUTER JOIN departments d ON (e.employee_id = d.manager_id); (*) SELECT d.department_id, e.first_name, e.last_name FROM employees e LEFT OUTER JOIN departments d WHERE (e.department_id = d.department_id); SELECT d.department_id, e.first_name, e.last_name FROM employees e FULL OUTER JOIN departments d ON (e.employee_id = d.manager_id); SELECT d.department_id, e.first_name, e.last_name FROM employees e, departments d WHERE e.employee_id RIGHT OUTER JOIN d.manager_id;

Incorrect. Refer to Section 3 Lesson 3. 2. If you select rows from two tables (employees and departments) using an outer join, what will you get? Use the code below to arrive at your answer: SELECT e.last_name, e.department_id, d.department_name FROM employees e

LEFT OUTER JOIN departments d ON (e.department_id = d.department_id); Mark for Review (1) Points All employees that do not have a department_id assigned to them All employees including those that do not have a departement_id assigned to them (*) No employees as the statement will fail None of the above Correct 3. For which of the following tables will all the values be retrieved even if there is no match in the other? SELECT e.last_name, e.department_id, d.department_name FROM employees e LEFT OUTER JOIN departments d ON (e.department_id = d.department_id); Mark for Review (1) Points employees (*) department Both Neither. the LEFT OUTER JOIN limits the value to the matching department id's. Incorrect. Refer to Section 3 Lesson 3. 4. Given the following descriptions of the employees and jobs tables, which of the following scripts will display each employee's possible minimum and maximum salaries based on their job title? EMPLOYEES Table: Name Null? Type EMPLOYEE_ID NOT NULL NUMBER (6) FIRST_NAME VARCHAR2 (20) LAST_NAME NOT NULL VARCHAR2 (25) EMAIL NOT NULL VARCHAR2 (25) PHONE_NUMBER VARCHAR2 (20) HIRE_DATE NOT NULL DATE

JOB_ID NOT NULL VARCHAR2 (10) SALARY NUMBER (8,2) COMMISSION_PCT NUMBER (2,2) MANAGER_ID NUMBER (6) DEPARTMENT_ID NUMBER (4) JOBS Table: Name Null? Type JOB_ID NOT NULL VARCHAR2 (10) JOB_TITLE NOT NULL VARCHAR2 (35) MIN_SALARY NUMBER (6) MAX_SALARY NUMBER (6) Mark for Review (1) Points SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e NATURAL JOIN jobs j USING (job_id); SELECT first_name, last_name, job_id, min_salary, max_salary FROM employees NATURAL JOIN jobs; (*) SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e NATURAL JOIN jobs j; SELECT first_name, last_name, job_id, min_salary, max_salary FROM employees e FULL JOIN jobs j (job_id); SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e NATURAL JOIN jobs j ON (e.job_title = j.job_title);

Correct 5. The following statement is an example of what kind of join? SELECT car.vehicle_id, driver.name

FROM car LEFT OUTER JOIN driver ON (driver_id) ; Mark for Review (1) Points Inner Join Outer Join (*) Equijoin Optimal Join Correct 6. What is another name for a simple join or an inner join? Mark for Review (1) Points Nonequijoin Equijoin (*) Self Join Outer Join Incorrect. Refer to Section 3 Lesson 3. 7. Which syntax would be used to retrieve all rows in both the EMPLOYEES and DEPARTMENTS tables, even when there is no match? Mark for Review (1) Points FULL OUTER JOIN (*) LEFT OUTER JOIN AND RIGHT OUTER JOIN FULL INNER JOIN Use any equijoin syntax Incorrect. Refer to Section 3 Lesson 3.

Which of the following database design concepts do you need in your tables to write Hierarchical queries? Mark for Review (1) Points Non-Transferability Recursive Relationship (*) Supertype Arc Correct 2. Which of the following database design concepts is implemented with a self join? Mark for Review (1) Points Non-Transferability Recursive Relationship (*) Supertype Arc Incorrect. Refer to Section 3 Lesson 4. 3. Which SELECT statement implements a self join? Mark for Review (1) Points SELECT e.employee_id, m.manager_id FROM employees e NATURAL JOIN employees m; SELECT e.employee_id, m.manager_id FROM employees e, employees m WHERE m.employee_id = e.manager_id; (*) SELECT e.employee_id, m.manager_id FROM employees e, managers m WHERE e.employee_id = m.manager_id;

SELECT e.employee_id, m.manager_id FROM employees e, departments m WHERE e.employee_id = m.manager_id;

Correct 4. Hierarchical queries MUST use the LEVEL pseudo column. True or False? Mark for Review (1) Points True False (*) Correct 5. Which select statement will return the last name and hire date of an employee and his/ her manager for employees that started in the company before their managers? Mark for Review (1) Points SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees m WHERE w.manager_id = m.employee_id AND w.hire_date < m.hire_date (*) SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees m WHERE w.manager_id = m.employee_id AND w.hire_date > m.hire_date SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees w WHERE w.manager_id = w.employee_id AND w.hire_date < w.hire_date SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees m WHERE w.manager_id != m.employee_id AND w.hire_date < m.hire_date

Incorrect. Refer to Section 3 Lesson 4. 6. Hierarchical queries can walk both Top-Down and Bottom-Up. True or False? Mark for Review (1) Points True (*) False Correct 1. What two group functions can be used with any datatype? Mark for Review (1) Points STDDEV, VARIANCE SUM, AVG COUNT, SUM MIN, MAX (*) Incorrect. Refer to Section 4 Lesson 2. 2. Given the following data in the employees table (employee_id, salary, commission_pct) DATA: (143, 2600, null 144, 2500, null 149, 10500, .2 174, 11000, .3 176, 8600, .2 178, 7000, .15) What is the result of the following statement: SELECT AVG(commission_pct) FROM employees WHERE employee_id IN( 143,144,149,174,176,178) Mark for Review (1) Points 1.2125 This statement is invalid

0.2125 (*) 0.0425 Incorrect. Refer to Section 4 Lesson 2. 3. Given the following data in the employees table (employee_id, salary, commission_pct) DATA: (143, 2600, null 144, 2500, null 149, 10500, .2 174, 11000, .3 176, 8600, .2 178, 7000, .15) What is the result of the following statement: SELECT SUM(commission_pct), COUNT(commission_pct) FROM employees WHERE employee_id IN( 143,144,149,174,176,178) Mark for Review (1) Points SUM = .85 and COUNT = 6 SUM = 1.85 and COUNT = 6 SUM = .85 and COUNT = 4 (*) SUM = 1.85 and COUNT = 4 Incorrect. Refer to Section 4 Lesson 2. 4. The following statement will work because it uses the same column with different GROUP functions: SELECT AVG(salary), MAX(salary), MIN(salary), SUM(salary) FROM employees; True or False? Mark for Review (1) Points True (*) False Correct

5. You can use GROUP functions in all clauses of a SELECT statement. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 4 Lesson 2. What would the following SQL statement return? SELECT COUNT(DISTINCT salary) FROM employees; Mark for Review (1) Points A listing of all unique salaries in the employees table The total amount of salaries in the employees table The total number of rows in the employees table The number of unique salaries in the employees table (*) Correct 2. Using your existing knowledge of the employees table, would the following two statements produce the same result? SELECT COUNT(*) FROM employees; SELECT COUNT(commission_pct) FROM employees; Mark for Review (1) Points The first statement is invalid Yes No (*) The second statement is invalid

Incorrect. Refer to Section 4 Lesson 3. 3. To include null values in the calculations of a group function, you must: Mark for Review (1) Points Precede the group function name with NULL Count the number of null values in that column using COUNT Convert the null to a value using the NVL( ) function (*) Group functions can never use null values Correct 4. What would the following SQL statement return? SELECT COUNT(first_name) FROM employees; Mark for Review (1) Points A listing of all non-null first names in the employees table The total number of non-null first names in the employees table (*) The total number of rows in the employees table A listing of all unique first names in the employees table Incorrect. Refer to Section 4 Lesson 3. Which of the following SQL statements could display the number of people with the same last name: Mark for Review (1) Points SELECT first_name, last_name, COUNT(employee_id) FROM EMPLOYEES GROUP BY last_name; SELECT employee_id, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name;

SELECT last_name, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name; (*) SELECT employee_id, DISTINCT(last_name) FROM EMPLOYEES GROUP BY last_name;

Incorrect. Refer to Section 5 Lesson 1. 2. Is the following statement correct: SELECT first_name, last_name, salary, department_id, COUNT(employee_id) FROM employees WHERE department_id = 50 GROUP BY last_name, first_name, department_id; Mark for Review (1) Points Yes No, beause you cannot have a WHERE-clause when you use group functions. No, because the statement is missing salary in the GROUP BY clause (*) Yes, because Oracle will correct any mistakes in the statement itself Incorrect. Refer to Section 5 Lesson 1. 3. Is the following statement correct? SELECT department_id, AVG(salary) FROM employees; Mark for Review (1) Points No, because a GROUP BY department_id clause is needed (*) Yes, because the SELECT clause can contain both individual columns and group functions No, because the AVG function cannot be used on the salary column Yes

Incorrect. Refer to Section 5 Lesson 1. 4. Read the following SELECT statement. Choose the column or columns that must be included in the GROUP BY clause. SELECT COUNT(last_name), grade, gender FROM STUDENTS GROUP_BY ?????; Mark for Review (1) Points last_name last_name, grade grade, gender (*) last_name, gender Correct 5. How would you alter the following query to list only employees where there existed more than one per last_name with the same last name: SELECT last_name, COUNT(employee_id) FROM EMPLOYEES GROUP BY last_name; Mark for Review (1) Points SELECT last_name, COUNT(employee_id) FROM EMPLOYEES WHERE COUNT(*) > 1 GROUP BY last_name SELECT last_name, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name HAVING COUNT(last_name) > 1; (*) SELECT last_name, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name EXISTS COUNT(last_name) > 1;

SELECT employee_id, DISTINCT(last_name) FROM EMPLOYEES GROUP BY last_name HAVING last_name > 1;

Correct If you want to include subtotals and grant totals for all columns mentioned in a GROUP BY clause you should use which of the following extensions to the GROUP BY clause? Mark for Review (1) Points ROLLUP CUBE (*) GROUP BY ALL COLUMNS HAVING Incorrect. Refer to Section 5 Lesson 2. 2. Examine the following statement: SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY GROUPING SETS((department_id, manager_id), (department_id, job_id)) What data will this query generate? Mark for Review (1) Points Sum of salaries for (department_id, job_id) and (department_id, manager_id) (*) Sum of salaries for (department_id, job_id, manager_id) Subtotals for (job_id, manager_id) The statement will fail. Incorrect. Refer to Section 5 Lesson 2.

3. Examine the following statement: SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY ROLLUP(department_id, manager_id) What extra data will this query generate? Mark for Review (1) Points Subtotals for department_id, and grand totals for salary. Subtotals for department_id, job_id and grand totals for salary. Subtotals for department_id, job_id, manager_id and grand totals for salary. The statement will fail. (*) Incorrect. Refer to Section 5 Lesson 2. 4. Examine the following statement: SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY GROUPING SETS(.......); Select the correct GROUP BY GROUPING SETS clause from the following list: Mark for Review (1) Points GROUP BY GROUPING SETS (department_id, AVG(salary)), (department_id, job_id), (department_id, manager_id) GROUP BY GROUPING SETS (department_id, salary), (department_id, job_id), (department_id, manager_id) GROUP BY GROUPING SETS ((department_id, manager_id), (department_id, job_id), (manager_id, job_id)) (*) GROUP BY GROUPING SETS ((department_id, manager_id), (department_id, SUM(salary), (manager_id, job_id)) Incorrect. Refer to Section 5 Lesson 2. Which ones of the following are correct SET operators? (choose two) Mark for Review (1) Points (Choose all correct answers)

UNION, MINUS (*) UNION ALL, PLUS ALL UNION ALL, INTERSECTION (*) MINUS, PLUS Incorrect. Refer to Section 5 Lesson 3. 2. INTERSECT will give you rows found in both queries? (True or False) Mark for Review (1) Points True (*) False Correct 3. MINUS will give you rows from the first query not present in the second query? (True or False) Mark for Review (1) Points True (*) False Correct 4. The difference between UNION and UNION ALL is Mark for Review (1) Points There is no difference between, you get exactly the same result. UNION will remove duplicates, UNION ALL returns all rows from all queries (*) UNION ALL is like a NATURAL JOIN UNION is a synomym for UNION ALL Incorrect. Refer to Section 5 Lesson 3.

Subqueries can only be placed in the WHERE clause. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 6 Lesson 1. 2. Examine the following statement: SELECT last_name, salary FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE employee_id = 103) AND job_id = (SELECT job_id FROM employees WHERE employee_id = 103) Is this a pair-wise or non-pair-wise Subquery? Mark for Review (1) Points This is an example of a non-pair-wise subquery. (*) This is an example of a pair-wise subquery. Neither. This statement is illegal, and will not run. Incorrect. Refer to Section 6 Lesson 1. 3. What will the following statement return: SELECT last_name, salary FROM employees WHERE salary < (SELECT salary FROM employees WHERE employee_id = 103) Mark for Review (1) Points A list of last_names and salaries of employees that makes more than employee 103 A list of last_names and salaries of employees that makes less than employee 103 (*) A list of first_names and salaries of employees making less than employee 103 Nothing. It is an invalid statement.

Correct 4. Which of the following statements is a true guideline for using subqueries? Mark for Review (1) Points Do not enclose the subquery in parentheses. Place the subquery on the left side of the comparison condition. The outer and inner queries can reference more than one table. They can get data from different tables. (*) Only one WHERE clause can be used for a SELECT statement, and if specified, it must be the outer query. Incorrect. Refer to Section 6 Lesson 1. 5. What will the following statement return: SELECT employee_id, last_name FROM employees WHERE salary = (SELECT MIN(salary) FROM employees GROUP BY department_id); Mark for Review (1) Points Nothing. It is an invalid statement. (*) A list of last_names and salaries of employees A list of first_names and salaries of employees in Department 50 A list of last_names and salaries of employees grouped by department_id. Incorrect. Refer to Section 6 Lesson 1. 6. What will the following statement return: SELECT last_name, salary FROM employees WHERE (department_id, job_id) = (SELECT department_id, job_id FROM employees

WHERE employee_id = 103) Mark for Review (1) Points A list of last_names and salaries of employees that works in the same department and has the same job_id as that of employee 103. (*) A list of last_names or salaries of employees that works in the same department and has the same job_id as that of employee 103. A list of last_names and salaries of employees that works in the same department or has the same job_id as that of employee 103. Nothing. It is an invalid statement. Examine the following statement: SELECT last_name, salary FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE employee_id = 103) AND job_id = (SELECT job_id FROM employees WHERE employee_id = 103) Is this a pair-wise or non-pair-wise Subquery? Mark for Review (1) Points This is an example of a non-pair-wise subquery. (*) This is an example of a pair-wise subquery. Neither. This statement is illegal, and will not run. Correct 2. Which of the following statements is a true guideline for using subqueries? Mark for Review (1) Points Do not enclose the subquery in parentheses. Place the subquery on the left side of the comparison condition. The outer and inner queries can reference more than one table. They can get data from different tables. (*)

Only one WHERE clause can be used for a SELECT statement, and if specified, it must be the outer query. Correct 3. Subqueries can only be placed in the WHERE clause. True or False? Mark for Review (1) Points True False (*) Correct 4. What will the following statement return: SELECT last_name, salary FROM employees WHERE (department_id, job_id) = (SELECT department_id, job_id FROM employees WHERE employee_id = 103) Mark for Review (1) Points A list of last_names and salaries of employees that works in the same department and has the same job_id as that of employee 103. (*) A list of last_names or salaries of employees that works in the same department and has the same job_id as that of employee 103. A list of last_names and salaries of employees that works in the same department or has the same job_id as that of employee 103. Nothing. It is an invalid statement. Incorrect. Refer to Section 6 Lesson 1. 5. What will the following statement return: SELECT last_name, salary FROM employees WHERE salary < (SELECT salary FROM employees WHERE employee_id = 103) Mark for Review (1) Points

A list of last_names and salaries of employees that makes more than employee 103 A list of last_names and salaries of employees that makes less than employee 103 (*) A list of first_names and salaries of employees making less than employee 103 Nothing. It is an invalid statement. Incorrect. Refer to Section 6 Lesson 1. 6. What will the following statement return: SELECT employee_id, last_name FROM employees WHERE salary = (SELECT MIN(salary) FROM employees GROUP BY department_id); Mark for Review (1) Points Nothing. It is an invalid statement. (*) A list of last_names and salaries of employees A list of first_names and salaries of employees in Department 50 A list of last_names and salaries of employees grouped by department_id. Correct . Subqueries are limited to four per SQL transaction. True or False? Mark for Review (1) Points True False (*) Correct 2. Single row subqueries may not include this operator: Mark for Review (1) Points ALL (*)

= <> > Correct 3. The result of this statement will be: SELECT last_name, job_id, salary, department_id FROM employees WHERE job_id = (SELECT job_id FROM employees WHERE employee_id = 141) AND department_id = (SELECT department_id FROM departments WHERE location_id =1500) Mark for Review (1) Points All employees from Location 1500 will be displayed An error since you can't get data from two tables in the same subquery All employees with the department id of 141 Only the employees whose job id matches employee 141 and who work in location 1500 (*) Incorrect. Refer to Section 6 Lesson 2. 4. If the subquery returns no rows will the outer query return any values? Mark for Review (1) Points No, because you are not allowed to not return any rows from a subquery Yes. It will just run and ignore the subquery No, because the subquery will be treated like a null value. (*) Yes, Oracle will find the nearest value and rewrite your statement implicitly when you run it

Incorrect. Refer to Section 6 Lesson 2. 5. In a non-correlated subquery, the outer query always executes prior to the inner query's execution. True or False? Mark for Review (1) Points True False (*) Correct Group functions can be used in subqueries even though they may return many rows. True or False? Mark for Review (1) Points True (*) False Correct 2. In a subquery the ALL operator compares a value to every value returned by the inner query. True or False? Mark for Review (1) Points True (*) False Correct 3. When a multiple-row subquery uses the NOT IN (<>ALL) operator, if one of the values returned by the inner query is a null value, the entire query returns: Mark for Review (1) Points A list of Nulls All rows that were selected by the inner query including the null value(s) All rows, minus the null value(s), that were selected by the inner query No rows returned (*)

Incorrect. Refer to Section 6 Lesson 3. 4. The SQL multiple-row subquery extends the capability of the single-row syntax through the use of what three comparison operators? Mark for Review (1) Points IN, ANY and EQUAL IN, ANY and ALL (*) IN, ANY and EVERY IN, ALL and EVERY Correct 5. Group functions, such as HAVING and GROUP BY can be used in multiple-row subqueries. True or False? Mark for Review (1) Points True (*) False Correct 6. Multiple-row subqueries must have NOT, IN or ANY in the WHERE clause of the inner query. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 6 Lesson 3. 7. The salary column of the f_staffs table contains the following values: 4000 5050 6000 11000

23000 Which of the following statements will return the last_name and first_name of those employees who earn more than 5000. Mark for Review (1) Points SELECT last_name, first_name FROM f_staffs WHERE salary = (SELECT salary FROM f_staffs WHERE salary > 5000); SELECT last_name, first_name FROM f_staffs WHERE salary = (SELECT salary FROM f_staffs WHERE salary < 5000); SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT salary FROM f_staffs WHERE salary > 5000); (*) SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT last_name, first_name FROM f_staffs WHERE salary <5000);

Correct 8. There can be more than one subquery returning information to the outer query. True or False? Mark for Review (1) Points True (*) False Correct In a correlated subquery the outer and inner query are joined on one or more columns? (True or False) Mark for Review (1) Points True (*) False

Correct 2. The WITH-clause is a way of creating extra tables in the database? (True or False) Mark for Review (1) Points True False (*) Correct 3. Table aliases must be used when you are writing correlated subqueries? (True or false) Mark for Review (1) Points True (*) False Incorrect. Refer to Section 6 Lesson 4. 4. Correlated Subqueries must work on the same tables in both the inner and outer query? (True or False) Mark for Review (1) Points True False (*) Incorrect. Refer to Section 6 Lesson 4. . It is possible to create a table by using the CREATE TABLE command in conjunction with a subquery. True or False? Mark for Review (1) Points True (*) False Correct

2. When creating a new table, which of the following naming rules apply. (Choose three) Mark for Review (1) Points (Choose all correct answers) Must begin with a letter (*) Can have the same name as another object owned by the same user Must contain ONLY A - Z, a - z, 0 - 9, _ (underscore), $, and # (*) Must be an Oracle reserved word Must be between 1 to 30 characters long (*) Correct 3. CREATE TABLE student_table (id NUMBER(6), lname VARCHAR(20), fname VARCHAR(20), lunch_num NUMBER(4)); Which of the following statements best describes the above SQL statement: Mark for Review (1) Points Creates a table named student_table with four columns: lname, fname, lunch, num Creates a table named student with four columns: id, lname, fname, lunch_num Creates a table named student_table with four columns: id, lname, fname, lunch_num (*) Creates a table named student_table with four columns: lname, fname, lunch, num Correct 4. Once they are created, external tables are accessed with normal SQL statements? (True or False) Mark for Review (1) Points True (*) False

Correct 5. I have a table named School_Friends in my schema. You want to build a table in your schema named School_Friends. This is ______________, because ____________________________________. Mark for Review (1) Points possible; my schema is separate from yours, and it is okay for us to have like-named tables in our separate schemas. (*) possible; our data will merge into one table, and we can more easily access our mutual friends information. impossible; no matter what, there can never be two tables with the same name, even if they are in separate schemas. impossible; School_Friends is a reserved term in SQL. Correct 6. CREATE TABLE bioclass (hire_date DATE DEFAULT SYSDATE, first_name varchar2(15), last_name varchar2(15)); The above CREATE TABLE statement is acceptable, and will create a Table named bioclass that contains a hire_date, first_name and last_name column. True or False? Mark for Review (1) Points True (*) False Correct 7. Examine this CREATE TABLE statement: CREATE TABLE emp_load (employee_number CHAR(5), employee_dob CHAR(20), employee_last_name CHAR(20), employee_first_name CHAR(15), employee_middle_name CHAR(15), employee_hire_date DATE)

ORGANIZATION EXTERNAL TYPE ORACLE_LOADER DEFAULT DIRECTORY def_dir1 ACCESS PARAMETERS (RECORDS DELIMITED BY NEWLINE FIELDS (employee_number CHAR(2), employee_dob CHAR(20), employee_last_name CHAR(18), employee_first_name CHAR(11), employee_middle_name CHAR(11), employee_hire_date CHAR(10) date_format DATE mask "mm/dd/yyyy")) LOCATION ('info.dat')); What kind of table is created here? Mark for Review (1) Points An external table with the data stored in a file outside the database. (*) A View. An external table with the data stored in a file inside the database. None. This is in invalid statement. Correct 8. DCL, which is the acronym for Data Control Language, allows: Mark for Review (1) Points The ALTER command to be used. A Database Administrator the ability to grant privileges to users. (*) The TRUNCATE command to be used. The CONROL TRANSACTION statement can be used. Correct 9. Given this employee table: (employee_id NUMBER(10) NOT NULL, first_name VARCHAR2(25) NOT NULL, last_name VARCHAR2(30) NOT NULL, hire_date DATE DEFAULT sysdate)

What will be the result in the hire_date column following this insert statement: INSERT INTO employees VALUES (10, 'Natacha', 'Hansen', DEFAULT); Mark for Review (1) Points Statement will fail, as you must list the columns into which you are inserting. Statement will work and the hire_date column will have the value of the date when the statement was run. (*) The character string SYSDATE. The column for hire_date will be null. Correct The BLOB datatype can max hold 4 gigabytes of data. True or False? Mark for Review (1) Points True (*) False Correct 2. To store large amounts of text you should simply create a series of VARCHAR2 columns in a table. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 8 Lesson 2. 3. Which of the following are valid Oracle datatypes? Mark for Review (1) Points DATE, BLOB, LOB, VARCHAR2 DATE, TIMESTAMP WITH LOCAL TIMEZONE, BLOB (*) TIMESTAMP, LOB, VARCHAR2, NUMBER

SYSDATE, TIMESTAMP, DATE, LOCAL TIMEZONE Correct 4. INTERVAL DAY TO SECOND stores a period of time in terms of days, hours, minutes, and seconds. True or False? Mark for Review (1) Points True (*) False Correct A column's data type can always be changed from NUMBER to VARCHAR2 but not from VARCHAR2 to NUMBER, provided the table is empty. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 8 Lesson 3. 2. The FLASHBACK QUERY statement can restore data back to a point in time before the last COMMIT? True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 8 Lesson 3. 3. You can use the ALTER TABLE statement to: Mark for Review (1) Points Add a new column Modify an existing column Drop a column

All of the above (*) Incorrect. Refer to Section 8 Lesson 3. 4. The following code creates a table named student_table with four columns: id, lname, fname, lunch_num CREATE TABLE student_table (id NUMBER(6), lname VARCHAR(20), fname VARCHAR(20), lunch_num NUMBER(4)); The lunch_num column in the above table has been marked as UNUSED. Which of the following is the best statement you can use if you wish to remove the UNUSED column from the student_table? Mark for Review (1) Points DROP column ALTER TABLE DELETE UNUSED COLUMNS ALTER TABLE DROP UNUSED COLUMNS (*) ALTER TABLE DELETE ALL COLUMNS Incorrect. Refer to Section 8 Lesson 3. 5. Comments can be added to a table by using the COMMENT ON TABLE statement. The comments being added are enclosed in: Mark for Review (1) Points Double quotes " " Single quotes ' ' (*) Parentheses ( ) Brackets { } Correct 6. To completely get rid of a table, its contents, its structure, AND release the storage space the keyword is: Mark for Review

(1) Points DROP (*) DELETE TRUNCATE KILL Incorrect. Refer to Section 8 Lesson 3. 7. After issuing a SET UNUSED command on a column, another column with the same name can be added using an ALTER TABLE statement. True or False? Mark for Review (1) Points True (*) False Correct 8. You can use DROP COLUMN to drop all columns in a table, leaving a table structure with no columns. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 8 Lesson 3. 9. The data type of a column can never be changed once it has been created. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 8 Lesson 3.

10. When should you use the SET UNUSED command? Mark for Review (1) Points Never, there is no SET UNUSED command You should use it if you think the column may be needed again later You should use it when the system is being heavily used (*) You should only use this command if you want the column to still be visible when you DESCRIBE the table Incorrect. Refer to Section 8 Lesson 3. 11. When you use ALTER TABLE to add a column, the new column: Mark for Review (1) Points Becomes the first column in the table Becomes the last column in the table (*) Can be placed by adding a GROUP BY clause Will not be created because you cannot add a column after the table is created Incorrect. Refer to Section 8 Lesson 3. 12. The FLASHBACK TABLE to BEFORE DROP can restore only the table structure, but not its data back to before the table was dropped. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 8 Lesson 3. 13. Which of the following will correctly change the name of the LOCATIONS table to NEW_LOCATIONS? Mark for Review (1) Points ALTER TABLE LOCATIONS RENAME NEW_LOCATIONS MODIFY TABLE LOCATIONS RENAME NEW_LOCATIONS

RENAME LOCATIONS TO NEW_LOCATIONS (*) None of the above; you cannot rename a table, you can only CREATE, ALTER and DROP a table. Incorrect. Refer to Section 8 Lesson 3. 14. ALTER TABLE table_name RENAME can be used to: Mark for Review (1) Points Rename a row. Rename a column. Rename a table. (*) All of the above. A unique key constraint can only be defined on a not null column. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 10 Lesson 1. 2. Which of the following is not a valid Oracle constraint type? Mark for Review (1) Points UNIQUE KEY NOT NULL EXTERNAL KEY (*) PRIMARY KEY Correct

3. If the employees table has a UNIQUE constraint on the DEPARTMENT_ID column, we can only have one employee per department. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 10 Lesson 1. 4. A table can have more than one UNIQUE key constraint. True or False? Mark for Review (1) Points True (*) False Incorrect. Refer to Section 10 Lesson 1. 5. A column defined as NOT NULL can have a DEFAULT value of NULL. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 10 Lesson 1. 6. A table must have at least one not null constraint and one unique constraint. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 10 Lesson 1. If a Primary Key is made up of more than one column, one of the columns can be null. True or False? Mark for Review (1) Points

True False (*) Incorrect. Refer to Section 10 Lesson 2. 2. To automatically delete rows in a child table when a parent record is deleted use: Mark for Review (1) Points ON DELETE SET NULL ON DELETE ORPHAN ON DELETE CASCADE (*) None of the Above Incorrect. Refer to Section 10 Lesson 2. 3. Foreign Key Constraints are also known as: Mark for Review (1) Points Parental Key Constraints Child Key Constraints Referential Integrity Constraints (*) Multi-Table Constraints Incorrect. Refer to Section 10 Lesson 2. 4. The table that contains the Primary Key in a Foreign Key Constraint is known as: Mark for Review (1) Points Child Table Parent Table (*) Detail Table

Mother and Father Table Incorrect. Refer to Section 10 Lesson 2. 5. A composite primary key may only be defined at the table level. True or False? Mark for Review (1) Points True (*) False Correct 6. Which line of the following code will cause an error: CREATE TABLE clients (client_number NUMBER(4) CONSTRAINT client_client_num_pk PRIMARY KEY client_number), first_name VARCHAR2(14), last_name VARCHAR2(13), hire_date DATE CONSTRAINT emp_min_hire_date CHECK (hire_date < SYSDATE), department_id VARCHAR(3), CONSTRAINT clients_dept_id_fk FOREIGN KEY(department_id) REFERENCES departments(department_id)); Mark for Review (1) Points Line 2 (*) Line 3 Line 5 Line 7 Incorrect. Refer to Section 10 Lesson 2. 7. An example of adding a check constraint to limit the salary that an employee can earn is: Mark for Review (1) Points ALTER TABLE employees ADD CONSTRAINT emp_salary_ck SALARY < 100000

ALTER TABLE employees CONSTRAINT emp_salary_ck CHECK(salary < 100000) MODIFY TABLE employees ADD CONSTRAINT emp_salary_ck CHECK(salary < 100000 ALTER TABLE employees ADD CONSTRAINT emp_salary_ck CHECK (salary < 100000) (*) Incorrect. Refer to Section 10 Lesson 2. 8. The number of check constraints that can be defined on a column is: Mark for Review (1) Points 10 5 100 There is no limit (*) Incorrect. Refer to Section 10 Lesson 2. 9. The employees table contains a foreign key column department_id that references the id column in the departments table. Which of the following constraint modifiers will NOT allow the deletion of id values in the department table? Mark for Review (1) Points ON DELETE CASCADE ON DELETE SET NULL Neither A nor B (*) Both A and B Incorrect. Refer to Section 10 Lesson 2. 10. A Primary Key that is made up of more than one column is called a: Mark for Review (1) Points Multiple Primary Key Composite Primary Key (*)

Double Key Primary Multi-Key None of the Above Incorrect. Refer to Section 10 Lesson 2. 11. Which of the following pieces of code will NOT successfully create a foreign key in the CDS table that references the SONGS table Mark for Review (1) Points CONSTRAINT d_cd_ song_id_fk FOREIGN KEY (song_id)REFERENCES d_songs(id) CONSTRAINT k_cd_songid_fk FOREIGN KEY (song_id)REFERENCES d_songs(id) song_id NUMBER(5) CONSTRAINT d_cd_ song_id_fk REFERENCES d_songs(id) None of the above (*) Incorrect. Refer to Section 10 Lesson 2. 12. The main reason that constraints are added to a table is: Mark for Review (1) Points Constraints add a level of complexity Constraints ensure data integrity (*) Constraints gives programmers job security None of the Above Incorrect. Refer to Section 10 All of a user's constraints can be viewed in the Oracle Data Dictionary view called: Mark for Review (1) Points USER_TABLES USER_CONSTRAINTS (*) CONSTRAINTS

TABLE_CONSTRAINTS Incorrect. Refer to Section 10 Lesson 3. 2. What mechamisn does Oracle use in the background to enforce uniqueness in Primary and Unique key constraints? Mark for Review (1) Points Ordered Lists Internal Pointers Nothing extra is created when Primary Keys and Unique Keys are created Unique indexes are created in the background by Oracle when Primary and Unique constraints are created or enabled (*) Incorrect. Refer to Section 10 Lesson 3. 3. The command to 'switch off' a constraint is: Mark for Review (1) Points ALTER TABLE STOP CHECKING ALTER TABLE STOP CONSTRAINTS ALTER TABLE DISABLE CONSTRAINT (*) ALTER TABLE PAUSE CONSTRAINT Incorrect. Refer to Section 10 Lesson 3. 4. You can drop a column in a table with a simple ALTER TABLE DROP COLUMN statement, even if the column is referenced in a constraint. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 10 Lesson 3.

5. Once constraints have been created on a table you will have to live with them as they are unless you drop and re-create the table. True or False? Mark for Review (1) Points True False (*) Correct A view can contain group functions. True or False? Mark for Review (1) Points True (*) False Correct 2. A view can contain a select statement with a subquery. True or False? Mark for Review (1) Points True (*) False Correct 3. Any select statement can be stored in the database as a view. True or False Mark for Review (1) Points True (*) False Correct 4. Given the following CREATE VIEW statement, what data will be returned? CREATE OR REPLACE VIEW emp_dept AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name, e.salary,

e.hire_date, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id AND d.department_id >=50; Mark for Review (1) Points First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_id of all employees working in department number 50 or higher. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_id of all employees working in department number 50. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_name of all employees working in department number 50. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_name of all employees working in department number 50 or higher. (*) Incorrect. Refer to Section 11 Lesson 1. 5. Views contain no data of their own. True or False? Mark for Review (1) Points True (*) False Correct 6. What is one advantage of using views? Mark for Review (1) Points To provide data dependence To be able to store the same data in more than one place To provide restricted data access (*) Incorrect. Refer to Section 11 Lesson 1. Given the following view what operations would be allowed on the emp_dept view: CREATE OR REPLACE VIEW emp_dept AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name,

e.salary, e.hire_date, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id AND d.department_id >=50; Mark for Review (1) Points SELECT, DELETE SELECT, UPDATE of all columns SELECT, UPDATE of some columns, DELETE (*) SELECT, INSERT Incorrect. Refer to Section 11 Lesson 2. 2. Using the pseudocolumn ROWNUM in a view has no implications on the ability to do DML's through the view. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 11 Lesson 2. 3. If a database administrator wants to ensure that changes performed through a view do not violate existing constraints, which clause should he/she include when creating the view? Mark for Review (1) Points WITH READ ONLY FORCE WITH CONSTRAINT CHECK WITH CHECK OPTION (*) Incorrect. Refer to Section 11 Lesson 2.

4. There is only one kind view? True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 11 Lesson 2. 5. Examine the view below and choose the operation that CANNOT be performed on it. CREATE VIEW dj_view (last_name, number_events) AS SELECT c.last_name, COUNT(e.name) FROM d_clients c, d_events e WHERE c.client_number = e.client_number GROUP BY c.last_name Mark for Review (1) Points CREATE OR REPLACE dj_view (last_name, number_events) AS SELECT c.last_name, COUNT (e.name) FROM d_clients c, d_events e WHERE c.client_number=e.client_number GROUP BY c.last_name; INSERT INTO dj_view VALUES ('Turner', 8); (*) SELECT last_name, number_events FROM dj_view; DROP VIEW dj_view; Correct 6. Which of the following DML operations is not allowed when using a Simple View created with read only? Mark for Review (1) Points INSERT UPDATE DELETE All of the above (*)

A Top-N Analysis is capable of ranking a top or bottom set of results. True or False? Mark for Review (1) Points True (*) False Correct 2. Which of these is not a valid type of View? Mark for Review (1) Points INLINE ONLINE (*) SIMPLE COMPLEX Incorrect. Refer to Section 11 Lesson 3. 3. How do you remove a view? Mark for Review (1) Points DELETE VIEW view_name REMOVE VIEW view_name DROP VIEW view_name (*) You cannot remove a view Incorrect. Refer to Section 11 Lesson 3. 4. Which of these Keywords is typically used with a Top-N Analysis? Mark for Review (1) Points Rowid Rownum (*) Sequence

Number Incorrect. Refer to Section 11 Lesson 3. 5. Which of the following is true about ROWNUM? Mark for Review (1) Points It is the number assigned to each row returned from a query after they are ordered. It is the number assigned to each row returned from a query as they are read from disk. (*) It is the number of rows in a table. None of the above Correct 6. When you drop a table referenced by a view, the view is automatically dropped as well. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 11 Lesson 3. 7. When you drop a view, the data it contains is also deleted. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 11 Lesson 3. A sequence is a database object. True or False? Mark for Review (1) Points True (*) False

Correct 2. Which keyword is used to modify a sequence? Mark for Review (1) Points Change Update Alter (*) Create Correct 3. CURRVAL is a pseudocolumn used to extract successive sequence numbers from a specified sequence. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 12 Lesson 1. 4. CURRVAL is a pseudocolumn used to refer to a sequence number that the current user has just generated by referencing NEXTVAL. True or False? Mark for Review (1) Points True (*) False Correct 5. A sequence is a window through which data can be queried or changed. True or False? Mark for Review (1) Points True

False (*) Incorrect. Refer to Section 12 Lesson 1. 6. Examine the code for creating this sequence: CREATE SEQUENCE track_id_seq INCREMENT BY 10 START WITH 1000 MAXVALUE 10000 What are the first three values that would be generated by the sequence? Mark for Review (1) Points 100010011002 1000, 1010, 1020 (*) 1100, 1200, 1300 0, 1, 2 Correct 7. In order to be able to generate primary key values that are not likely to contain gaps, which phrase should be included in the sequence creation statement? Mark for Review (1) Points NOCACHE (*) CACHE MAXVALUE Incorrect. Refer to Section 12 Lesson 1. 8. When you alter a sequence, a new increased MAXVALUE can be entered without changing the existing number order. True or False? Mark for Review (1) Points True (*) False Correct

9. Why do gaps in sequences occur? Mark for Review (1) Points A rollback is executed The system crashes The sequence is used in another table All of the above (*) Incorrect. Refer to Section 12 Lesson 1. 10. Nextval and Currval are know as column aliases. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 12 Lesson 1. 11. Which keyword is used to remove a sequence? Mark for Review (1) Points Drop (*) Delete Remove Revoke Incorrect. Refer to Section 12 Lesson 1. 12. Which is the correct syntax for specifying a maximum value in a sequence? Mark for Review (1) Points Maxval Max_value

Maximumvalue Maxvalue (*) Correct If the employees table have 7 rows how many rows are inserted into the copy_emps table with the following statement: INSERT INTO copy_emps (employee_id, first_name, last_name, salary, department_id) SELECT employee_id, first_name, last_name, salary, department_id FROM employees Mark for Review (1) Points No rows, as you cannot use subqueries in an insert statement. 7 rows, as there is no WHERE-clause on the subquery. (*) No rows, as the SELECT statement is invalid. 10 rows will be created. Correct 2. DML is an acronym that stands for: Mark for Review (1) Points Debit Markup Language Don't Manipulate Language Data Markup Language Data Manipulation Language (*) Incorrect. Refer to Section 7 Lesson 1. 3. What is the quickest way to use today's date when you are creating a new row? Mark for Review (1) Points Simply write today's date in the format of 'dd-mon-rr'.

Simply use the keyword DATE in the insert statement. Use the SYSDATE function. (*) Use the TODAYS_DATE function. Incorrect. Refer to Section 7 Lesson 1. 4. When inserting rows into a table all columns must be given values. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 7 Lesson 1. 5. When inserting a new row the null keyword can be included in the values list for any null column. True or False? Mark for Review (1) Points True (*) False Correct 6. Is it possible to insert more than one row at a time using an INSERT statement with a VALUES clause? Mark for Review (1) Points No, you can only create one row at a time when using the VALUES clause. (*) Yes, you can just list as many rows as you want, just remember to separate the rows with commas. No, there is no such thing as INSERT ... VALUES. Incorrect. Refer to Section 7 Lesson 1.

7. Which of the following statements will add a new customer to the customers table in the Global Fast Foods database? Mark for Review (1) Points INSERT IN customers (id, first_name, last_name, address, city, state, zip, phone_number); INSERT INTO customers (id, first_name, last_name, address, city, state, zip, phone_number) VALUES ("145", 'Katie', 'Hernandez', '92 Chico Way', 'Los Angeles', 'CA', "98008", "8586667641"); INSERT INTO customers (id, first_name, last_name, address, city, state, zip, phone_number) VALUES (145, 'Katie', 'Hernandez', '92 Chico Way', 'Los Angeles', 'CA', 98008, 8586667641); (*) INSERT INTO customers (id 145, first_name 'Katie', last_name 'Hernandez', address '92 Chico Way', city 'Los Angeles', state 'CA', zip 98008, phone_number 8586667641);

Incorrect. Refer to Section 7 Lesson 1. 8. To return a table summary on the customers table, which of the following is correct? Mark for Review (1) Points SHOW customers, or SEE customers DISTINCT customers, or DIST customers DESCRIBE customers, or DESC customers (*) DEFINE customers, or DEF customers Incorrect. Refer to Section 7 Lesson 1. 9. Insert statements can be combined with subqueries to create more than one row per statement. True or False? Mark for Review (1) Points True (*)

False Correct Which of the following statements best describes what will happen to the student table in this SQL statement? UPDATE students SET lunch_number = (SELECT lunch_number FROM student WHERE student_id = 17) WHERE student_id = 19; Mark for Review (1) Points The statement updates the student_table by replacing student id 19's lunch number with student id 17's lunch number. (*) Inserts a new row into the students table. Does nothing, the as you cannot use subqueries in UPDATE statements. Deletes student 17's lunch_number and inserts a new value from student 19. Correct 2. DELETE statements can use correlated subqueries? (True or False) Mark for Review (1) Points True False (*) Incorrect. Refer to Section 7 Lesson 2. 3. Assuming there are no Foreign Keys on the EMPLOYEES table, if the following subquery returns one row, how many rows will be deleted from the EMPLOYEES table? DELETE FROM employees WHERE department_id = (SELECT department_id FROM departments WHERE department_name LIKE '%Public%'); Mark for Review

(1) Points No rows will be deleted. One row will be deleted, as the subquery only returns one row. All the rows in the EMPLOYEES table with department_ids matching the department_id returned by the subquery. (*) All rows in the EMPLOYEES table will be deleted, regardless of their department_id. Correct 4. If the subquery returns one row, how many rows will be deleted from the employees table? DELETE FROM employees WHERE department_id = (SELECT department_id FROM departments WHERE department_name LIKE '%Public%'); Mark for Review (1) Points No rows will be deleted. One row will be deleted, as the subquery only returns one row. All rows in the employees table which work in the given department will be deleted. (*) All rows in the employees table will be deleted, no matter their department_id. Correct 5. How many rows will be deleted from the employees table with the following statement? DELETE FROM employees WHERE last_name = 'king'; Mark for Review (1) Points All the rows in the employees table will be deleted. No rows will be deleted, as no employees match the WHERE-clause. (*) One will be deleted, as there exists one employee called King. All rows with last_name = 'King' will be deleted.

Incorrect. Refer to Section 7 Lesson 2. 6. Using your knowledge of the employees table, what would be the result of the following statement: DELETE FROM employees; Mark for Review (1) Points Nothing, no data will be changed. All rows in the employees table will be deleted if there are no constraints on the table. (*) The first row in the employees table will be deleted. Deletes employee number 100. Incorrect. Refer to Section 7 Lesson 2. 7. Is the following statement valid, i.e. is it allowed to update rows in one table, based on a subquery from another table? UPDATE copy_emp SET department_id = (SELECT department_id FROM employees WHERE employee_id = 100) WHERE job_id = (SELECT job_id FROM employees WHERE employee_id = 200); Mark for Review (1) Points Yes, this is a perfectly valid statement. (*) The statement will fail, because the subqueries are returning data from different rows No, this will not work No, this statement will return an error. Incorrect. Refer to Section 7 Lesson 2. 8. If you are performing an UPDATE statement with a subquery, it MUST be a correlated subquery? (True or False) Mark for Review (1) Points

True False (*) Incorrect. Refer to Section 7 Lesson 2. 9. To change an existing row in a table, you can use the UPDATE or INSERT statements. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 7 Lesson 2. The MERGE statement can be used to update rows in one table based on values in another table and if the update fails, then the rows will automatically be inserted instead. True or False? Mark for Review (1) Points True (*) False Correct 2. A multi-table insert statement can insert into more than one table? (True or False) Mark for Review (1) Points True (*) False Correct 3. The DEFAULT keyword can be used in the following statements: Mark for Review (1) Points INSERT and UPDATE (*) INSERT and DELETE

DELETE and UPDATE All of the above Incorrect. Refer to Section 7 Lesson 3. 4. Which statement below will not insert a row of data onto a table? Mark for Review (1) Points INSERT INTO student_table (id, lname, fname, lunch_num) VALUES (143354, 'Roberts', 'Cameron', 6543); INSERT INTO student_table VALUES (143354, 'Roberts', 'Cameron', 6543); INSERT INTO student_table (id, lname, fname, lunch_num) VALUES (143352, 'Roberts', 'Cameron', DEFAULT); INSERT INTO (id, lname, fname, lunch_num) VALUES (143354, 'Roberts', 'Cameron', 6543); (*)

Incorrect. Refer to Section 7 Lesson 3. 5. A multi-table insert statement must have a subquery at the end of the statement? (True or False) Mark for Review (1) Points True (*) False Incorrect. Refer to Section 7 Lesson 3. 6. If a default value was set for a null column, Oracle sets the column to the default value. However, if no default value was set when the column was created, Oracle inserts an empty space. True or False? Mark for Review (1) Points

True False (*) Correct 7. In developing the Employees table, you create a column called hire_date. You assign the hire_date column a DATE datatype with a DEFAULT value of 0 (zero). A user can come back later and enter the correct hire_date. This is __________. Mark for Review (1) Points A great idea. When a new employee record is entered, if no hire_date is specified, the 0 (zero) will be automatically specified. A great idea. When new employee records are entered, they can be added faster by allowing the 0's (zeroes) to be automatically specified. Both a and b are correct. A bad idea. The default value must match the DATE datatype of the column. (*) Incorrect. Refer to Section 7 Lesson 3. 8. The MERGE function combines the: Mark for Review (1) Points CREATE and UPDATE commands INSERT and UPDATE commands (*) ALTER and UPDATE commands All of the above Incorrect. Refer to Section 7 Lesson 3. It is possible to have an indexed column in a table where a value in the table column does not exist in the index. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 12 Lesson 2. 2. Indexes can be used to speed up queries. True or False? Mark for Review (1) Points True (*) False Correct 3. In SQL what is a synonym? Mark for Review (1) Points A table with the same number of columns as another table A table with the same name as another view A different name for a table, view or other database object (*) A table with that must be qualified with a username Correct 4. Which of the following statements best describes indexes and their use? Mark for Review (1) Points They are just copies of data in no particular order. They contain the column value and pointers to the data in the table, but the data is sorted. (*) They contain all the rows and columns from the table None of the above Correct 5. All tables must have indexes on them otherwise they cannot be queried. True or False? Mark for Review (1) Points

True False (*) Correct 6. What kind of INDEX is created by Oracle when you create a primary key? Mark for Review (1) Points UNIQUE INDEX (*) NONUNIQUE INDEX INDEX Oracle cannot create indexes automatically. Correct 7. You must use a synonym to access another users table. True or False? Mark for Review (1) Points True False (*) Correct 8. Which of the following SQL statements shows a correct syntax example of creating a synonym accessible to all users of a database? Mark for Review (1) Points CREATE SYNONYM emp FOR EMPLOYEES CREATE PUBLIC SYNONYM emp FOR EMPLOYEES (*) CREATE UNRESTRICTED SYNONYM emp FOR EMPLOYEES CREATE SHARED SYNONYM emp FOR EMPLOYEES Incorrect. Refer to Section 12 Lesson 2.

System privileges are: Mark for Review (1) Points Required to gain access to the database. (*) Required to manipulate the content of objects in the database. Named groups of related privileges given to a user. A collection of objects, such as tables, views, and sequences. Incorrect. Refer to Section 12 Lesson 1. 2. Object privileges are: Mark for Review (1) Points Required to gain access to the database. Required to manipulate the content of objects in the database. (*) Named groups of related privileges given to a user. A collection of objects, such as tables, views, and sequences. Incorrect. Refer to Section 12 Lesson 1. 3. Which of the following Object Privileges can be granted on an individual column on a table? (Choose two) Mark for Review (1) Points (Choose all correct answers) Update (*) References (*) Insert Delete Correct

4. The following table shows some of the output from one of the data dictionary views. Which view is being queried? USERNAME PRIVILEGE ADMIN_OPTION USCA_ORACLE_SQL01_S08 CREATE VIEW NO USCA_ORACLE_SQL01_S08 CREATE TABLE NO USCA_ORACLE_SQL01_S08 CREATE SYNONYM NO USCA_ORACLE_SQL01_S08 CREATE TRIGGER NO USCA_ORACLE_SQL01_S08 CREATE SEQUENCE NO USCA_ORACLE_SQL01_S08 CREATE DATABASE NO Mark for Review (1) Points user_sys_privs (lists system privileges granted to the user) (*) user_tab_privs_recd (lists object privileges granted to the user) role_tab_privs (lists table privileges granted to roles) role_sys_privs (lists system privileges granted to roles) Incorrect. Refer to Section 12 Lesson 1. 5. What system privilege must be held in order to login to an Oracle database? Mark for Review (1) Points CREATE LOGIN CREATE SESSION (*) CREATE LOGON No special privilege is needed, if your username exists in the database, you can login. Incorrect. Refer to Section 12 Lesson 1. 6. By Controlling User Access with Oracle Database Security you can give access to specific Objects in the Database. True or False? Mark for Review (1) Points True (*) False

Incorrect. Refer to Section 12 Lesson 1. 7. Which Object Privilege apart from Alter can be granted to a Sequence? Mark for Review (1) Points SELECT (*) UPDATE INSERT DELETE Incorrect. Refer to Section 12 Lesson 1. 8. A schema is: Mark for Review (1) Points Required to gain access to the database. Required to manipulate the content of objects in the database. A named group of related privileges given to a user. A collection of objects, such as tables, views, and sequences. (*) Incorrect. Refer to Section 12 Lesson 1. 9. Which of these is not a System Privilege granted by the DBA? Mark for Review (1) Points Create Sequence Create Index (*) Create Procedure Create Session Incorrect. Refer to Section 12 Lesson 1. 10. A Schema is a collection of Objects such as Tables, Views and Sequences. True or False? Mark for Review

(1) Points True (*) False Incorrect. Refer to Section 12 Lesson 1. 11. Which of the following is not a database object? Mark for Review (1) Points View Subquery (*) Table Sequence Incorrect. Refer to Section 12 Lesson 1. Object privileges are: Mark for Review (1) Points Required to gain access to the database. Required to manipulate the content of objects in the database. (*) Named groups of related privileges given to a user. A collection of objects, such as tables, views, and sequences. Correct 2. A Schema is a collection of Objects such as Tables, Views and Sequences. True or False? Mark for Review (1) Points True (*) False Correct

3. Which of the following Object Privileges can be granted on an individual column on a table? (Choose two) Mark for Review (1) Points (Choose all correct answers) Update (*) References (*) Insert Delete Correct 4. System privileges are: Mark for Review (1) Points Required to gain access to the database. (*) Required to manipulate the content of objects in the database. Named groups of related privileges given to a user. A collection of objects, such as tables, views, and sequences. Correct 5. By Controlling User Access with Oracle Database Security you can give access to specific Objects in the Database. True or False? Mark for Review (1) Points True (*) False Correct 6. Which Object Privilege apart from Alter can be granted to a Sequence? Mark for Review (1) Points SELECT (*)

UPDATE INSERT DELETE Correct 7. What system privilege must be held in order to login to an Oracle database? Mark for Review (1) Points CREATE LOGIN CREATE SESSION (*) CREATE LOGON No special privilege is needed, if your username exists in the database, you can login. Correct 8. Which of the following is not a database object? Mark for Review (1) Points View Subquery (*) Table Sequence Correct 9. A schema is: Mark for Review (1) Points Required to gain access to the database. Required to manipulate the content of objects in the database. A named group of related privileges given to a user.

A collection of objects, such as tables, views, and sequences. (*) Correct 10. Which of these is not a System Privilege granted by the DBA? Mark for Review (1) Points Create Sequence Create Index (*) Create Procedure Create Session Correct 11. The following table shows some of the output from one of the data dictionary views. Which view is being queried? USERNAME PRIVILEGE ADMIN_OPTION USCA_ORACLE_SQL01_S08 CREATE VIEW NO USCA_ORACLE_SQL01_S08 CREATE TABLE NO USCA_ORACLE_SQL01_S08 CREATE SYNONYM NO USCA_ORACLE_SQL01_S08 CREATE TRIGGER NO USCA_ORACLE_SQL01_S08 CREATE SEQUENCE NO USCA_ORACLE_SQL01_S08 CREATE DATABASE NO Mark for Review (1) Points user_sys_privs (lists system privileges granted to the user) (*) user_tab_privs_recd (lists object privileges granted to the user) role_tab_privs (lists table privileges granted to roles) role_sys_privs (lists system privileges granted to roles) Correct Which of the following statements is true? Mark for Review (1) Points

Database Links allow users to work on remote database objects without having to log into the other database. (*) Database Links are pointers to another schema in the same database. Database Links are never used in the real world. Database Links can be created by any user of a database. You do not need any special privileges to create them. Correct 2. When a user is logged into one database, they are restricted to working with objects found in that database. True or False? Mark for Review (1) Points True False (*) Correct 3. If you are granted privileges to your friend's object, by default you may also grant access to this same object to other users. True or False? Mark for Review (1) Points True False (*) Correct 4. To take away a privilege from a user you use which command? Mark for Review (1) Points DELETE REMOVE REVOKE (*) ALTER

Correct 5. Which of the following statements about granting object privileges is false? Mark for Review (1) Points To grant privileges on an object, the object must be in your own schema, or you must have been granted the object privileges WITH GRANT OPTION. An object owner can grant any object privilege on the object to any other user or role of the database. The owner of an object automatically acquires all object privileges on that object. Object privileges can only be granted through roles. (*) Correct 6. User1 owns a table and grants select on it WITH GRANT OPTION to User2. User2 then grants select on the same table to User3. If User1 revokes select privileges from User2, will User3 be able to access the table? Mark for Review (1) Points Yes No (*) Correct 7. What Oracle feature simplifies the process of granting and revoking privileges? Mark for Review (1) Points Role (*) Object Data dictionary Schema Correct

8. Roles are: Mark for Review (1) Points Required to gain access to the database. Required to manipulate the content of objects in the database. Named groups of related privileges given to a user or another role. (*) A collection of objects, such as tables, views, and sequences. Correct 9. A role can be granted to another role. True or False? Mark for Review (1) Points True (*) False Correct 10. Scott King owns a table called employees. He issues the following statement: GRANT select ON employees TO PUBLIC; Allison Plumb has been granted CREATE SESSION by the DBA. She logs into the database and issues the following statement: GRANT ?select ON ?scott_king.employees TO jennifer_cho; True or False: Allison's statement will fail. Mark for Review (1) Points True (*) False Correct Select the correct REGULAR EXPRESSION functions: (Choose two) Mark for Review (1) Points (Choose all correct answers) REGEXP_LIKE, REGEXP_NEAR

REGEXP_LIKE, REGEXP_REPLACE (*) REGEXP_REPLACE, REGEXP_REFORM REGEXP_INSTR, REGEXP_SUBSTR (*) Correct 2. REGULAR EXPRESSIONS can be used on CHAR, CLOB and VARCHAR2 datatypes? (True or False) Mark for Review (1) Points True (*) False Correct 3. REGULAR EXPRESSIONS can be used as a part of contraint definitions? (True or False) Mark for Review (1) Points True (*) False Incorrect. Refer to Section 13 Lesson 3. 4. REGULAR EXPRESSIONS does exactly the same as LIKE. No more and no less? (True or False) Mark for Review (1) Points True False (*) Incorrect. Refer to Section 13 Lesson 3. If a database crashes, all uncommitted changes are automatically rolled back. True or False? Mark for Review (1) Points True (*)

False Correct 2. 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; Which rows does the table now contain? Mark for Review (1) Points A, B and C A and B (*) C None of the above Incorrect. Refer to Section 14 Lesson 1. 3. Which SQL statement is used to remove all the changes made by an uncommitted transaction? Mark for Review (1) Points UNDO; ROLLBACK; (*) ROLLBACK TO SAVEPOINT; REVOKE ...; Correct 4. User BOB's CUSTOMERS table contains 20 rows. BOB inserts two more rows into the table but does not COMMIT his changes. User JANE now executes: SELECT COUNT(*) FROM bob.customers;

What result will JANE see? Mark for Review (1) Points 22 20 (*) 2 JANE will receive an error message because she is not allowed to query the table while BOB is updating it. Incorrect. Refer to Section 14 Lesson 1. 5. Steven King's row in the EMPLOYEES table has EMPLOYEE_ID = 100 and SALARY = 24000. A user issues the following statements in the order shown: UPDATE employees SET salary = salary * 2 WHERE employee_id = 100; COMMIT; UPDATE employees SET salary = 30000 WHERE employee_id = 100; The user's database session now ends abnormally. What is now King's salary in the table? Mark for Review (1) Points 48000 (*) 30000 24000 78000 Incorrect. Refer to Section 14 Lesson 1. 6. Which of the following best describes the term "read consistency"? Mark for Review (1) Points It ensures that all changes to a table are automatically committed

It prevents other users from querying a table while updates are being executed on it It prevents other users from seeing changes to a table until those changes have been committed (*) It prevents users from querying tables on which they have not been granted SELECT privilege Incorrect. Refer to Section 14 Lesson 1. 7. A transaction makes several successive changes to a table. If required, you want to be able to rollback the later changes while keeping the earlier changes. What must you include in your code to do this? Mark for Review (1) Points An update statement A savepoint (*) An object privilege A database link A sequence Incorrect. Refer to Section 14 Lesson 1. 8. Examine the following statements: UPDATE employees SET salary = 15000; SAVEPOINT upd1_done; UPDATE employees SET salary = 22000; SAVEPOINT upd2_done; DELETE FROM employees; You want to retain all the employees with a salary of 15000; What statement would you execute next? Mark for Review (1) Points ROLLBACK; ROLLBACK TO SAVEPOINT upd1_done; (*) ROLLBACK TO SAVEPOINT upd2_done; ROLLBACK TO SAVE upd1_done;

There is nothing you can do, either all changes must be rolled back, or none of them can be rolled back. Incorrect. Refer to Section 14 Lesson 1 Will the following statement work? SELECT department_name, last_name FROM employees, departments WHERE department_id = department_id; Mark for Review (1) Points Yes, there are no syntax errors in that statement No, Oracle will return a column ambiguously defined error. (*) No, Oracle will not allow joins in the WHERE clause Yes, Oracle will resolve which department_id colum comes from which table. Incorrect. Refer to Section 15 Lesson 1. 2. If table A have 10 rows and table B have 5 rows, how many rows will be returned if you perform a equi-join on those two tables? Mark for Review (1) Points 5 50 10 It depends on the data found in the two tables. (*) Incorrect. Refer to Section 15 Lesson 1. 3. When must column names be prefixed by table names in join syntax? Mark for Review (1) Points When the more than two tables participate in the join Only when query speed and database performance is a concern When the same column name appears in more than one table of the query (*)

Never Correct 4. What is the result of a query that selects from two tables but includes no join condition? Mark for Review (1) Points A Cartesian product (*) A selection of matched rows from both tables A syntax error A selection of rows from the first table only Correct 5. If table A have 10 rows and table B have 5 rows, how many rows will be returned if you perform a cartesian join on those two tables? Mark for Review (1) Points 5 50 (*) 10 15 Incorrect. Refer to Section 15 Lesson 1. 6. Oracle proprietary JOINS can use the WHERE clause for conditions other than the joincondition. True or False? Mark for Review (1) Points True (*) False Correct When must column names be prefixed by table names in join syntax? Mark for Review

(1) Points When the more than two tables participate in the join Only when query speed and database performance is a concern When the same column name appears in more than one table of the query (*) Never Correct 2. Oracle proprietary JOINS can use the WHERE clause for conditions other than the joincondition. True or False? Mark for Review (1) Points True (*) False Correct 3. If table A have 10 rows and table B have 5 rows, how many rows will be returned if you perform a equi-join on those two tables? Mark for Review (1) Points 5 50 10 It depends on the data found in the two tables. (*) Correct 4. What is the result of a query that selects from two tables but includes no join condition? Mark for Review (1) Points A Cartesian product (*) A selection of matched rows from both tables

A syntax error A selection of rows from the first table only Correct 5. Will the following statement work? SELECT department_name, last_name FROM employees, departments WHERE department_id = department_id; Mark for Review (1) Points Yes, there are no syntax errors in that statement No, Oracle will return a column ambiguously defined error. (*) No, Oracle will not allow joins in the WHERE clause Yes, Oracle will resolve which department_id colum comes from which table. Correct 6. If table A have 10 rows and table B have 5 rows, how many rows will be returned if you perform a cartesian join on those two tables? Mark for Review (1) Points 5 50 (*) 10 15 Which of the following operators is/are typically used in a nonequijoin? Mark for Review (1) Points NOT OR IN >=, <=, BETWEEN ...AND (*)

* Correct 2. The following statement is an example of a nonequi-join? SELECT e.last_name, e.salary, j.grade_level FROM employees e, job_grades j WHERE e.salary BETWEEN j.lowest_sal AND j.highest_sal; True or False? Mark for Review (1) Points True (*) False Correct 3. Which statement about joining tables with a non-equijoin is false? Mark for Review (1) Points A WHERE clause must specify a column in one table that is compared to a column in the second table (*) The number of join conditions required is always one less than the number of tables being joined The columns being joined must have compatible data types None of the above Correct The following is a valid outer join statement: SELECT c.country_name, d.department_name FROM countries c, departments d WHERE c.country_id (+) = d.country_id (+) True or False? Mark for Review (1) Points True

False (*) Correct 2. Which symbol is used to perform an outer join? Mark for Review (1) Points * || (+) (*) # Correct 3. The ID column in the CLIENT table that corresponds to the CLIENT_ID column of the ORDER table contains null values for rows that need to be displayed. Which type of join should you use to display the data? Mark for Review (1) Points Equijoin Self join Outer join (*) Nonequi-Join Correct 4. To perform a valid outer join between DEPARMENTS and EMPLOYEES to list departments without employees select the correct WHERE clause for the following select statement: SELECT d.department_name, e.last_name FROM employees e, departments d WHERE Mark for Review (1) Points e.department_id(+) = d.department_id (*) e.department_id(+) = d.department_id(+)

e.department_id = d.department_id(+) e.department_id = d.department_id Correct

Sign up to vote on this title
UsefulNot useful