Working with Databases and Database Objects - Answers

Similar documents
Which of the following is the best way to prevent most users from viewing AVG_SALARY data?

IBM EXAM QUESTIONS & ANSWERS

IBM EXAM - C DB Fundamentals. Buy Full Product.

Working with DB2 Data Using SQL and XQuery Answers

Microsoft MOS- Using Microsoft Office Access Download Full Version :

Creating and Managing Tables Schedule: Timing Topic

Chapter 11 Object and Object- Relational Databases

DB Fundamentals Exam.

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Analytics: Server Architect (Siebel 7.7)

IBM i Version 7.2. Database SQL programming IBM

IBM i Version 7.3. Database SQL programming IBM

MTA Database Administrator Fundamentals Course

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year!

5. Single-row function

Chapter 2. DB2 concepts

C Examcollection.Premium.Exam.58q

B. UPDATE DB CFG FOR sample USING LOOCKLIST 8192 AUTOMATIC IMMEDIATE

Basi di Dati Complementi. Mainframe

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

T-sql Grant View Definition Example

Introduction to Computer Science and Business

Oracle Database 12c: Program with PL/SQL Duration: 5 Days Method: Instructor-Led

T-SQL Training: T-SQL for SQL Server for Developers

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept]

DB2 UDB: App Programming - Advanced

Listing of SQLSTATE values

Index. NOTE: Boldface numbers indicate illustrations; t indicates a table 207

Sql Server Syllabus. Overview

DB2 for z/os Stored Procedures Update

IBM. Database Database overview. IBM i 7.1

A Examcollection.Premium.Exam.54q

Oracle Database: Program with PL/SQL

Exam Questions C

Oracle Database: Program with PL/SQL Ed 2

Oracle PLSQL Training Syllabus

Oracle Database 11g: SQL and PL/SQL Fundamentals

Oracle - Oracle Database: Program with PL/SQL Ed 2

IBM DB2 for z/os Application Developer Certification

Oracle Database 12c R2: Program with PL/SQL Ed 2 Duration: 5 Days

MySQL 5.0 Certification Study Guide

Conditionally control code flow (loops, control structures). Create stored procedures and functions.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

IBM i Version 7.2. Database Database overview IBM

IBM DB2 11 DBA for z/os Certification Review Guide Exam 312

Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE

Oracle Database: Introduction to SQL/PLSQL Accelerated

Configuring the Oracle Network Environment. Copyright 2009, Oracle. All rights reserved.

Question: Which statement would you use to invoke a stored procedure in isql*plus?

Information technology Database languages SQL Part 4: Persistent Stored Modules (SQL/PSM)

Sql Server 2008 Cannot Drop Schema Because Being Referenced Object

Vendor: IBM. Exam Code: C Exam Name: DB Fundamentals. Version: Demo

Oracle Database: Program with PL/SQL

Creating databases using SQL Server Management Studio Express

DB2 for z/os: Programmer Essentials for Designing, Building and Tuning

Security Enterprise Identity Mapping

Oracle Developer Track Course Contents. Mr. Sandeep M Shinde. Oracle Application Techno-Functional Consultant

Sql Server Check If Global Temporary Table Exists

Oracle Database 11g: Program with PL/SQL Release 2

Optional SQL Feature Summary

DB2 UDB: Application Programming

SQL Interview Questions

Introduction to SQL/PLSQL Accelerated Ed 2


Oracle Exam 1z0-144 Oracle Database 11g: Program with PL/SQL Version: 8.5 [ Total Questions: 103 ]

Oral Questions and Answers (DBMS LAB) Questions & Answers- DBMS

DB2 for z/os Stored Procedure support in Data Server Manager

SQL Server Security. Marek

1Z0-526

DB2 Stored Procedure and UDF Support in Rational Application Developer V6.01

MOC 6232A: Implementing a Microsoft SQL Server 2008 Database

