Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Programming Sections 13. Marge Hohly2 13.1.4  1. Which statements are True about the following sequence? The sequence was used to generate numbers.

Similar presentations


Presentation on theme: "Database Programming Sections 13. Marge Hohly2 13.1.4  1. Which statements are True about the following sequence? The sequence was used to generate numbers."— Presentation transcript:

1 Database Programming Sections 13

2 Marge Hohly2 13.1.4  1. Which statements are True about the following sequence? The sequence was used to generate numbers for the DJ on Demand D_CDS table cd_numbers column.  CREATE SEQUENCE cd_numbers_sq INCREMENT BY 15 START WITH 105 MAXVALUE 999 NOMINVALUE CYCLE NOCACHE ____a. The value 165 will not be generated by this sequence. ____b. The value 999 will not be generated by this sequence. ____c. This sequence would be appropriate for PRIMARY KEY values. ____d. If the D_CDS table is deleted, the sequence is also deleted. ____e. If the systems fails sequence values will be lost. ____f. USER_OBJECTS documents this sequence in the data dictionary. ____g. The START WITH value could be changed with an ALTER SEQUENCE.

3 Marge Hohly3 13.1.5  2. In the CREATE TABLE statement shown below, circle the letter of the line(s) that will automatically create an index. a. CREATE TABLE employees( b. employee_id NUMBER(6), c. last_name VARCHAR2(25) NOT NULL, d. email VARCHAR2(25) CONSTRAINT emp_email_ukUNIQUE, e. salary NUMBER(8,2), f. commission_pct NUMBER(2,2), g. hire_date DATE NOT NULL, h. CONSTRAINT employee_id_pk PRIMARY KEY(employee_id), i. CONSTRAINT emp_dept_fk FOREIGN KEY(department_id)REFERENCES j. departments(department_id)

4 Marge Hohly4 13.1.6  3. What data dictionary view contains the sequences created by a schema? a. SEQUENCE_VIEW b. USER_SEQUENCES c. SEQUENCE_NAMES d. USER_VIEWS  4. What is the proper syntax for changing the emp_email_index on the email column of the employees table? a. CREATE INDEX emp_email_index ON employees (email); b. ALTER INDEX emp_mail_index FROM employees(email); c. CREATE AND REPLACE INDEX emp_email_index ON employees, COLUMN = email; d. ADD INDEX emp_email_index INTO employees (email); e. None of the above  Indexes cannot be modified -- instead, DROP and re-create.

5 Marge Hohly5 13.1.7  5. Which data dictionary view is used to view the table name, the index name, and the column name that the index is based on? a. USER_TABLE_INDEXES b. USER_COLUMNS c. USER_IND_COLUMNS d. ALL_INDEXES  6. If the PUBLIC option is not included in the CREATE SYNONYM syntax, which of the following is True? a. Users cannot lengthen object names. b. The DBA does not have access to the synonym. c. The synonym is not accessible to all users. d. All object names must be qualified with PUBLIC.

6 Marge Hohly6 13.1.8  7. What are the last three numbers created by the sequence?  CREATE SEQUENCE sample_seq INCREMENT BY 3 START WITH 6 MAXVALUE 14 NOMINVALUE CYCLE NOCACHE a. 3, 6, 9 b. 6, 9, 12 c. 9, 12, 15 d. 9, 12, 14  8. Which of the following is a good reason to create an index? a. A column has a large number of null values. b. A column has a narrow range of values. c. Most queries are expected to return more than 5% of the rows. d. A table is updated frequently..

7 Marge Hohly7 13.1.9  9. Which of the following constraints can be created at the table level? a. NOT NULL b. FOREIGN KEY c. PRIMARY KEY d. UNIQUE COMPOSITE KEY  10. Which of the following cannot contain a single- row function? a. SELECT b. FROM c. WHERE d. ORDER BY

8 Marge Hohly8 13.4.4  1. The CREATE TABLE AS SELECT syntax can be used to: (choose all that apply) a. create a new table without data based on the structure and column names of an existing table. b. create a new table containing the same structure but different column names as an existing table. c. create a new table containing the structure and data of an existing table. d. create a set of pseudocolumns that query and display part of an existing table.  2. Which identifiers listed below are invalid names for use in the Oracle database? a. a table named: Long_table_name_for_storing_data b. a sequence named: 4generatingUniqueNumbers c. a column named: Primary_Key$Column d. a view named: My&ViewOfData

9 Marge Hohly9 Guidelines to grant object privileges  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.

10 Marge Hohly10 Syntax

11 Marge Hohly11 13.4.5  3. SYSDATE and USER are not permitted as references in: a. the values clause of an INSERT statement b. default values for column definitions c. check constraints d. none of the above  4. What will be the column names resulting from the following view definition: CREATE OR REPLACE VIEW Name_Vu (Person_Name, Title, Pay) AS SELECT last_name AS name, job_id position, salary AS compensation FROM employees; a. LAST_NAME, JOB_ID, POSITION b. PERSON_NAME, TITLE, PAY c. NAME, POSITION, COMPENSATION d. none of the above

12 Marge Hohly12 13.4.6  5. To ensure that DML operations performed on a view stay within the domain of the view, use which of the following? a. AS CHECK b. CASCADE c. WITH CHECK OPTION d. CHECK CONSTRAINT  6. A column that will be used to store text data with a size of 4,000 bytes or larger should be defined as which data type? a. varchar2 b. CLOB c. LONG d. CHAR  7. To store time with fractions of seconds, which data type should be used for the column? a. date b. datetime c. timestamp d. interval day to second

13 Marge Hohly13 13.4.7  8. The data type TIMESTAMP WITH TIME ZONE stores: a. The current date, time (including fractions of seconds), and time zone b. The current date, time (without fractions of seconds), and time zone c. The current date, time (including fractions of seconds), and offset from UTC d. The current date, time (including fractions of seconds), and offset from the database time  9. To keep a table from being accessed so it can be dropped when the demand on system resources is lower, use: a. ALTER TABLE modify column b. ALTER TABLE drop column c. ALTER TABLE set unused d. DROP “columnname”FROM songs;

14 Marge Hohly14 13.4.8  10. Comments on tables and columns can be stored for documentation by: a. embedding /* comment */ within the definition of the table. b. using the ALTER TABLE CREATE COMMENT syntax c. using the COMMENT ON TABLE or COMMENT ON COLUMN d. using an UPDATE statement on the USER_COMMENTS table  11. To allow the delete of a parent (primary key) record that has referenced foreign key values, use a. ON DELETE RESTRICT b. ON DELETE SET NULL c. ON DELETE CASCADE d. ON DELETE DELETE

15 Marge Hohly15 13.4.9  12. (True/False) Multicolumn constraints can be defined at the column or table level.  13. (True/False) To give a constraint a name other than SYS_n, precede it with the keyword “CONSTRAINT.”  14. (True/False) NOT NULL constraints are created implicitly when you create a new table using subquery CREATE TABLE AS syntax.

16 Marge Hohly16 13.4.10  15. By default, unique indexes are created when which constraints are enabled? a. PRIMARY KEY b. FOREIGN KEY c. NOT NULL d. CHECK e. UNIQUE  16. Constraints can be: (choose all that apply) a. enabled or disabled b. created or dropped c. changed through “alter constraint” d. viewed in user_constraints  17. (True/False) Like tables, to change a view definition, use the ALTER VIEW syntax.  18. (True/False) To use a view, a person must have security privileges on the tables that the view contains.  19. (True/False) INSERT, UPDATE, and DELETE are never permitted on a view created with the WITH CHECK OPTION clause.

17 Marge Hohly17 13.4.11  20. An inline view is created by placing a subquery in the FROM clause and: a. updating the user_views data dictionary view b. using a GROUP BY clause to group the columns c. enclosing in parentheses the SELECT clause d. giving the subquery an alias  21. Top-n-analysis makes use of a sorted inline view in the FROM clause and (in the outer query): a. a rowid pseudocolumn in the WHERE clause b. the level pseudocolumn in the WHERE clause c. a rownum column in the ORDER BY clause d. ROWNUM in the WHERE clause  22. If you wanted to see the value that you fetched from a sequence named “my_SEQ,” you should reference: a. my_SEQ.last_value b. my_SEQ.nextval c. my_SEQ.currval d. my_SEQ.maxval.

18 Marge Hohly18 13.4.12  23. Sequences can be used to: (choose all that apply) a. ensure that primary key values will be unique and consecutive b. ensure that numbers will be unique even though gaps may exist c. use a range of numbers and optionally cycle through them again d. set a fixed interval for successive numbers  24. The ALTER SEQUENCE syntax can be used to: (choose all that apply) a. change the START WITH of an existing sequence b. reset the MAX VALUE to a lower number than was last used c. change the name of the sequence d. change the interval of the sequence  25. (True/False) Indexes always speed up access to rows in a table.  26. (True/False) To use an index, you must name it in the FROM clause of your query.

19 Marge Hohly19 13.4.12  27. A function-based (or functional) index stores sorted information that contains: a. a rowid and the column(s) key value(s) b. a rowid and a function return based on the column key value c. a rowid and a method that dynamically acts on the key value d. a bitmap for a range of rowids that correspond to a key value  28. A shareable alias for a database object is called a: a. pseudonym b. rowid c. synonym d. view  29. To prevent others from performing DML operations on tables you share in your schema: a. GRANT select b. GRANT view only c. GRANT unused d. GRANT revoke  30. (True/False) The owner of an object automatically acquires all object privileges on objects in his/her schema.


Download ppt "Database Programming Sections 13. Marge Hohly2 13.1.4  1. Which statements are True about the following sequence? The sequence was used to generate numbers."

Similar presentations


Ads by Google