IZ0-144Oracle 11g PL/SQL Certification (OCA) training

DATA AND SCHEMA MODIFICATIONS CHAPTERS 4,5 (6/E) CHAPTER 8 (5/E)

COSC344 Database Theory and Applications. Lecture 11 Triggers

6232B: Implementing a Microsoft SQL Server 2008 R2 Database

User's Guide c-treeace SQL Explorer

DB2. Developing SQL and External Routines. DB2 Version 9 SC

WHEN is used to specify rows that meet a criteria such as: WHEN (EMP_SALARY < 90000). SELECT and SUBSET are invalid clauses and would cause an error.

Managing Data. Copyright 2004, Oracle. All rights reserved.

Oracle EXAM - 1Z Oracle Database 11g: Program with PL/SQL. Buy Full Product.

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Index. NOTE: Boldface numbers indicate illustrations or code listing; t indicates a table. 341

VerifiedDumps. Get the Valid and Verified Exam Questions & Answers Dump for 100% Pass

Misc. Triggers Views Roles Sequences - Synonyms. Eng. Mohammed Alokshiya. Islamic University of Gaza. Faculty of Engineering

Sql Server 'create Schema' Must Be The First Statement In A Query Batch

Oracle Architectural Components

PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL)

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Ebook : Overview of application development. All code from the application series books listed at:

UNIT-IV (Relational Database Language, PL/SQL)

Emergency Bug Fixes (9.7.0)... 1 Fixed Limitations (9.7.0)... 2 Known Limitations (9.7.0)... 3 Informatica Global Customer Support...

C Exam Questions Demo IBM. Exam Questions C


Lesson 8 Transcript: Database Security

CA Performance Center

1Z0-630 Questions & Answers

TestsDumps. Latest Test Dumps for IT Exam Certification

ADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine.

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Teradata. This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries.

Transcription:

Working with Databases and Database Objects - Answers 44. The correct answer is D. In order to access a remote database from a client workstation, the database must be cataloged in the system database directory of both the client and the server and the server workstation must be cataloged in the client's node directory. (The entry in the node directory tells the DB2 Database Manager how to connect to the server to get access to the database stored there.) Because the information needed to connect to DRDA host databases is different from the information used to connect to LAN-based databases, information about remote host or iseries databases is kept in a special directory known as the Database Connection Services (DCS) directory. If an entry in the DCS directory has a database name that corresponds to the name of a database stored in the system database directory, the specified Application Requester (which in most cases is DB2 Connect) can forward SQL requests to the database that resides on a remote DRDA server. The contents of the DCS directory file can be viewed by executing the LIST DCS DIRECTORY command. If there is no record for a zseries or iseries database in the DCS directory, no database connection can be established. 45. The correct answer is D. In order to access a remote database on a z/os server, the database must be cataloged in the system database directory of the client, the server must be cataloged in the client's node directory, and an entry for the database must exist in the DCS directory. Answer D illustrates the proper way to catalog the server, the DCS database, and create a corresponding entry for the DCS database in the system database directory. 46. The correct answer is D. The correct syntax for the CATALOG DATABASE command is: CATALOG [DATABASE DB] [DatabaseName] <AS [Alias]> <ON [Path] AT NODE [NodeName]> <AUTHENTICATION [AuthenticationType]> <WITH "[Description]"> where: DatabaseName Identifies the name that has been assigned to the database to be cataloged. Alias Identifies the alias that is to be assigned to the database when it is cataloged. Path Identifies the location (drive and/or directory) where the directory hierarchy and files associated with the database to be cataloged are physically stored. NodeName Identifies the node where the database to be cataloged resides. The node name specified should match an entry in the node directory file (i.e., should correspond to a node that has already been cataloged). AuthenticationType Identifies where and how authentication is to take place when a user attempts to access the database. The following values are valid for this parameter: SERVER, CLIENT, SERVER_ENCRYPT, KERBEROS TARGET PRINCIPAL [PrincipalName] (where PrincipalName is the fully qualified Kerberos principal name for the target server), DATA_ENCRYPT, and GSSPLUGIN.

Description A comment used to describe the database entry that will be made in the database directory for the database to be cataloged. The description must be enclosed by double quotation marks. 47. The correct answer is A. The system catalog tables are used to keep track of information like database object definitions, database object dependencies, database object privileges, column data types, and table constraints. In most cases, the complete characteristics of a database object are stored in one or more system catalog tables when the object is created. However in some cases, such as when triggers and constraints are defined, the actual SQL used to create the object is stored instead. Characteristics of views, not the SQL used to create them, are stored in the system catalog tables. 48. The correct answer is B. The Control Center and the Configuration Assistant provide visual tools for cataloging databases while the CATALOG DATABASE command can be executed from the Command Line Processor. Since the CATALOG DATABASE command is a command and not an SQL statement, it cannot be issued from the SQL Assist utility. 49. The correct answer is B. A scalar user-defined function would be the best option for the requirements outlined in answer A; an UPDATE trigger and a DELETE trigger that inserts records into an activity table every time update and delete operations are performed on a table containing sensitive data would be the best way to accomplish the requirements outlined in answer C; and an identity column or sequence could be used to address the requirements shown in answer D. 50. The correct answer is A. If the UNIQUE clause is specified when the CREATE INDEX statement is executed, rows in the table associated with the index will not have two or more occurrences of the same values in the set of columns that make up the index key. Furthermore, the creation of an index provides a logical ordering of the rows of a table so in this example, rows inserted into the ORDERS table will be ordered ORDER_NUM values, in ascending order. 51. The correct answers are C and E. An alias is simply an alternate name for a table or view. (Aliases can also be created for nicknames that refer to tables or views found on federated systems.) Once created, an alias can be referenced the same way the table or view the alias refers to can be referenced. 52. The correct answer is A. A trigger can be activated whenever an insert, update, or delete operation is performed against the subject table that is associated with the trigger. 53. The correct answer is D. Although a view looks like a base table, it does not exist as a table in physical storage; therefore, it does not contain data. Instead, a view refers to data that is stored in other base tables so data stored in the EMPLOYEE table would not be copied to view V1. 54. The correct answer is C. An alias is an alternate name for a table or view; therefore, it is possible to create an alias named T1 for the table TABLE1, and it is possible to create an alias named T1 for a view named V1. Views are used to provide a different way of looking at the data stored in one or more base tables. Schemas, on the other hand, are used to logically group data; therefore, a schema named T1 could be used to group aliases and views that reference table TABLE1, but it could not be used to provide access to the data stored in table TABLE1. 55. The correct answer is A. Sequences, identity columns, and triggers can be used to automatically generate values for columns. However, only sequences can be referenced in an INSERT statement. 56. The correct answer is C. The first VALUES statement executed by user USER1 will return the value 10; the second will return the value 20. The ALTER statement changes

the behavior of the sequence and the VALUES statement executed by user USER2 will return the value 5. When user USER3 executes queries the database to obtain the next sequence number, the value 30 is returned. Why? Because when user USER2 obtained a value from the sequence, four more values were generated and cached since a cache value of 5 was specified for the sequence. Since an increment value of 5 was also used, the numbers cached were: 10, 15, 20, and 25. But none of the cached values were usedthey were discarded when user USER2 terminated his database connection. Then, when user USER3 queried the sequence for the next number available, he received the number 30 because that was, in fact, the next number in the sequence. 57. The correct answer is C. The statement "INSERT INTO view2 VALUES(150, 'abc')" will fail because the value 150 is greater than 100; because view VIEW2 was created with the WITH CASCADED CHECK OPTION specified, the "WHERE c1 < 100" clause used to create view VIEW1 became a constraint that is used to validate insert and update operations that are performed against view VIEW2 to ensure that all rows inserted into or updated in the base table the view refers to conform to the view's definition. 58. The correct answer is D. Each time a record is inserted into table T1, trigger TRIG1 is fired and a record is written to the table T1AUDIT. If both tables were queried after the update operation completes, the results would look something like this: SELECT * FROM t1 C1 C2 ---------------- 1 ghi 2-2 record(s) selected. SELECT * FROM t1audit USER DATE ACTION --------------------------------------------------- RSANDERS 01/20/2007 Insert RSANDERS 01/20/2007 Insert 2 record(s) selected. In order to track update and delete operations performed against table T1, similar UPDATE and DELETE triggers would need to be created. 59. The correct answer is B. Unlike base tables, whose descriptions and constraints are stored in the system catalog tables of the database to which they belong, declared temporary tables are not persistent and can only be used by the application that creates them-and only for the life of the application. When the application that creates a declared temporary table terminates, the rows of the table are deleted, and the description of the table is dropped. (However, data stored in a temporary table can exist across transaction boundaries.) Another significant difference focuses on naming conventions: Base table names must be unique within a schema, but because each application that defines a declared temporary table has its own instance of that table, it is possible for many applications to create declared temporary tables that have the same name. 60. The correct answer is B. A package is an object that contains the information needed to process SQL statements associated with a source code file of an application program. When an Embedded SQL source code file is precompiled, a corresponding package that contains, among other things, the access plans that will be used to process each SQL statement embedded in the source code file is produced. (Access plans contain optimized information that the DB2 Database Manager uses to execute SQL statements.) This

package must reside in a DB2 database that contains the data objects referenced by the package before the corresponding application can be executed against that database. The process of creating and storing a package in a DB2 database is known as "binding," and by default, packages are automatically bound to a database during the precompile process. Schemas provide a logical grouping of database objects; the system catalog describes the objects in a DB2 database and their relationship to each other; and Multi-dimensional Clustering Tables (MCDs) may be used during query optimization to improve the performance for a subset of SELECT queries. 61. The correct answer is C. In this case, both the node and the database must be cataloged by executing the CATALOG NODE and CATALOG DATABASE commands. Answer C is the only answer that uses the correct syntax for these two commands. 62. The correct answer is B. Declared temporary tables are used to hold temporary data on behalf of a single application and are automatically destroyed when the application that declared them disconnects from the database. Declared temporary tables are not used for backup purposes, to save data for load operations, or to share result data sets between applications. 63. The correct answer is D. Routines are a type of database object that you can use to encapsulate logic that can be invoked like a programming sub-routine. There are many different types of routines available; routines can be grouped in different ways, but are primarily grouped by their system or user definitions, by their functionality, and by their implementation. The supported routine definitions are: System-defined routines User-defined routines The supported functional types of routines are: Procedures (also called stored procedures) Functions Methods The supported routine implementations are: Built-in routines Sourced routines SQL routines External routines 64. The correct answer is A. Views can be used to restrict access to columns in a base table that contain sensitive data, views can be used to store queries that multiple applications execute on a regular basis in a database, and views support INSTEAD OF triggers. Aliases are publicly referenced names that require no special authority or privilege to use. 65. The correct answer is C. A distinct data type is a user-defined data type that is derived from one of the built-in data types available with DB2. Although a distinct data type shares a common internal representation with a built-in data type, it is considered a separate data type that is distinct from any other data type (hence, the "distinct" in the name). Distinct user-defined data types can be created by executing the CREATE

DISTINCT TYPE SQL statement. The basic syntax for this statement is: CREATE DISTINCT TYPE [TypeName] AS [SourceDataType] <WITH COMPARISONS> where: TypeName Identifies the name that is to be assigned to the distinct data type to be created. SourceDataType Identifies the built-in data type that the distinct data type to be created is to be based on. Thus, if you wanted to create a distinct data type to store EURO data, you could do so by executing an SQL statement like that in answer C.