db2常见考试命令应用考试题
数据库DB2认证考题真题及参考答案
1.Which of the following options best describes a domain found in the table below?从下表中,哪一选项正确的描述了域?CREATE TABLE EMPLOYEE (ID INTEGER NOT NULL,NAME VARCHAR(30) NOT NULL,EXTENSION INTEGER NOT NULL,MANAGER VARCHAR(30) NOT NULLPRIMARY KEY (ID));TERMINATE;ID NAME EXTENSION MANAGER1 John S 53412 Y2 Susan P 54123 N3 Jennifer L 51234 NA. Manager Domain = (N)B. Name Domain = (Set of all Possible Names)C. Extension Doman = (53412)D. ID Domain = (1, 2, 3)答案:B2.Which of the following statements best describes the XML Regions Index in DB2?下列哪个陈述最好的描述了DB2中的XML区域索引?A. The Regions Index is a descriptor for referencing large objects in the LOB storage area.B. The Regions Index is a new type of XML index available in DB2 9.7.C. The Regions Index facilitates access to document regions in the XML data area.区域索引,有助于文档区域中的XML数据区的访问D. The Regions Index can be compressed by issuing an offline reorg operation on the table.答案:C3. What is the purpose of a DB2 Access Plan?什么是一个DB2存取计划的目的?A. SQL developers can define Access Plans to tell DB2 the best way to retrieve the data from a SQL queryB. Describes the order of operations to access data necessary to execute a SQL or XQuery statement 描述运算次序,访问必要的数据去执行SQL或者XQuery的语句C. To replicate data between a DB2 database and relational databases from other vendorsD. To visually construct complex DML statements and examine the results of their execution答案:B4. Given the following UPDATE statement:UPDATE employees SET workdept =(SELECT deptno FROM department WHERE deptno = 'A01')WHERE workdept IS NULLWhich of the following describes the result if this statement is executed?如果上面的语句被执行,下面哪一个选项是正确的?A. The statement will fail because an UPDATE statement cannot contain a subqueryB. The statement will only succeed if the data retrieved by the subquery does not contain multiple records 语句可能成功如果子查询不包含多条记录的情况下。
AIX、WAS、DB2测试题
西南区培训测试题(2013年11月15日)-aix、was、db2 本次考试全部为填空题,每题1.5分,共100分本次考试,为本次培训所包含的所有内容。
、考试时间:16:00-17:30注:请由红色字体作答--------------------------------------------------------------------------------------------1、如何查看AIX系统中用户的配置文件____________________2、如何查看AIX系统中用户组的配置文件____________________3、如何查看AIX系统资源使用情况____________________4、如何查看AIX系统中文件系统的使用情况____________________5、请简要概述LVM中VG代表什么____________________、PV代表什么____________________、PP代表什么____________________、LP代表什么____________________、LV代表什么____________________6、如何查看AIX系统中的物理磁盘____________________7、如何查看AIX系统中rootvg空间使用情况____________________8、如何查看AIX系统中系统的启动顺序____________________9、如何查看AIX系统中rootvg中包含哪些逻辑卷____________________10、如何查看AIX系统中rootvg包含哪些物理卷以及物理卷使用情况____________________11、如何查看AIX系统中当前激活的卷组____________________12、如何查看AIX系统中所有的卷组____________________13、如何查看AIX系统的内核位数____________________14、如何修复AIX系统中受损的文件系统____________________15、如何在AIX系统中挂载光盘文件____________________16、如何通过命令查看AIX服务器上ent0网口是否插网线____________________)17、如何查看AIX系统中的网络接口信息____________________18、AIX系统中启动和关闭卷组的命令____________________19、AIX系统中导出、导入卷组的命令____________________20、AIX系统中查看可用磁盘信息____________________21、AIX系统中查看换页空间大小及当前使用情况____________________22、请列举重启AIX服务器的常用命令____________________23、AIX系统中创建磁盘镜像的命令____________________24、如何在操作系统下编译存储过程____________________25、如何在操作系统下调用存储过程____________________26、如何在操作系统下执行sql脚本____________________27,AIX系统中创建目录、文件的命令____________________28、查看AIX系统中实际的物理内存大小____________________29、查看AIX系统中所有物理设备的详细信息____________________30、如何查看后台运行的任务以及将该任务调入前台运行的命令____________________31、查看AIX系统版本及db2数据库版本的命令____________________32、AIX系统中查看所有网络接口吞吐信息____________________33、AIX系统中查看路由信息____________________34、AIX系统中查看所有服务的状态____________________35、AIX系统中启动、停止子系统服务的命令____________________DB2试题:(每题4分,共100分)36、查看db2数据库版本的命令是_________37、DB2有哪些版本(列举几个)_____________________38、DB2中每一个实例只能创建一个数据库,是否正确_________39、启动DB2实例的命令是______________,停止DB2实例的命令是_________________40、查看DB2实例的配置信息,命令是_______________________________查看某个数据库的配置信息,命令是_______________________________ 41、当发现DB2表空间满时,采取的处理方法________________________42、在启动was和db2时的顺序是__________________________停止was和db2时的顺序是___________________________43、查看表空间信息的命令是___________________________44、查看表空间容器信息的命令是_______________________45、两个表空间状态一个处于0x0080状态,另一个处于0x0000状态,哪个状态是正常的_______________46、命令行下,连接数据库的方法_________________________________命令行下断开数据库的方法_________________________________47、列出节点编目,命令是_________________________________列出数据库编目,命令是_______________________________48、列出数据库中的表,命令是_____________________________49、删除表tb1,命令是__________________________________删除表tb1的数据,命令是______________________________50、查看表tb1索引,命令是______________________________51、把表HTTP_REQUEST_LOG导出到HTTP_REQUEST_LOG、ixf文件的方法是_________________________________________52、数据完全备份有2种方式,离线备份和在线备份,两者的区别是___________________________________________53、在做db2在线备份时,db2 v8、1版本是否支持include logs选项_______________,include logs选项是做什么用的________________________54、查看db2备份情况的命令是_____________________________________55、归档日志清理的清理思路和方法是____________________________________56、db2 v8版本为什么要经常做runstat__________________________________57、如何查看db2数据库的连接状态_____________________________58、db2出现问题故障时,经常查看的日志是哪个____________________59、错误代码信息可以帮助我们对当前问题做出大体判断,现有一个报错为SQL1036C,如何查看出这个代码的相关信息,命令是_______________________ 60、db2活动日志,能否删除____________________,若误删除后,后果是_______________________61、使用____________________命令可以查看WAS版本。
db2数据库面试题
db2数据库面试题一、概述DB2数据库是IBM公司开发的一种关系型数据库管理系统。
在DB2数据库的面试过程中,常常会遇到各种各样的问题。
本文将为您总结一些常见的DB2数据库面试题,帮助您更好地准备面试,并提供详细的解答。
本文将从DB2数据库的基本知识、SQL查询、性能调优等方面展开讨论。
二、基本知识1. 什么是DB2数据库?DB2数据库是IBM开发的一种关系型数据库管理系统,它提供了完整的数据库管理和数据操作功能,并支持SQL查询语言。
2. DB2数据库的特点是什么?DB2数据库具有以下特点:- 跨平台性:DB2可以在不同的操作系统和平台上运行,如Windows、Unix、Linux等。
- 具备高可用性:DB2支持数据备份、恢复和高可用性机制,确保数据的安全性和可靠性。
- 扩展能力强:DB2可以支持大规模的数据和用户,并提供有效的扩展机制。
- 性能优越:DB2采用了先进的查询优化技术,能够提供高效的数据检索和处理能力。
- 安全性强:DB2提供了完善的权限管理和安全机制,保证数据的机密性和完整性。
3. DB2数据库的体系结构是什么样的?DB2数据库的体系结构包括以下几个层次:- 应用层:应用程序通过数据库连接器与DB2数据库进行通信。
- SQL层:处理SQL查询,包括查询优化、执行计划生成等。
- 缓冲池管理器(Buffer Pool Manager):管理数据缓存和页面置换。
- 存储管理器(Storage Manager):管理数据的存储和检索。
- 锁管理器(Lock Manager):管理并发访问和资源锁定。
- 日志管理器(Log Manager):管理事务日志的生成和恢复。
4. DB2数据库的对象包括哪些?DB2数据库的主要对象包括表(Table)、视图(View)、索引(Index)、触发器(Trigger)、存储过程(Stored Procedure)等。
三、SQL查询1. 如何创建一个表?在DB2数据库中,可以使用CREATE TABLE语句来创建一个表,语法如下:CREATE TABLE table_name (column1 datatype1 constraint,column2 datatype2 constraint,...);其中,table_name为表名,column1、column2为列名,datatype1、datatype2为列的数据类型,constraint为列的约束条件(如主键、外键等)。
DB2 试题
What are the entities used to model data in the Relational Model?^^^^A. A collection of instances of entities.^^^^B. Relations, attributes and tuples^^^^C. A collection of instances of record types.^^^^D. Table, rows and columns}Which of the following is true about Relational Databases?^^^^A. A column can store values of different data types.^^^^B. A table consists of columns and rows.^^^^C. Rows in the same table can have a different set of columns.^^^^D. Rows are also known as fields of the table.}A company has a large amount of data to store and wants to be able to do the following with the data:Have a standard interface for accessing the data.Have multiple users with the ability to insert, update and delete data.Make changes to the data without risk of losing data and its consistency.Have the capability to handle huge volumes of data and users.Have tools for data backup, restore and recovery.What data storage method is the most optimal solution for the company?^^^^A. Text files^^^^B. Comma delimited data files^^^^C. Spreadsheets^^^^D. Database}When using a Relational Database, which of the following does not apply?^^^^A. Accesses data using Data Manipulation Language (DML) such as SQL.^^^^B. Define your database schema using a Data Definition Language (DDL).^^^^C. Data is stored in a hierarchical model.^^^^D. You can use normalization to avoid redundant data in your tables.}Which of the following is not true about the Information Model?^^^^A. Abstract management of objects at a conceptual level.^^^^B. Defines relationships between managed objects.^^^^C. It is a group of descriptions explaining objects of a data model.^^^^D. Data models can be used to map an Information Model to a software implementation.}Which Data Model was created with the focus of providing better data independence ? ^^^^A. Relational^^^^B. Hierarchical^^^^C. Semantic^^^^D. Network}Which of the following is NOT true about columns?^^^^A. Each column consists of one or more fields^^^^B. Each column contains a specific type of information^^^^C. Columns must be designated a specific data type^^^^D. Columns are also known as fields}Which of the following is true about columns?^^^^A. Each column consists of one or more records^^^^B. Columns are where the individual pieces of information are stored for each record^^^^C. Columns must be designated a specific data type^^^^D. Columns are also known as records}You are tasked with designing a model that can be used by the software developer to implement a given application. Which of the following is NOT true about your model?^^^^A. The model is a low level of abstraction with concrete and detailed design.^^^^B. The model includes specific implementation and protocol details.^^^^C. The model should define relationships between the managed objects.^^^^D. The model being designed is an Information Model.}Using DB2’s CLP , to access a remote database for the first time, it is necessary to:^^^^A. First catalog the remote system or node, and then catalog the database within the remote node^^^^B. First register the remote system user in the system catalog, and then setup a SSH communication to the remote node^^^^C. DB2 cannot use databases in remote systems unless SYSADM authority is granted to the local user^^^^D. First list all the remote databases with the db2 list database directory command, and then select the remote database from the list}Which of the following statements is not true regarding Table Spaces on DB2?^^^^A. A Table Space is a logical object in between logical table and physical containers^^^^B. All tables, indexes, and other data are stored in a table space^^^^C. A Table Space is a logical object required to store data, indexes and tables in temporary memory^^^^D. A Table Space is always associated to a Buffer Pool}Assuming that you are currently connected to TESTDB, which of the following will allow the view of the database settings with details?^^^^A. db2 get db cfg with detail^^^^B. db2 get db cfg show detail^^^^C. db2 get dbm cfg with detail^^^^D. db2 get dbm cfg show detail}(实例级)Which of the following commands would delete the SAMPLE database?^^^^A. db2 drop sample^^^^B. db2 delete database sample^^^^C. db2 drop sample db^^^^D.db2 drop database sample}What is the purpose of a DB2 Access Plan?^^^^A. SQL developers can define Access Plans to tell DB2 the best way to retrieve the data from a SQL query^^^^B. Describes the order of operations to access data necessary to execute a SQL or XQuery statement^^^^C. To replicate data between a DB2 database and relational databases from other vendors^^^^D. To visually construct complex DML statements and examine the results of their execution}How does automatic storage work in DB2?^^^^A. Automatic storage simplifies storage management by allowing you to specify storage paths where the database manager can place table space data, and where the database manager allocates space for various uses.^^^^B. Automatic storage is an option which is set when you create a DB2 database. It allows transactions that are written to the database to be automatically committed.^^^^C. Automatic storage is a function of DB2 that allows tables to be backed up automatically on a set schedule.^^^^D. Automatic Storage can be used to automatically reorganize the data on the physical media in order to improve performance.}Which of the following is the lowest cost DB2 product that can be legally installed on a Linux server that has 2 CPUs?^^^^A. DB2 Express Edition^^^^B. DB2 Enterprise Server Edition^^^^C. DB2 Everyplace^^^^D. DB2 Workgroup Server Edition}You were assigned the task of importing a large amount of data into a DB2 database. Considering you must have logged information about the rows imported and that you want to perform the load as fast as possible, which of the tools would you be the best choice for the job?^^^^A. DB2 INSERT^^^^B. DB2 IMPORT^^^^C. DB2 LOAD^^^^D. DB2 CLP}Which of the following is the lowest cost DB2 product that can be legally installed on a windows server that has 4 CPUs capable of performing row compression?^^^^A. DB2 Express Edition^^^^B. DB2 Workgroup Edition^^^^C. DB2 Express-C Edition^^^^D. DB2 Enterprise Edition }Which of the following is true about a well-formed XML document?^^^^A. Has one or more root nodes^^^^B. Tags can have at most one attribute^^^^C. Always has a single document node^^^^D. End tags are optional}Which of the following is a well-formed XML document?^^^^A. <Name xmlns="htpp://" Gender="MALE"> <FirstName>Amitabh</FirstName><LastName>Patel</LastName></Name>^^^^B. <Name xmlns="" MALE="Gender"> <FirstName>Amitabh</FirstName><LastName>Patel</LastName></name>^^^^C. <Name Gender="MALE"><FirstName>Amitabh <LastName>Patel</FirstName> </LastName></Name>^^^^D. <Name Gender=FEMALE><FirstName>Jaya</FirstName><LastName>Patel</LastName></Name>}What is SQL/XML?^^^^A. SQL/XML is a communication protocol for DB2 databases^^^^B. A.SQL/XML is part of the XQuery standard and provides various publishing functions to transform XML data into relational form and vice versa^^^^C. SQL/XML is a language that provides various publishing functions to transform XML data into relational form and vice versa^^^^D. SQL/XML is an extension to SQL standard and provides various publishing functions to transform XML data into relational form and vice versa}Which of the following is not part of the XQuery FLWOR expression:^^^^A. FOR clause^^^^B. LET clause^^^^C. ORDER BY clause^^^^D. WITH clause}Consider the following XML document:<customerinfo><name>John Smith</name><addr country="Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type="work">963-289-4136</phone></customerinfo>Consider the following UPDATE expression:update xmlcustomerset info = xmlquery( 'transformcopy $new := $imodify (do insert <phone type="cell">777-555-3333</phone> after $new/customerinfo/addr,for $j in $new/customerinfo/addr/phonereturn do rename $j as "telephone")return $new' passing info as "i")where cid = 1000;Which of the following represents the XML document after the TRANSFORM expression has been executed:^^^^A. <customerinfo><name>John Smith</name><addr country=“Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type=“cell">777-555-3333</phone><phone type="work">963-289-4136</phone> </customerinfo>^^^^B . <customerinfo><name>John Smith</name><addr country=“Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type=“cell">777-555-3333</phone><telephone type="work">963-289-4136</telephone> </customerinfo>^^^^C. <customerinfo><name>John Smith</name><addr country=“Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type=“cell">777-555-3333</phone><telephone type="work">963-289-4136</telephone> </customerinfo>^^^^D. <customerinfo><name>John Smith</name><addr country=“Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip><phone type=“cell">777-555-3333</phone></addr><telephone type="work">963-289-4136</telephone></customerinfo>Which of the following is an XML-based language for transforming XML documents?^^^^A. XHTML^^^^B. XSLT^^^^C. HTML^^^^D. Java}Which of the following properties is related to the fact that a committed transaction guarantees that all of the operations are completed and in a roll backed transaction the effect of all operations are reverted?^^^^A. Consistency^^^^B. Atomicity^^^^C. Isolation^^^^D. Durability}Which of the following best define what a transaction is?^^^^A. A sequence of one or more SQL operations grouped together, also known as a single unit of work^^^^B. A set of independent operations that can be executed in parallel^^^^C. A data isolation level that can help prevent deadlocks by allowing reads on previously committed data.^^^^D. An object of a DB2 database}Which of the following statements is FALSE about transactions?^^^^A. Operations inside a transaction are executed in parallel.^^^^B. Only 1 COMMIT statement can be executed inside the same transaction. --- ?^^^^C. Transactions guarantee atomicity of a group of operations.^^^^D. A ROLLBACK or COMMIT statement finalizes a transaction. }Application B wants to read a subset of rows from table EMPLOYEE multiple times inside the same transaction. Which isolation level should be used in order to guarantee that every time the same set of rows is returned?^^^^A. Currently Committed^^^^B. Read Stability^^^^C. Repeatable Read^^^^D. Uncommitted Read}A Dirty Read occurs when?^^^^A. A transaction read the same row of data twice and returns different data values with each read^^^^B. A search based on some criterion returns additional rows after consecutive searches during a transaction^^^^C. Uncommitted data is returned, but the transaction that originated them was rolled back^^^^D. Two transactions read and then attempt to update the same data, the secondupdate will overwrite the first update before it is committed}How can an application modify the isolation level of operations running against a DB2 database?^^^^A. Isolation level can be changed for a particular SQL statement.^^^^B. Isolation level can only be changed for the whole user session and all operations in that session will be affected.^^^^C. Isolation level to be used can be specified when executing the COMMIT operation.^^^^D. Isolation level is determined at the moment an application connects to the database. To change the isolation level, an application is required to create a new connection specifying the desired level.}Consider the following scenario. You have 3 tables with the same name (TABLE_1) under 3 different schemas (SYSIBM, DEFAULT and DB2INST1). You are connected to a DB2 database in your Linux server as db2inst1 and issue the following statement:SELECT * FROM table_1Which table will you be selecting data from:^^^^A. You get an error because your query is ambiguous, as the table schema is not specified^^^^B. SYSIBM.table_1^^^^C. DEFAULT.table_1^^^^D. DB2INST1.table_1}Which of the following is NOT a supported type of trigger?^^^^A. AFTER^^^^B. BEFORE^^^^C. DURING^^^^D. INSTEAD OF}When attempting to establish a connection to a database residing on your local machine, which command can help you determine why the following message was displayed:SQL1013N The database alias name or database name "SAMPLE" could not be found. SQLSTATE=42705^^^^A. list database directory^^^^B. list admin node directory^^^^C. list node directory^^^^D. list dcs directory}Which of the following is FALSE about views?^^^^A. Do not contain real data^^^^B. Any view can be updated, independent of its definition^^^^C. When changes are made to data through a view, the data is changed in the underlying table^^^^D. Can be used interchangeably with tables when retrieving data}Given the options below, which of the following statements can add records to a table?^^^^A. ADDREC^^^^B. ADDRECORD^^^^C. INSERT^^^^D. ADD}Consider the following command:CREATE TABLESPACE MYTBSP1 MANAGED BY AUTOMATICWhat will the command result in?^^^^A. Creation of a normal table space called mytbsp1 that is managed automatically ^^^^B. Creation of a user table space called mytbsp1 that is managed automatically.^^^^C. Creation of a temporary table space called mytbsp1 that is managed automatically.^^^^D. This command will return an error to the user.}What is authorization?^^^^A. Authorization is a process that checks whether you have sufficient privileges to perform the desired database operation^^^^B. Authorization is the process where the DBA gathers information to see who will have access to the database^^^^C. Authorization is the process where the DB2 database checks with Windows security to see if you have access to the DB2 database^^^^D. Authorization is a process that validates that you are who you claim to be by verifying your user ID and password}Which of the following statements grants user John the ability to insert data to table tab1?^^^^A. GRANT ADD ON TABLE tab1 TO John^^^^B. GRANT INSERT ON TABLE tab1 TO John^^^^C. GRANT ADD ON TABLE tab1 TO USER John^^^^D. GRANT INSERT ON TABLE tab1 TO USER John}Assume a table which contains the following columns:EMP_IDEMP_NAMEPHONEEMAILSALARYWhich of the following is the simplest way to restrict users from viewing SALARY information, while still allowing them to see the other values?^^^^A. Encrypt the table's data^^^^B. Create a view that does not contain the SALARY column. Grant access to the view and revoke access from the original table^^^^C. Revoke SELECT access for the SALARY column from users who should not see SALARY data^^^^D. Store SALARY data in a separate table and grant SELECT privilege for that table to the appropriate users}What is a Trusted Context?^^^^A. It is a special area in a buffer pool that can be written only by a selectedset of users.^^^^B. It is a DB2 capability that allows applications to change users without breaking the connection to the database.^^^^C. It is a DB2 capability that allows users to establish a connection to the database without providing user name or password.^^^^D. It is a type of container in a table space that allows faster I/O operations.}After the following SQL statement is executed:GRANT ALL PRIVILEGES ON TABLE student TO USER user1Assuming user USER1 has no other authorities or privileges, which of the following actions is USER1 allowed to perform?^^^^A. Grant all privileges on table STUDENT to other users^^^^B. Drop a view associated to the table STUDENT^^^^C. Drop the table STUDENT^^^^D. None of the above}When a user is connected to a database, which of the following privileges is required for the user to use a package?^^^^A. BIND^^^^B. BINDADD^^^^C. EXECUTE^^^^D. USE}Which of the following best describes what an incremental cumulative backup is? ^^^^A. Backup all of the data that has changed since the last successful full ordelta backup^^^^B. Backup of a single table space^^^^C. Backup of the entire database^^^^D. Backup all of the data that has changed since the last full backup}Which of the following is a tool to configure automatic database backup?^^^^A. Configure Automatic Maintenance wizard^^^^B. Design Advisor^^^^C. Explain tool^^^^D. EXPORT utility}Which of the following options will perform an offline table space recovery? ^^^^A. RESTORE DATABASE SAMPLE TABLESPACE (MYTBSP) OFFLINE FROM /tbspbkp^^^^B. RESTORE DATABASE SAMPLE TABLESPACE (MYTBSP) FROM /tbspbkp^^^^C. RESTORE DATABASE SAMPLE TABLESPACE (MYTBSP) ONLINE FROM /tbspbkp^^^^D. There is no option to restore a table space in DB2}In embedded SQL code, which of the following is true about delimiters ?^^^^A. Used by the OS to delimit system variable declaration^^^^B. Used by the database to indicate the end of a column^^^^C. Used by compiler to indicate the end of the program^^^^D. Used by PRECOMPILER to identify SQL statements to be translated}Which of the following programming languages can be used to develop UDFs ?^^^^A. Java, Javascript, SQL^^^^B. C/C++, Java, .Net languages^^^^C. SQL, C# .Net, Perl^^^^D. Perl, C/C++, SQL}Which of the following is true about Dynamic SQL?^^^^A. It is precompiled and binded in dynamic databases^^^^B. The structured of an SQL statement must be completely specified at precompile time.^^^^C. It is compiled and executed by an application at run-time.^^^^D. Dynamic SQL does not exist}Which of the following DB2 client/driver packages is NOT suitable for developing ODBC applications?^^^^A. IBM Data Server Client^^^^B. IBM Data Server Driver for ODBC and CLI^^^^C. IBM Data Server Runtime Client^^^^D. IBM Data Server Driver Package}Considering the SQL statement below, which option best describes what APP.TAX is: SELECT APP.TAX(SALARY) FROM EMPLOYEE^^^^A. User Defined Function^^^^B. Stored Procedure^^^^C. Trigger^^^^D. User Defined Type}Which of the following objects you would need to create in order to execute a block of code every time table TB1 is updated.^^^^A. An AFTER trigger^^^^B. A UDF^^^^C. A Stored Procedure^^^^D. An User Defined Type}Given the following two tables:NAMES---------------------------NAME NUMBER---------- -------Wayne Gretzky 99Jaromir Jagr 68Bobby Orr 4Bobby Hull 23Mario Lemieux 66POINTS----------------------------NAME POINTS---------- -------Wayne Gretzky 244Bobby Orr 129Brett Hull 121Mario Lemieux 189Joe Sakic 94How many rows would be returned using the following statement? SELECT * FROM names, points^^^^A. 0^^^^B. 5^^^^C. 10^^^^D. 25}Given the following two tables:TAB1------------------COL_1 COL_2----- -----A 10B 12C 14TAB2-------------------COL_A COL_B----- -----A 21C 23D 25Assuming the following results are desired:COL_1 COL_2 COL_A COL_BA 10 A 21B 12 - -C 14 C 23- - D 25Which of the following joins will produce the desired results?^^^^A. SELECT * FROM tab1 INNER JOIN tab2 ON col_1 = col_a^^^^B. SELECT * FROM tab1 LEFT OUTER JOIN tab2 ON col_1 = col_a ^^^^C. SELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON col_1 = col_a ^^^^D. SELECT * FROM tab1 FULL OUTER JOIN tab2 ON col_1 = col_a}Given the following table:TAB1-------------------COL1 COL2----- -----A 10B 20C 30A 10D 40C 30Assuming the following results are desired:TAB1-------------------COL1 COL2----- -----A 10B 20C 30D 40Which of the following statements will produce the desired results?^^^^A. SELECT UNIQUE * FROM tab1^^^^B. SELECT DISTINCT * FROM tab1^^^^C. SELECT UNIQUE(*) FROM tab1^^^^D. SELECT DISTINCT(*) FROM tab1}Given the following table:CURRENT_EMPLOYEES-----------------------------EMPID INTEGER NOT NULLNAME CHAR(20)SALARY DECIMAL(10,2)PAST_EMPLOYEES-----------------------------EMPID INTEGER NOT NULLNAME CHAR(20)SALARY DECIMAL(10,2)Assuming both tables contain data, which of the following statements will NOT successfully add data to table CURRENT_EMPLOYEES?^^^^A. INSERT INTO current_employees (empid) VALUES (10)^^^^B. INSERT INTO current_employees VALUES (10, 'JAGGER', 85000.00)^^^^C. INSERT INTO current_employees SELECT empid, name, salary FROM past_employees WHERE empid = 20^^^^D. INSERT INTO current_employees (name, salary) VALUES (SELECT name, salary FROM past_employees WHERE empid = 20)}Given the following UPDATE statement:UPDATE employees SET workdept =(SELECT deptno FROM department WHERE deptno = 'A01')WHERE workdept IS NULLWhich of the following describes the result if this statement is executed?^^^^A. The statement will fail because an UPDATE statement cannot contain a subquery^^^^B. The statement will only succeed if the data retrieved by the subquery does not contain multiple records --- why^^^^C. The statement will succeed; if the data retrieved by the subquery contains multiple records, only the first record will be used to perform the update^^^^D. The statement will only succeed if every record in the EMPLOYEES table has a null value in the WORKDEPT column}Given the following table definition:SALES--------------------------SALES_DATE DATESALES_PERSON CHAR(20)REGION CHAR(20)SALES INTEGERWhich of the following SQL statements will remove all rows that had a SALES_DATE in the year 1995?^^^^A. DELETE * FROM sales WHERE YEAR(sales_date) = 1995^^^^B. DELETE FROM sales WHERE YEAR(sales_date) = 1995^^^^C. DROP * FROM sales WHERE YEAR(sales_date) = 1995^^^^D. DROP FROM sales WHERE YEAR(sales_date) = 1995}Which of the following SQL statements can be used to remove data from table "users": ^^^^A. REMOVE TABLE users^^^^B. DROP TABLE users^^^^C. DELETE TABLE users^^^^D. ALTER TABLE users}If TAB1 is created using the following statementCREATE TABLE tab1 (col1 INTEGER NOT NULL,col2 CHAR(3),CONSTRAINT cst1 CHECK (col1 in (1, 2, 3, 4)))Which of the following statements will successfully insert a record into table TAB1? ^^^^A. INSERT INTO tab1 VALUES (0, 'a')^^^^B. INSERT INTO tab1 VALUES (NULL, 'abc')^^^^C. INSERT INTO tab1 VALUES (4, 'a')^^^^D INSERT INTO tab1 VALUES (4, 'abcdefhijklmnopq')}Given the following two tablesNAMES--------------------------------STUDENT_NAME STUDENT_NUMBER------------ ----------------Wayne Gretzky 99Jaromir Jagr 68Bobby Orr 4Bobby Hull 23Mario Lemieux 66MARKS--------------------------------NAME Marks-------- -------Wayne Gretzky 80Bobby Orr 94Brett Hull 77Mario Lemieux 83How many rows would be returned using the following statement? SELECT distinct name FROM student_names, marks^^^^A. 9^^^^B. 20^^^^C. 5^^^^D 6}这个题有点问题答案应该是 4==========================================Which of the following is not a definition of a relation?^^^^A. A relation may be thought of as a set of columns.^^^^B. Each row represents a fact that corresponds to a real-world entity or relationship^^^^C. Each row has a value of an item or set of items that uniquely identifies that row in the table^^^^D. Each column typically is called by its column name or column header or attribute name}The type of data structure that is used in a relational model is?^^^^A. Table^^^^B. Tree^^^^C. Node^^^^D. None of the above}In relational terminology, an attribute is?^^^^A. A record^^^^B. An entity^^^^C. A field^^^^D. A table}The link between a column or set of columns in one table that refers to the set of column in another table is?^^^^A. Pointer^^^^B. Cursor^^^^C. Primary key^^^^D. Foreign key}A foreign key must?^^^^A. Be defined in all tables in the database^^^^B. Match the field value of a primary key in a related table or be NULL.^^^^C. Be unique^^^^D. Be numeric}Which of the following is NOT true about data?^^^^A. Data is useful and has meaning associated to it.^^^^B. Data can be quantitative or qualitative.^^^^C. Data describes a variable or set of variables.^^^^D. Essentially data can be thought of as the result of observations based on things like measurements and statistics.}Which of the following is NOT true about Database Management Systems?^^^^A. Relational Database Management Systems use Structured Query Language to interact with databases.^^^^B. Database Management Systems act as an interface used to communicate with databases.^^^^C. Applications can choose to bypass the Database Management System when accessing databases for performance reasons.^^^^D. DB2 is a Database Management System.}A database can be used to do which of the following?^^^^A. Create a repository of data.^^^^B. Provide an organized mechanism for manipulating data.^^^^C. Provide support for data processing.^^^^D. All of the above.}Which of the following is true about the table below?CREATE TABLE EMPLOYEE (ID INTEGER NOT NULL,NAME VARCHAR(30) NOT NULL,EXTENSION INTEGER NOT NULL,MANAGER VARCHAR(30) NOT NULLPRIMARY KEY (ID));TERMINATE;ID NAME EXTENSION MANAGER1 John S 53412 Y2 Susan P 54123 N3 Jennifer L 51234 N^^^^A. ID is a value found in the EMPLOYEE table^^^^B. ID, 1, 2, 3 makes up a row in the EMPLOYEE table^^^^C. The MANAGER domain consists only of the value Y^^^^D. NAME, John S, Susan P, Jennifer L makes up a column in the EMPLOYEE table} Which of the following is NOT displayed by DB2 Access Plan?。
db2常见考试命令应用考试题
一选择题(每题1.5分,共45分)1) 下面的哪个数据库版本可以访问OS/390 上的DB2 UDB 数据库?a) DB2 Connect Personal Editionb) DB2 Universal Database Workgroup Editionc) DB2 Personal Developer's Editiond) DB2 Universal Developer's Edition2) 下面的哪个工具可以编目一个数据库信息?a) Journal 日志工具b) Alert Center 警告中心c) License Center 许可证中心d) Client Configuration Assistant 客户端配置助手3) 下面的哪个工具可以重组数据回收表中被删除的行所占有的资源?a)reorgb) db2lookc) db2moved) runstats4) USE这个特权的用途是?a) query data in a table.b) load data into a table.c) create tables within a table space.d) create table spaces within a database.5) 如果创建数据库则需要下面的哪两个权限?a) DBADMb) SYSADMc) DBCTRLd) SYSCTRLe) SYSMAINT6) 编目一个远程数据库是指:a) 在PC或者Unix 机器上执行编目,目的是为了识别DB2数据库管理器所在的服务器b) 在PC或者Unix机器上编目,目的是为了让用户和应用程序可以识别DB2数据库c) 从不在DB2中编目,仅当每个节点上的数据库被允许编目时编目,所以自动编目那个节点就可以自动编目数据库Nd) 在PC或者UNIX机器上编目是为了打开在DB2数据库中的目录表,这样当前的用户可以访问这个数据库中的一组可以被访问的数据表。
DB2基础运维习题
DB2基础运维习题基本信息:[矩阵文本题] *1. 数据库服务器主进程是什么 [单选题] *db2venddb2sysc(正确答案)db2acddb2wdog2. 通过命令db2 list db directory查看数据库,当数据库为远程数据库时,“Catalog database partition number”的值一般情况下为 [单选题] *-2-1(正确答案)13. 一般情况下数据库告警日志的路径是 [单选题] *~/sqllib/log~/db2inst1/db2dump~/sqllib/db2tss~/sqllib/db2dump(正确答案)4. 可用通过下面哪个视图获取表空间相关数据,如:表空间使用率、使用大小等[单选题] *SYSCAT.TBSP_UTILIZATIONSYSIBMADM.LOG_UTILIZATIONSYSIBMADM.TBSP_UTILIZATION(正确答案)SYSCAT.LOG_UTILIZATION5. 创建一个1G大小缓冲池,页大小为4KB,SIZE的大小应为 [单选题] *1024*1024/4(正确答案)1024*1024*1024/41024/41000*1000/46. 查看当前数据库会话连接情况 [单选题] *db2 list node directorydb2 list sessionsdb2 list applications(正确答案)db2 list db direcctory7. 事务日志可用空间计算公式 [单选题] *(logprimary+logsecond)*logfilsiz*8K(logprimary+logsecond)*logfilsiz*4K(正确答案) logfilsiz*4Klogprimary*logfilsiz8. 在线重组表需要添加以下哪个关键词 [单选题] * tablespaceaccessonlineinplace(正确答案)9. 以下命令正确的是 [单选题] *db2 grant select on database to user usernamedb2 revoke dbadm on database to user usernamedb2 grant secadm on database to user username(正确答案)db2 reorg tabname use tempspace 10. 以下哪些视图与权限有关 * syscat.dbauth(正确答案) syscat.colauth(正确答案) syscat.schemaauth(正确答案) syscat.tbspaceauth(正确答案)。
db2 测试题
DB2 Family Fundamentals test1.定义基本表时,若要求某一列的值不能为空,则应在定义时使用什么保留字?但如果该列是主键,则可省写。
A.NULLB.N OT NULLC.D ISTINCTD.UNIQUEE.2.当FROM子句中出现多个基本表或视图时,系统将执行什么操作?A.并B.等值联接C.自然联接D.笛卡儿积3.在SELECT语句的下列子句中,通常和HA VING子句同时使用的是以下哪项?A.ORDER BY子句B.W HERE子句C.G ROUP BY子句D.均不需要4.若用如下的SQL语句创建一个student表:CREA TE TABLE student(NO CHAR(4)NOT NULL,NAME CHAR(8)NOT NULL,SEX CHAR(2),AGE NUMBERIC(2))可以插入到student表中的是哪一项?A.(‘1031’,‘曾华’,男,23)B.(‘1031’,‘曾华’,NULL,NULL)C.(NULL,‘曾华’,‘男’,‘23’)D.(‘1031’,NULL,‘男’,23)5.当数据库遭到破坏时,为了能迅速恢复,在进行事务处理过程中将对数据库更新的全部内容写入以下哪项?A.副本文件B.日志文件C.检查点文件D.死锁文件6.10.并发控制的主要方法是采用以下哪种机制?A.口令B.锁C.副本D.检查点7.11.下列SQL语句中,能够实现”收回U4对学生表(STUD)中学号(XH)的修改权”这一功能的是以下哪项?A.REVOKE UPDA TE(XH) ON TABLE FROM U4B.REVOKE UPDA TE(XH) ON TABLE FROM PUBLICC.REVOKE UPDA TE(XH) ON STUD FROM U4D.REVOKE UPDA TE(XH) ON STUD FROM PUBLIC8.12.关于“死锁”,下列说法中错误的有:A.死锁是操作系统中的问题,数据库操作中不存在B.在数据库操作中防止死锁的方法是禁止两个用户同时操作数据库C.当两个用户竞争相同资源时不会发生死锁D.只有出现并发操作时,才有可能出现死锁9.下面哪个工具可以帮助用户对语句性能进行分析?A.可视化解释工具B.性能监视器C.命令行处理器D.控制中心10.要更改数据库管理器配置文件,需以下哪个数据库权限?A.DBADMB.SYSMAINTC.SYSCTRLD.SYSADM11.如果一个用户USER1被授予了表TAB上的CONTROL特权,如果需要限制该用户对表的存取,应使用以下哪条命令?A.REVOKE ALL ON TAB TO USER1B.R EVOKE ALL ON TAB FROM USER1C.R EVOKE CONTROL ON TAB TO USER1D.REVOKE CONTROL ON TAB FROM USER112.给出下面信息:CREA TE TABLE tab1 (c1 char(3) WITH DEFAULT NULL, c2 INTEGER);INSERT INTO tab1(c2) V ALUES (‘345’);如果在命令行处理器(CLP)中执行以下语句,以下哪个结果是正确的?SELECT * FROM tab1;A. C1 C2--- -----------0 record(s) selected.B. C1 C2--- -----------123 3451 record(s) selected.C. C1 C2--- -----------3451 record(s) selected.D. C1 C2--- ------------ 3451 record(s) selected.13.在CREA TE TABLE语句中实现完整性约束的子句有哪些?A.NOT NULLB.PRIMARY KEYC.FOREIGN KEYD.CHECK14.使用SQL语句进行查询操作时,若希望查询结果不出现重复元组,应在SELECT 子句中使用什么保留字?A.UNIQUEB.A LLC.E XCEPTD.DISTINCT15.并发操作会带来哪些数据不一致性?A.丢失修改B.不可重复读C.读脏数据D.死锁16.设有两个事务T1,T2,其并发操作如下所示:T1:T2:1)读A=10,B=52)读A=103)A=A+104)读A=20,B=5求和25 验证错正确的评价是哪个?A.该操作不存在问题B.该操作丢失修改C.该操作不能重复读D.该操作读“脏”数据。
DB2试题及答案(DOC)
1.101下列哪一组实体可以在ERD 中使用?DA. 产品,颜色,高度B. 黄色,大,长C. 约翰,狗,飞机D. 人,动物,植物02下列关于关系数据库的说法,哪一项是正确的?B •A. 关系数据库不能存储视频或音频。
•B. 表是由列和行组成的。
•C. 同一个表中的行可以拥有不同的列集。
•D. 行也称为表字段。
03下列哪些实体应该使用ERD 中的一对多关系?B •A. 人,汽车•B. 公司,员工•C. 祖父,约翰•D. 母亲,孩子•B 04下列哪些是关系数据模型的组件?B•A. 指针,集合,约束•B. 关系,属性,元组•C. 实例,记录类型,实体•D. 表,行,等级•05下列哪一项表述是错误的?D•A. 主键唯一地标识表中的行。
•B. 外键是引用其他表主键的列集。
•C. 主键和外键用于强制数据完整性。
•D. 必须始终在表中定义主键。
•06下列哪一项表述是错误的?A•A. 关系模型中的属性映射到关系数据库中的行•B. 在ERD 中,用长方形表示实体•C. 一对一和多对多是可以在ERD 中表示的关系•D. 关系模型中的实体映射到关系数据库中的表1.21.对于没有软件投资预算的小型创业公司,下列哪一种DB2 版本是理想选择?AA. DB2 Express-CB. DB2 ExpressC. DB2 EnterpriseD. DB2 WorkgroupA2. 假设你已经连接到TESTDB 数据库,下列哪些命令可以列出数据库配置设置?AA. db2 get db cfgB. db2 list db cfgC. db2 get dbm cfgD. db2 list dbm cfgA3. 首次使用DB2 客户端中的CLP 访问远程数据库时,需要:AA. 编目远程节点,并编目引用此远程节点的数据库B. 在系统目录中注册远程系统用户,然后设置与远程节点的SSH 通信C. 使用文本编辑器编辑节点目录和数据库目录文件D. 使用list database directory 命令列出所有远程数据库,然后从列表中选择远程数据库4. 下列关于DB2 版本、客户端和驱动程序的说法,哪一项是错误的?BA. 所有的DB2 客户端和驱动程序都可以免费获取B. DB2 Express 版是唯一可免费获取的服务器版本C. DB2 服务器包含DB2 客户端组件D. 可以使用CLP 将运行DB2 Workgroup 的系统连接到运行DB2Express 的系统上的数据库5.下列关于DB2 环境的说法,哪一项是错误的?CA. TCPIP 端口唯一地标识DB2 实例B.在给定的时间内可以有多个实例运行C.如果试图在实例B 中创建一个数据库,而所用数据库名在实例 A 中已使用,将会发生冲突D.如果试图在数据库A 中创建一个表空间,而所用表空间名在相同的数据库中已使用,将会发生冲突6.下列哪一项不是有效的DB2 客户端?DA. IBM 数据服务器客户端B. IBM 数据服务器运行时客户端C. DB2 运行时客户端合并模块(Windows)D. IBM 数据服务器瘦客户端7. 下列关于DB2 实例的说法,哪一项是正确的?CA. 实例通过dbm cfg 相互关联B. 如果实例A 崩溃,则系统中运行的其他实例也无法运行C. 如果实例A 停止运行,则无法访问此实例中的数据库D. 在一个实例中,只能创建一个数据库8. 下列关于DB2 中表空间的表述,哪一项是错误的?CA. 表空间是介于逻辑表和物理容器之间的逻辑对象B. 所有的表、索引和其他数据都存储在表空间中C. 表空间是在内存中高速缓存表和索引数据的逻辑对象D. 表空间总是关联到缓冲池9. 你接到任务要将大量数据导入DB2 数据库。
JCLCOBOLDB2CICSVASM考试题
Name: _____________ Grade: ____________
1. What is the difference between the JOBLIB and the STEPLIB statements?
The position difference.joblib adapts whole job,steplib only exec.
指定到那个proc的作业步,cond(2,eq,),nullify用even
10. How do you create a temporary dataset? Where will you use them?
Dsn=&& 参数(new,pass,delete)下去的,这样就是temporary
4. What are three major types of JCL statements? What are their functions?
Job,exec,dd statements.
5. What is the difference between catalogue procedure and In-Stream procedure?
6. What are the differences between Temporary Storage Queue (TSQ) and Transient Data Queue (TDQ)?
7. what do the following transactions do?
CEDF:
2. Name some of the JCL statements that are not allowed in PROCs.
db2 面试题
db2 面试题DB2面试题DB2是IBM公司开发和维护的一种关系型数据库管理系统。
在DB2面试中,面试官通常会问及关于DB2的知识和技术的相关问题。
本文将介绍一些常见的DB2面试题,帮助读者加深对DB2的理解和准备面试。
1. DB2的基本概念和特点DB2是一种关系型数据库管理系统,具有以下特点:- 多平台支持:DB2可在各种操作系统上运行,例如Windows,Linux,UNIX等。
- ANSI SQL标准:DB2支持ANSI SQL标准,保证了代码的可移植性。
- 数据完整性:DB2提供完善的数据完整性支持,包括主键、外键、唯一性约束等。
- 分布式数据库:DB2支持分布式数据库,可以在不同地点的服务器上访问和管理数据。
- 并发控制:DB2通过锁定机制实现并发控制,保证数据的一致性和事务的隔离性。
- 数据库安全性:DB2提供各种安全特性,如用户认证、授权管理和数据加密等。
2. DB2的体系结构DB2的体系结构包括物理层、逻辑层和应用层。
- 物理层:包括数据库存储管理器(DBMS)和数据库文件,负责管理数据库文件的物理存储和访问。
- 逻辑层:包括数据库管理系统(DBMS)和数据库,提供了对数据的逻辑操作和管理。
- 应用层:包括应用程序和用户接口,用于访问和操作数据库。
3. DB2的数据和对象DB2中的数据存储在表中,表由行和列组成。
DB2还支持以下对象:- 视图:逻辑表,由一个或多个表导出而来,用于简化数据访问。
- 索引:用于加快数据检索的数据结构。
- 存储过程:一组预定义SQL语句,可重复使用且可由应用程序调用。
- 函数:接受一个或多个参数,并返回一个值的过程。
- 触发器:响应数据库事件而自动执行的一系列SQL语句。
4. DB2的备份和恢复DB2提供了多种备份和恢复工具,如:- 在线备份:备份数据库时,不需要停止数据库的操作。
- 离线备份:备份数据库时,需要停止数据库的操作。
- 日志备份:备份数据库的事务日志,用于增量恢复。
DB2考试题库302_2
IBM DB2 302_21.Which of the following SQL statements can be used to remove data from table "users":BA. REMOVE TABLE usersB. DROP TABLE usersC. DELETE TABLE usersD. ALTER TABLE users2.Given the following table definition:SALESSALES_DATE DATESALES_PERSON CHAR(20)REGION CHAR(20)SALES INTEGERWhich of the following SQL statements will remove all rows that had a SALES_DATE in the year 1995?BA. DELETE * FROM sales WHERE YEAR(sales_date) = 1995B. DELETE FROM sales WHERE YEAR(sales_date) = 1995C. DROP * FROM sales WHERE YEAR(sales_date) = 1995D. DROP FROM sales WHERE YEAR(sales_date) = 19953.Which of the following is the lowest cost DB2 product that can be legally installed on a windows server that has 4 CPUs capable of performing row compression?AA.DB2 Express EditionB.DB2 Workgroup EditionC. DB2 Express-C EditionD. DB2 Enterprise Edition4.When using a Relational Database, which of the following does NOT apply?CA. Accesses data using Data Manipulation Language (DML) such as SQL.B.Define your database schema using a Data Definition Language (DDL).C.Data is stored in a hierarchical model.D. You can use normalization to avoid redundant data in your tables.5. Which of the following is NOT true about the Information Model?DA. Abstract management of objects at a conceptual level.B.Defines relationships between managed objects.C. Group of descriptions explaining objects of a data model.D.Data models can be used to map an Information Model to a software implementation.5. What is authorization?AA.Authorization is a process that checks whether you have sufficient privileges to perform the desired database operation.B.Authorization is the process where the DBA gathers information to see who will have access to the database.C. Authorization is the process where the DB2 database checks with Windows security to see if you have access to the DB2 database.D. Authorization is a process that validates that you are who you claim to be by verifying your user ID and password.6. Which of the following is FALSE about views?BA. Do not contain real dataB. Any view can be updated, independent of its definitionC. When changes are made to data through a view, the data is changed in the underlying tableD. Can be used interchangeably with tables when retrieving data7. What are the entities used to model data in the Relational Model?CA. A collection of instances of entities.B.Relations, attributes and tuplesC.A collection of instances of record types.D. Table, rows and columns8. Which of the following is a tool to configure automatic database backup?AA.Configure Automatic Maintenance wizardB.Design AdvisorC. Explain toolD. EXPORT utility10. Which of the following is a well-formed XML document?AA. <Name xmlns="htpp://" Gender="MALE"><FirstName>Amitabh</FirstName><LastName>Patel</LastName></Name>B.<Name xmlns="" MALE="Gender"><FirstName>Amitabh</FirstName><LastName>Patel</LastName></name>C. <Name Gender="MALE"><FirstName>Amitabh <LastName>Patel</FirstName> </LastName></Name>D. <Name Gender=FEMALE> 没有引号<FirstName>Jaya</FirstName><LastName>Patel</LastName></Name>11. When a user is connected to a database, which of the following privileges is required for the user to use a package?CA. BINDB.BINDADDC.EXECUTED. USE12.Which of the following properties is related to the fact that a committed transaction guarantees that all of the operations are completed and in a roll backed transaction the effect of all operations are reverted?BA. ConsistencyB. AtomicityC. IsolationD. Durability13. How does automatic storage work in DB2?AA.Automatic storage simplifies storage management by allowing you to specify storage paths where the database manager can place table space data, and where the database manager allocates space for various uses.B.Automatic storage is an option which is set when you create a DB2 database. It allows transactions that are written to the database to be automatically committed.C. Automatic storage is a function of DB2 that allows tables to be backed up automatically on a set schedule.D. Automatic Storage can be used to automatically reorganize the data on the physical media in order to improve performance.14.Application B wants to read a subset of rows from table EMPLOYEE multiple times inside the same transaction.BA. Currently CommittedB. Read StabilityC. Repeatable ReadD. Uncommitted Read15. Which of the following is true about a well-formed XML document?CA. Has one or more root nodesB.Tags can have at most one attribute.C.Always has a single document node.D. End tags are optional.16.Which Data Model was created with the focus of providing better data independence?AA.RelationalB.HierarchicalC. SemanticD. Network17. Which of the following is NOT a supported type of trigger?CA. AFTERB.BEFOREC.DURINGD. INSTEAD OF18. Which of the following statements is FALSE about transactions?AA.Operations inside a transaction are executed in parallel.B.Only 1 COMMIT statement can be executed inside the same transaction.C. Transactions guarantee atomicity of a group of operations.D. A ROLLBACK or COMMIT statement finalizes a transaction.19. After the following SQL statement is executed:GRANT ALL PRIVILEGES ON TABLE student TO USER user1 Assuming user USER1 has no other authorities or privileges, which of the following actions is USER1 allowed to perform?DA. Grant all privileges on table STUDENT to other users.B.Drop a view associated to the table STUDEN.C. Drop the table STUDENT.D.None of the above.20. A Dirty Read occurs when?CA. A transaction read the same row of data twice and returns different data values with each read.B. A search based on some criterion returns additional rows after consecutive searches during a transaction.C. Uncommitted data is returned, but the transaction that originated them was rolled back.D.Two transactions read and then attempt to update the same data, the second update will overwrite the first update before it is committed.21. Given the following two tables:TAB1COL_1 COL_2----- -----A 10B 12C 14TAB2COL_A COL_B----- -----A 21C 23D 25Assuming the following results are desired:COL_1 COL_2 COL_A COL_BA 10 A 21B 12 - -C 14 C 23- - D 25Which of the following joins will produce the desired results?DA. SELECT * FROM tab1 INNER JOIN tab2 ON col_1 = col_aB. SELECT * FROM tab1 LEFT OUTER JOIN tab2 ON col_1 = col_aC. SELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON col_1 = col_aD. SELECT * FROM tab1 FULL OUTER JOIN tab2 ON col_1 = col_a22. Which of the following is true about columns?CA. Each column consists of one or more recordsB. Columns are where the individual pieces of information are stored for each recordC. Columns must be designated a specific data typeD. Columns are also known as records23. Given the options below, which of the following statements can add records to a table?CA. ADDRECB. ADDRECORDC. INSERTD. ADD24. If TAB1 is created using the following statementCREATE TABLE tab1 (col1 INTEGER NOT NULL,col2 CHAR(3),CONSTRAINT cst1 CHECK (col1 in (1, 2, 3, 4)))Which of the following statements will successfully insert a record into table TAB1?CA. INSERT INTO tab1 VALUES (0, 'a')B. INSERT INTO tab1 VALUES (NULL, 'abc')C. I NSERT INTO tab1 VALUES (4, 'a')D. INSERT INTO tab1 VALUES (4, 'abcdefhijklmnopq')25. Given the following UPDATE statement:UPDATE employees SET workdept =(SELECT deptno FROM department WHERE deptno = 'A01')WHERE workdept IS NULLWhich of the following describes the result if this statement is executed?BA.The statement will fail because an UPDATE statement cannot contain a subqueryB. The statement will only succeed if the data retrieved by the subquery does not contain multiple recordsC. The statement will succeed; if the data retrieved by the subquery contains multiple records, only the first record will be used to perform the updateD. The statement will only succeed if every record in the EMPLOYEES table has a null value in the WORKDEPT column26. A company has a large amount of data to store and wants to be able to do the following with the data:Have a standard interface for accessing the data.Have multiple users with the ability to insert, update and delete data.Make changes to the data without risk of losing data and its consistency.Have the capability to handle huge volumes of data and users.Have tools for data backup, restore and recovery.What data storage method is the most optimal solution for the company?DA. Text filesB. Comma delimited data filesC. SpreadsheetsD. Database27. Consider the following scenario. You have 3 tables with the same name (TABLE_1) under 3 different schemas (SYSIBM, DEFAULT and DB2INST1). You are connected to a DB2 database in your Linux server as db2inst1 and issue the following statement:SELECT * FROM table_1Which table will you be selecting data from:AA. You get an error because your query is ambiguous, as the table schema is not specifiedB. SYSIBM.table_1C. DEFAULT.table_1D. DB2INST1.table_128. Which of the following statements grants user John the ability to insert data to table tab1?DA. GRANT ADD ON TABLE tab1 TO JohnB. GRANT INSERT ON TABLE tab1 TO JohnC. GRANT ADD ON TABLE tab1 TO USER JohnD. GRANT INSERT ON TABLE tab1 TO USER John29. What is SQL/XML?DA. SQL/XML is a communication protocol for DB2 databases.B. A.SQL/XML is part of the XQuery standard and provides various publishing functions to transform XML data into relational form and vice versa.C.SQL/XML is a language that provides various publishing functions to transform XML data into relational form and vice versa.D. SQL/XML is an extension to SQL standard and provides various publishing functions to transform XML data into relational form and vice versa.30. You are tasked with designing a model that can be used by the software developer to implement a given application. Which of the following is NOT true about your model?BA. The model is a low level of abstraction with concrete and detailed design.B. The model includes specific implementation and protocol details.C. The model should define relationships between the managed objects.D. The model being designed is an Information Model.31. Given the following two tablesNAMES--------------------------------STUDENT_NAME STUDENT_NUMBER------------ ----------------Wayne Gretzky 99Jaromir Jagr 68Bobby Orr 4Bobby Hull 23Mario Lemieux 66MARKS--------------------------------NAME Marks-------- -------Wayne Gretzky 80Bobby Orr 94Brett Hull 77Mario Lemieux 83How many rows would be returned using the following statement?SELECT distinct name FROM student_names, marks DA. 9B. 20C. 5D. 632. Which of the following is true about Dynamic SQL?CA. It is precompiled and binded in dynamic databases.B.The structured of an SQL statement must be completely specified at precompile time.C. It is compiled and executed by an application at run-time.D. Dynamic SQL does not exist.33. Assuming that you are currently connected to TESTDB, which of the following will allow the view of the database settings with details?BA. db2 get db cfg with detailB. db2 get db cfg show detailC. db2 get dbm cfg with detailD. db2 get dbm cfg show detail34. Consider the following command:CREATE TABLESPACE MYTBSP1 MANAGED BY AUTOMATICWhat will the command result in?DA.Creation of a normal table space called mytbsp1 that is managed automatically.B.Creation of a user table space called mytbsp1 that is managed automatically.C.Creation of a temporary table space called mytbsp1 tha t is managed automatically.D. This command will return an error to the user.35. Given the following table:TAB1COL1 COL2----- -----A 10B 20C 30A 10D 40C 30Assuming the following results are desired:TAB1COL1 COL2----- -----A 10B 20C 30D 40Which of the following statements will produce the desired results?BA. SELECT UNIQUE * FROM tab1B. SELECT DISTINCT * FROM tab1C. SELECT UNIQUE(*) FROM tab1D. SELECT DISTINCT(*) FROM tab136. In embedded SQL code, which of the following is true about delimiters?DA. Used by the OS to delimit system variable declaration.B. Used by the database to indicate the end of a column.C. Used by compiler to indicate the end of the program.D. Used by PRECOMPILER to identify SQL statements to be translated.37. Considering the SQL statement below, which option best describes what APP.TAX is:SELECT APP.TAX(SALARY) FROM EMPLOYEE AA. User Defined FunctionB. Stored ProcedureC. TriggerD. User Defined Type38. Which of the following is true about Relational Databases?BA. A column can store values of different data types.B. A table consists of columns and rows.C. Rows in the same table can have a different set of columns.D. Rows are also known as fields of the table.39. You were assigned the task of importing a large amount of data into a DB2 database. Considering you must have logged information about the rows imported and that you want to perform the load as fast as possible, which of the tools would you be the best choice for the job?CA. DB2 INSERTB. DB2 IMPORTC. DB2 LOADD. DB2 CLP40. Which of the following is the lowest cost DB2 product tha t can be legally installed on a Linux server that has 2 CPUs?AA. DB2 Express EditionB. DB2 Enterprise Server EditionC. DB2 EveryplaceD. DB2 Workgroup Server Edition41. Assume a table which contains the following columns:EMP_IDEMP_NAMEPHONEEMAILSALARYWhich of the following is the simplest way to restrict users from viewing SALARY information, while still allowing them to see the other values?BA. Encrypt the table's data.B. Create a view that does not contain the SALARY column. Grant access to the view and revoke access from the original table.C. Revoke SELECT access for the SALARY column from users who should not see SALARY data.D. Store SALARY data in a separate table and grant SELECT privilege for that table to the appropriate users.42. Using DB2's CLP, to access a remote database for the first time, it is necessary to:AA. First catalog the remote system or node, and then catalog the database within the remote nodeB. First register the remote system user in the system catalog, and then setup a SSH communication to the remote nodeC. DB2 cannot use databases in remote systems unless SYSADM authority is granted to the local userD.First list all the remote databases with the db2 list database directory command, and then select the remote database from the list.43. What is a Trusted Context?BA. It is a special area in a buffer pool that can be written only by a selected set of users.B.It is a DB2 capability that allows applications to change users without breaking the connection to the database.C.It is a DB2 capability that allows users to establish a connection to the database without providing user name or password.D. It is a type of container in a table space that allows faster I/O operations.44. Which of the following best describes what an incremental cumulative backup is?DA. Backup all of the data that has changed since the last successful full or delta backup.B. Backup of a single table space.C. Backup of the entire database.D. Backup all of the data that has changed since the last full backup.45. Which of the following DB2 client/driver packages is NOT suitable for developing ODBC applications?CA. IBM Data Server ClientB. IBM Data Server Driver for ODBC and CLIC. IBM Data Server Runtime ClientD. IBM Data Server Driver Package46. Which of the following statements is NOT true regarding Table Spaces on DB2?CA.A Table Space is a logical object in between logical table and physical containersB. All tables, indexes, and other data are stored in a table spaceC. A Table Space is a logical object required to store data, indexes and tables in temporary memoryD. A Table Space is always associated to a Buffer Pool47. Consider the following XML document:<customerinfo><name>John Smith</name><addr country="Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type="work">963-289-4136</phone></customerinfo>Consider the following UPDATE expression:update xmlcustomerset info = xmlquery( 'transformcopy $new := $imodify (do insert <phone type="cell">777-555-3333</phone> after $new/customerinfo/addr,for $j in $new/customerinfo/addr/phonereturn do rename $j as "telephone")return $new' passing info as "i")where cid = 1000;Which of the following represents the XML document after the TRANSFORM expression has been executed:AA. <customerinfo><name>John Smith</name><addr country="Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type="cell">777-555-3333</phone><phone type="work">963-289-4136</phone></customerinfo> (实验结果)B. <customerinfo><name>John Smith</name><addr country="Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type="cell">777-555-3333</phone><telephone type="work">963-289-4136</telephone></customerinfo>C. <customerinfo><name>John Smith</name><addr country="Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip></addr><phone type="cell">777-555-3333</phone><telephone type="work">963-289-4136</telephone> </customerinfo>D. <customerinfo><name>John Smith</name><addr country="Canada"><street>Fourth</street><city>Calgary</city><prov-state>Alberta</prov-state><pcode-zip>M1T 2A9</pcode-zip><phone type="cell">777-555-3333</phone> </addr><telephone type="work">963-289-4136</telephone> </customerinfo>48. Given the following two tables:NAMES---------------------------NAME NUMBER---------- -------Wayne Gretzky 99Jaromir Jagr 68Bobby Orr 4Bobby Hull 23Mario Lemieux 66POINTS----------------------------NAME POINTS---------- -------Wayne Gretzky 244Bobby Orr 129Brett Hull 121Mario Lemieux 189Joe Sakic 94How many rows would be returned using the following statement?DSELECT * FROM names, pointsA. 0B. 5C. 10D. 2549. Which of the following is NOT true about columns?AA.Each column consists of one or more fieldsB. Each column contains a specific type of informationC. Columns must be designated a specific data typeD.Columns are also known as fields50.Which of the following programming languages can be used to develop UDFs?BA. Java, Javascript, SQLB.C/C++, Java, .Net languagesC. SQL, C# .Net, PerlD.Perl, C/C++, SQL51. What is the purpose of a DB2 Access Plan?BA.SQL developers can define Access Plans to tell DB2 the best way to retrieve the data from a SQL queryB.Describes the order of operations to access data necessary to execute a SQL or XQuery statementC. To replicate data between a DB2 database and relational databases from other vendorsD.To visually construct complex DML statements and examine the res ults of their execution52. Which of the following is NOT part of the XQuery FLOWR expression?DA. FOR clauseB. LET clauseC. ORDER BY clauseD. WITH clause53.Which of the following options will perform an offline table space recovery?BA.RESTORE DATABASE SAMPLE TABLESPACE (MYTBSP) OFFLINE FROM /tbspbkpB.RESTORE DATABASE SAMPLE TABLESPACE (MYTBSP) FROM /tbspbkpC.RESTORE DATABASE SAMPLE TABLESPACE (MYTBSP) ONLINE FROM /tbspbkpD.There is no option to restore a table space in DB254. Which of the following objects you would need to create in order to executea block of code every time table TB1 is updated?AA.An AFTER triggerB. A UDFC. A Stored ProcedureD.An User Defined Type55.How can an application modify the isolation level of operations running against a DB2 database?AA.Isolation level can be changed for a particular SQL statement.B.Isolation level can only be changed for the whole user session and all operations in that session will be affected.C.Isolation level to be used can be specified when executing the COMMIT operation.D.Isolation level is determined at the moment an application connects to the database. To change the isolation level, an application is required to create a new connection specifying the desired level.56. Which of the following commands would delete the SAMPLE database?DA. db2 drop sampleB. db2 delete database sampleC. db2 drop sample dbD. db2 drop database sample57. When attempting to establish a connection to a database residing on your local machine, which command can help you determine why the following message was displayed:SQL1013N The database alias name or database name "SAMPLE" could not be found. SQLSTATE=42705AA.list database directoryB. list admin node directoryC. list node directoryD.list dcs directory58. Which of the following best define what a transaction is?AA.A sequence of one or more SQL operations grouped together, also known as a single unit of work.B. A set of independent operations that can be executed in parallel.C. A data isolation level that can help prevent deadlocks by allowing reads on previously committed data.D.An object of a DB2 database.59. Given the following table:CURRENT_EMPLOYEES-----------------------------EMPID INTEGER NOT NULLNAME CHAR(20)SALARY DECIMAL(10,2)PAST_EMPLOYEES-----------------------------EMPID INTEGER NOT NULLNAME CHAR(20)SALARY DECIMAL(10,2)Assuming both tables contain data, which of the following statements will NOT successfully add data to table CURRENT_EMPLOYEES?DA. INSERT INTO current_employees (empid) VALUES (10)B. INSERT INTO current_employees VALUES (10, 'JAGGER', 85000.00)C.INSERT INTO current_employees SELECT empid, name, salary FROM past_employees WHERE empid = 20D. INSERT INTO current_employees (name, salary) VALUES (SELECT name, salary FROM past_employees WHERE empid = 20)60.Which of the following is an XML-based language for transforming XML documents?BA. XHTMLB.XSLTC. HTMLD.Java45. Which of the following DB2 client/driver packages is NOT suitable for developing ODBC applications? (R9TDZ_ce302_course_book教材P66页)AA. IBM Data Server ClientB. IBM Data Server Driver for ODBC and CLIC. IBM Data Server Runtime ClientD. IBM Data Server Driver Package。
DB2面试题
DB2面试题1.DB2是什么?答案:DB2是IBM公司开发的一个关系型数据库管理系统(RDBMS)。
它广泛应用于企业级应用、Web应用程序、云计算和大数据等领域。
2.DB2的版本有哪些?答案:DB2的版本包括DB2 Express-C、DB2 Workgroup、DB2 Enterprise 等。
每个版本都有不同的功能和性能特性,以满足不同规模和需求的企业。
3.DB2支持哪些数据类型?答案:DB2支持多种数据类型,包括字符型、数值型、日期型、布尔型等。
此外,DB2还支持各种数据类型之间的转换和操作。
4.如何创建DB2数据库?答案:创建DB2数据库需要使用CREATE DATABASE语句。
在创建数据库时,需要指定数据库名称、数据文件和大小等信息。
此外,还需要定义表空间和事务日志等。
5.如何连接DB2数据库?答案:连接DB2数据库需要使用适当的客户端工具(如IBM Data Studio或IBM SQL Control)或编程语言中的数据库连接库(如Python的pyodbc)。
连接时需要提供数据库名称、用户名和密码等信息。
6.如何查询DB2数据库中的数据?答案:查询DB2数据库中的数据需要使用SQL语句。
SQL语句包括SELECT、INSERT、UPDATE、DELETE等操作,可以用于检索、修改和删除数据。
查询时可以使用WHERE子句来筛选数据,使用ORDER BY子句来排序数据等。
7.如何优化DB2查询性能?答案:优化DB2查询性能可以通过多种方法实现,如优化表结构、使用索引、减少查询返回的数据量等。
此外,还可以使用DB2的优化工具,如Optimizer,来自动生成优化的SQL查询计划。
8.如何备份和恢复DB2数据库?答案:备份DB2数据库可以使用DB2的备份工具(如backup.exe或db2backup.exe),可以备份整个数据库或特定的表空间。
恢复数据库时,可以使用DB2的恢复工具(如restorer.exe)来还原备份的数据。
DB2_610基础认证考试_3
DB2 10.1 基础认证考试 610 备考教程,第 3 部分: 使用数据库和数据库对象关于本教程本教程概述 DB2 数据库中存在的主要对象。
然后主要使用 IBM Data Studio 分步指导您创建、连接和删除一个数据库。
最后,您将使用 Data Studio 创建、更新和删除数据库对象。
目标在完成本教程之后,您应当能够:∙识别 DB2 数据库中存在的数据库对象,包括其基本特征和属性∙使用 IBM Data Studio:o创建、连接和删除一个数据库o创建并修改数据库中存在的对象DB2 数据库和数据库对象简介DB2 的基本组织结构在向您展示如何创建、连接和修改数据库中的对象之前,需要大致了解一下 DB2的基本组织结构和术语。
类似于使用文件夹层次结构组织文件的文件系统,DB2使用了对象层次结构组织数据。
在该层次结构最顶部是加载 DB2 的服务器或计算机。
下面是数据库实例一级。
一个实例便可控制其下面的数据库并管理系统资源。
服务器上必须至少有一个实例,而且可以有很多实例。
每个实例充当其自己独立的 DB2 安装,控制对其中的数据库的访问。
数据库是数据库对象层次结构的第三层,在这一层,您将开始学习基本命令和创建过程。
一个数据库是一个数据集合。
作为一个关系型数据库,DB2 包含相互之间存在关系的表,这些表使用这些关系组织数据,同时将对该数据的复制保持在最低限度。
紧接着的所有对象都可视作我们的数据库层次结构中第 4 层的一部分,因为它们都是 DB2 数据库的一部分。
数据库中的对象本教程不介绍数据库对象的 CREATE 语句的语法,不过,为了考试,您应当熟悉该语法。
在其他教程中可能会更多地介绍这些对象(例如:表、索引和视图),CREATE 语句在 DB2 10.1 Information Center 中有详细的说明。
关于每个对象的 CREATE 语句的直接链接,请参见本教程的参考资料部分。
另外,在查看“在 Data Studio 中创建、修改和删除对象” 中的示例后,您可以通过一个操作生成自己的 CREATE 语句。
DB2复习资料
DB2复习资料简答题练习题1 、数据模型由哪三个部分组成,请简述。
2 、请简述丢失更新,并说明在什么情况下会发生丢失更新。
3 、简述数据库管理系统中正确的并发调度方法4 、请简述数据库系统中的常见故障?试提出解决方案。
5 、列(即聚合)函数对一个列中的一组值进行操作,返回单一值。
请写出至少4个列函数,并简述其功能6 、请简述数据库系统中的常见故障?并提出解决方案。
7 、请简述数据库及DB2的隔离级别8 、请简述数据模型及存在的几种类型9 、关系型数据库中的数据层次有几个,请分别说明。
填空练习题数据模型通常由数据结构,数据操作,完整约束三部分组成。
最常用的数据库的恢复技术是数据转储,登录日志文件。
数据独立性是指物理和逻辑独立性。
目前数据库产品有 SQL Server 和Oracle, DB2等。
当数据库被破坏后,如果事先保存了数据库副本和日志文件,就有可能恢复数据库。
数据库的完整性是指数据库的正确性和相容性。
对于每一个外模式,数据库系统都有一个外模式 / 模式映象,它定义了该外模式与模式之间的对应关系。
视图是一个虚表,它一经定义就可以和基本表一样被查询,但更新操作将有一定的限制。
避免活锁的简单方法是采用先来先服务的策略。
关系中主码的取值必须唯一且非空,这是由实体完整性规则决定的。
DB2 中有三种主要的安全机制,可以帮助 DBA 实现数据库安全计划:身份验证、授权和特权在多用户环境下,在使用并行事务时,会发生四种现象:丢失更新、脏读、不可重复的读、虚读选择练习题下列关于关系数据库的说法,哪一项是正确的?BA. 关系数据库不能存储视频或音频。
B. 表是由列和行组成的。
C. 同一个表中的行可以拥有不同的列集。
D. 行也称为表字段。
下列哪些实体应该使用一对多关系?BA. 人,汽车B. 公司,员工C. 祖父,约翰D. 母亲,孩子下列哪些是关系数据模型的组件?BA. 指针,集合,约束B. 关系,属性,元组C. 实例,记录类型,实体D. 表,行,等级下列哪一项表述是错误的?DA. 主键唯一地标识表中的行。
BD2命令
1.DB2产品的级别有那些?企业版的NTERPRISEEDITION工作组版WORKGROUPEDITION企业扩展版ENTERPRISEEXTENDEDEDITION个人版的PERSONALEDITION卫星版的SATELLITEEDITION微型版的EVERYPLACE2.可以连接到DB2数据库的产品有哪些?DB2客户端DB2CONNECTDB2DATAPROPAGATORDB2NET.DATADB2DATAJOINERDB2RELATIONALCONNECTWEBSPHERE应用服务器等3.DB2支持的通讯协议有哪些?TCP/IPNETBIOSAPPGIPX/SPXNAMEPIPE等4.DB2客户端产品有哪些?DB2运行时间客户端DB2RUNTIMECLIENTDB2管理客户端DB2ADMINISTRATIONCLIENTDB2应用程序开发客户端DB2APPLICATIONDEVELOPMENTCLIENTDB2瘦客户端DB2THINCLIENT5.一个数据库是否可以安装在多个数据库服务器上?可以6.从哪个版本后存储过程可以用SQL语句来创建?7.1版后7.DB2提供哪些关系扩展器?文本扩展器TEXTEXTENDER图象扩展器IMAGEEXTENDER音频扩展器AUDIOEXTENDER视频扩展器VIDEOEXTENDER空间数据扩展器SPATIALEXTENDERXML扩展器XMLEXTENDER网络搜索扩展器NET.SEARCHEXTENDER8.WINDOWS和OS/2环境下的DB2安装目录结构?用SETUP.EXE来安装\SQLLIB安装的根目录,包括README文件\SQLLIB\ADSM包含ADSTAR分布式存储管理器文件\SQLLIB\BIN包含DB2工具的可执行文件\SQLLIB\BND包含DB2工具的绑定文件\SQLLIB\CC包含运行控制中心所需的文件\SQLLIB\CFG包含默认的系统配置文件\SQLLIB\CONV包含代码页转换表文件\SQLLIB\DB2默认的实例目录\SQLLIB\DB2DAS00缺省的DB2管理服务器目录\SQLLIB\DOC包含DB2联机手册\SQLLIB\FUNCTION默认的用户自定义函数目录\SQLLIB\FUNCTION\UNFENCED默认的非隔离用户自定义函授目录\SQLLIB\HELP联机帮助文件\SQLLIB\JA V ADB2所需的JA V A类库JA VA12包含JDK1.2的支持程序\SQLLIB\MISC包含HTML搜索服务器文件\SQLLIB\MSG\PRIME包含信息文件\SQLLIB\QP包含QUERYPATROLLER的客户端文件\SQLLIB\SAMPLES包含样例程序和样例脚本\SQLLIB\SPMLOG包含DB2同步点管理器日志文件\SQLLIB\THNSETUP包含瘦客户端安装文件9.UNIX和LINUX环境下的DB2安装目录结构?用DB2SETUP.EXE来安装安装的根目录下还将创建以下目录:README安装的根目录,包括README文件ADM包含系统管理工具文件ADSM包含ADSTAR分布式存储管理器文件BIN包含DB2工具的二进制可执行文件BND包含DB2工具的绑定文件CC包含运行控制中心所需的文件CFG包含默认的系统配置文件CONV包含代码页转换表文件DOC包含DB2联机手册FUNCTION默认的用户自定义函数目录FUNCTION\UNFENCED默认的非隔离用户自定义函授目录INSTALL包含安装程序INSTANCE包含实例脚本JA V ADB2所需的JA V A类库LIBDB2库文件MAP包含DB2CONNECT使用的映射文件MISC包含HTML搜索服务器文件SAMPLES包含样例程序和样例脚本MSG\$L包含DB2信息文件10.AIX下用哪个命令来安装DB2?INSTALLP命令11.同一操作系统下可以安装多个DB2数据库?可以的12.如何停止实例?DB2STOP13.如何启动实例?DB2START14.如何修改注册项的值?DB2SET可以修改如:设定当前实例的一个参数DB2SETPARAMETER=V ALUE设定一个全局级的参数DB2SETPARAMETER=V ALUE-G(小写)查看能在配置文件注册表中设置的所有变量的列表DB2SET-LR(小写)15.如何在CLP执行操作系统的命令?在命令前加"!"作为前缀DB2=>!DIRC:\16.在CLP中命令过长怎么办?用"\"作为续行符号17.如何获得DB2的命令的语法相关信息?DB2?显示所有DB2命令DB2?COMMAND显示命令信息DB2?SQLnnnn显示这个SQLCODE的解释信息DB2?DB2nnnn显示这个DB2错误的解释信息18.如何查看当前CLP的设置?DB2=>LISTCOMANDOPTIONS19.如何更新当前CLP会话的特定项设置?DB2UPDATECOMMANDOPTIONSUSINGOPTIONS...MANDWINDOWS可以通过哪个命令调用?DB2CMD命令21.管理服务器的默认名为?UNIX下为DB2ASWINDOWS下为DB2DAS0022.常用管理DB2服务器实例的命令?DB2ADMINSTART启动DB2管理服务器实例DB2ADMINSTOP停止DB2管理服务器实例DASICRTUNIX下创建DB2管理服务器实例DASIDROPUNIX下删除DB2管理服务器实例DB2ADMINCREATEWINDOWSOROS/2下创建DB2管理服务器实例DB2ADMINDROPWINDOWSOROS/2下删除DB2管理服务器实例DB2GETADMINCFG显示DB2管理服务器的配置参数DB2UPDATEADMINCFG修改DB2管理服务器的配置参数DB2RESETADMINCFG将DB2管理服务器的配置参数设为默认值23.DB2目录分为哪几种?系统数据库目录本地数据库目录节点目录DCS目录管理节点目录24.如何查看系统数据库目录?LISTDBDIRECTORY25.如何查看数据库服务器目录?LISTNODEDIRECTORY26.DB2实例的服务器的默认端口是?50000服务器名称为DB2CDB227.DB2UDB服务器端的认证类型有?SERVERSERVER_ENCRYPTCLIENTDCEDCE_SERVER_ENCRYPTKERBEROSKRB_SERVER_ENCRYPT28.DB2客户端的认证类型有?SERVERSERVER_ENCRYPTDCSDCS_ENCRYPTCLIENTDCE29.DB2中有哪几种类型的权限?SYSADM系统管理权限SYSCTRL系统控制权限SYSMAINT系统维护权限DBADM数据库管理权限LOAD对表进行LOAD操作的权限30.不能通过GRANT授权的权限有哪种?SYSAMSYSCTRLSYSMAINT要更该述权限必须修改数据库管理器配置参数31.表的类型有哪些?永久表(基表)临时表(说明表)临时表(派生表)32.如何知道一个用户有多少表?SELECT*FROMSYSIBM.SYSTABLESWHERECREATOR='USER'33.如何知道用户下的函数?select*ERFUNCTIONselect*fromsysibm.SYSFUNCTIONS34.如何知道用户下的VIEW数?select*fromsysibm.sysviewsWHERECREATOR='USER'35.如何知道当前DB2的版本?select*fromsysibm.sysvERSIONS36.如何知道用户下的TRIGGER数?select*fromsysibm.SYSTRIGGERSWHERESCHEMA='USER'37.如何知道TABLESPACE的状况?select*fromsysibm.SYSTABLESPACES38.如何知道SEQUENCE的状况?select*fromsysibm.SYSSEQUENCES39.如何知道SCHEMA的状况?select*fromsysibm.SYSSCHEMATA40.如何知道INDEX的状况?select*fromsysibm.SYSINDEXES41.如何知道表的字段的状况?select*fromsysibm.SYSCOLUMNSWHERETBNAME='AAAA'42.如何知道DB2的数据类型?select*fromsysibm.SYSDATATYPES43.如何知道BUFFERPOOLS状况?select*fromsysibm.SYSBUFFERPOOLS44.DB2表的字段的修改限制?只能修改V ARCHAR2类型的并且只能增加不能减少.45.如何查看表的结构?DESCRIBLETABLETABLE_NAMEORDESCRIBLESELECT*FROMSCHEMA.TABLE_NAME46.如何快速清除一个大表?ALTERTABLETABLE_NAMEACTIVENOTLOGGEDINITALLYWITHEMP TYTABLEALTER TABLETABLE_NAME ACTIVE NOT LOGGED INITALLY WIT H EMPTYTABLE两个commit之间的delete 动作是不记日志的commitalter table ab activate not logged intiallydelete ab where id >1000commit(创建的表ab不记录日志:create table ab (id int) not logged initially)47.如何查看数据库的包?select*fromsysCAT.PACKAGES48.如何查看数据库的存储过程?SELECT*FROMSYSCAT.PROCEDURES49.如何查看表的约束?SELECT*FROMSYSCAT.CHECKSWHERETABNAME='AAAA'50.如何查看表的引用完整约束?SELECT*FROMSYSCAT.REFERENCESWHERETABNAME='AAAA'51.安装DB2默认的事例名称是?在WINDOWS或OS/2中默认的是DB2在LINUX或UNIX环境下默认的是DB2INST152.安装后的默认帐户是?在WINDOWS或OS/2中默认的是DB2ADMIN 在LINUX或UNIX环境下默认的是DB2AS 53.事例的类型有哪些?CLIENT(客户)STANDALONE(独立的)SATELLITE(卫星)EEDB2EEE54.如何创建事例?DB2ICRTINSTNAME<...PARAMETERS>55.如何列出系统上的所有可用事例?DB2ILIST56.如何知道当前对话用的是哪个事例? GETINSTANCE57.如何更新事例的配置?DB2IUPDT58.如何删除事例?DB2IDROPINSTANCE_NAME具体步骤如下:停止事例上所有应用程序在所有打开的命令行上执行DB2TERMINATE运行DB2STOP备份DB2INSTPROF注册变量指出的事例目录退出事例所有登陆者使用DB2IDROP也可以删除ID59.如何列出本地系统上有许可信息的所有产品?DB2LICM-L60.如何增加一产品许可?DB2LICM-AFILENAME61.如何删除一个产品的许可?DB2LICM-RPRODUCTPASSWORD62.如何更新已购买的许可数量?DB2LICM-U63.如何强制只使用已经购买的数量?DB2LICM-EHARD64.如何更新系统上所使用的许可政策类型?DB2LICM-PREGISTEREDCONCURRENT65.如何更新系统上的处理器的数量?DB2LICM-N66.如何查询许可文件记录的版本信息?DB2LICM-V67.如何查询DB2LICM的帮助信息?DB2LICM-H68.一个数据库至少包括哪些表空间?一个目录表空间一个或多个用户表空间一个或多个临时表空间69.根据数据与存储空间之间移动的控制方式不同,分哪两种表空间? 系统管理的空间(SMS)数据库管理的空间(DMS)70.如何列出系统数据库目录的内容? LISTDATABASEDIRECTORY71.CREATEDATABASE是SQL命令吗?不是,是系统命令72.如何查看数据库ABC的配置文件的内容? GETDATABASECONFIGURATIONFORABC73.如何将数据库ABC的参数设置为默认数值? RESETDATABASECONFIGURATIONFORABC74.如何修改数据库ABC配置参数数值? UPDATEDATABASECONFIGURATIONFORABCUSING75.如何重新启动数据库?RESTARTDATABASEDATABASE_NAME76.如何激活数据库?ACTIV ATEDATABASEDATABASE_NAME77.如何停止数据库?DEACTIV ATEDATABASEDATABASE_NAME78.如何删除数据库?DROPDATABASEDATABASE_NAME79.如何建立模式?CREATESCHEMASCHEMA_NAME80.如何设置模式?SETSCHEMA=SCHEMA_NAME81.表的类型有哪些?基本表结果表概要表类型表子类型子表声明的临时表系统临时表82.如何定义序列? CREATESEQUENCEORDERSEQSTARTWITH1INCREMENTBY1NOMAXV ALUENOCYCLECACHE2483.如何将表置于检查挂起状态?SETINTEGRITYTABLE_NAMEOFF84.如何获得表的排斥锁?LOCKTABLETABLE_NAMEINEXCLUSIVEMODE85.如何把表调整为没有检查数据的在线状态?SETINTEGRITYFORTABLE_NAMEALLIMMEDIATEUNCHECKED86.如何解除表的锁定?COMMIT87.如何关闭表的日志?ALTERTABLETABLE_NAMEACTIVENOTLOGGEDINIALLY88.如何删除表?DROPSCHEMA.TABLE_NAME89.如何重命名表?RENAMETABLE_OLDTOTABLE_NEW90.如何取当前时间?SELECTCURRENTTIMESTAMPFROMSYSIBM.SYSDUMMY1 91.如何创建DB2的概要表?DB2的概要表功能类似于ORACLE的实体化视图!语法为:CREATESUMMARYTABLETABLE_NAMEAS(FULLSELECT)...例如:定义一个可以刷新的概要表:CREATESUMMARYTABLETABLE_NAMEAS(SELECT*FROMTABLE_ NAME1WHERECOL1='AAA')DATAINITIALLYDEFERREDREFRESHDEFERRED其中DATAINITIALLYDEFERRED规定不能将数据作为CREATETABLE语句的一部分插入表中.REFRESHDEFERRED规定表中的数据可以在任何使用了REFRESHTABLE语句的时候获得刷新!92.如何刷新概要表?REFRESHTABLESUM_TABLE其中SUM_TABLE为概要表.93.如何修改概要表?ALTERTABLESUM_TABLE...94.如何创建临时表?语法:DECLAREGLOBALTEMPORARYTABLETABLE_NAMEAS(FULLSELECT)DEFINITIONONLYEXCLUDINGIDENTITYCOLUMNATTRIBUTESONCOMMITDELETEROWSNOTLOGGED第一行规定临时表的名称.第二行规定临时表的列的定义.第三行规定不是从源结果表定义中复制的恒等列.第四行规定如果没有打开WITHGOLD光标,将会删除表的所有行.第五行规定不对表的改变进行记录.例如:DECLAREGLOBALTEMPORARYTABLEDEC_BSEMPMSAS(SELECT*FROMBSEMPMS)DEFINITIONONLYEXCLUDINGIDENTITYCOLUMNATTRIBUTESONCOMMITDELETEROWSNOTLOGGED95.视图的管理?如何创建视图:CREATEVIEWVIEW_NAMEASSELECT*FROMTABLE_NAMEWHERE...删除视图:DROPVIEWVIEW_NAME96.如何知道视图定义的内容?SELECT*FROMSYSCAT.VIEWS中的TEXT列中.97.如何创建别名?CREATEALIASALIAS_NAMEFORPRO_NAME后面的PRO_NAME可以是TABLE,VIEW,ALIAS,NICKNAME等.98.如何创建序列?例如:CREATESEQUENCESEQUENCE_NAMESTARTWITHSTART_NUMBERINCREMENTBYVALUE1NOMAXVALUENOCYCLE CACHEMAXIMUMNUMBEROFSEQUENCEVALUES第一行规定序列的名称.第二行规定序列的开始数值.第三行规定每次新增的幅度.第四行规定没有最大数值限制.第五行规定最大数值限制.99.如何更改序列?ALTERSEQUENCESEQUENCE_NAME...可以修改的参数STARTWITH的START_NUMBERINCREMENT的VALUE1NOMAXVALUE的数值NOCYCLE属性MAXIMUMNUMBEROFSEQUENCEVALUES最大数值100.如何删除序列?DROPSEQUENCESEQUENCE_NAME101.DB2支持导入(IMPORT)的文件格式有?有:DEL,ASC,IXF,WSF等102.DB2支持导出(EXPORT)的文件格式有?有:DEL,IXF,WSF等.不支持ASC格式.103.DB2支持载入(LOAD)的文件格式有?有:DEL,ASC,IXF等.不支持WSF格式.104.DB2支持DB2MOVE的文件格式有?有:IXF等.不支持ASC,DEL,WSF格式.105.DB2数据库监控的两个组成部分?快照监控(SNAPSHOTMONITOR)可返回特定时间点的数据库活动的快照.事件监控(EVENTMONITOR)记录事件发生的数据.106.系统监控的数据元素类型?计数器(COUNTER)记录活动发生的次数.测量(GAUGE)测量条目的当前值.水线(WATERMARK)从监控来元素达到的最大或最小数值.信息(INFORMATION)监控活动的参照类型细节.时间点(TIMESTAMP)活动发生的日期时间.时间(TIME)返回一个活动花费的时间.107.如何知道监控堆所需的页的数量?(NUMBEROFMONITORINGAPPLICATIONS+1)*(NUMBEROFDATABA SES*(800+(NUMBEROFTABLESACCESSED*20)+((NUMBEROFAPPLICATIONSCONNECTED+1)*(200+( NUMBEROFTABLESPACES*100)))))/4096其大小受参数MON_HEAD_SZ控制.108.如何建立事件监控器?CREATEEVENTMONITORTABLEMONFORTABLESWRITETOFILE'D:\T EMP'109.如何激活事件监控器?SETEVENTMONITORTABLEMONSTATE1110.如何停止事件监控器?SETEVENTMONITORTABLEMONSTATE0111.如何查询监控器的状态?SELECTEVMONNAME,EVENT_MON_STATE(EVMONNAME)FROMSY SCAT.EVENTMONITORS112.如何删除事件监控器?DROPEVENTMONITORTABLEMON113.UNIX和WINDOWS上创建管道事件监控器(PIPE意EVNT见MONITOR)的不同?第一步:定义事件监控器UNIX:CONNECTTOSAMPLECREATEEVENTMONITORSTMB2FORSTATEMENTSWRITETOPIPE'/TMP/EVPIPE1'WINDOWS:CONNECTTOSAMPLECREATEEVENTMONITORSTMB2FORSTATEMENTSWRITETOPIPE'\\.\T MP\EVPIPE1'第二步:建立命名管道UNIX:可以使用MKFIFO()函数或者MKFIFO命令.WINDOWS:可以使用CREATENAMEDPIPE()函数,管道名称与CREATEEVENTMONITOR规定名称相同.第三步:打开命名管道UNIX:使用OPEN()函数.WINDOWS:使用CONNECTNAMEDPIPE()函数.也可以用DB2EVMON命令,如:DB2EVMON-DBSAMPLE-EVMSTMB2第四步:激活命名管道事件监控器除非自动激活命名管道事件监控器,否则SETEVENTMONITORSTMB2STATE1第五步:从命名管道读取数据UNIX:可以使用READ()函数.WINDOWS:可以使用READFILE()函数.第六步:停止事件监控器SETEVENTMONITORSTMB2STATE0第七步:关闭命名管道UNIX:可以使用CLOSE()函数.WINDOWS:可以使用DISCONNECTNAMEDPIPE()函数.第八步:删除命名管道UNIX:可以使用UNLINK()函数.WINDOWS:可以使用CLOSEHANDLE()函数.114.DB2的SQL语句的类别DCL:数据控制语言,提供对数据库对象的访问权限.DDL:数据定义语言,创建,修改,删除数据库对象的.DML:数据操纵语言,用来插入,更新,删除数据的.115.DCL的权限有哪些?CONTROL权限:如果用户创建一个对象,则改用户能完全访问该对象. GRANT语句将权限授予给用户.REVOKE语句撤销一个用户的权限.116.DDL有哪些?CREATEDECLAREALTERDROP等117.DML有哪些?INSERTSELECTUPDATEDELETE等118.DB2有没有布尔类型?没有119.如何查询DB2的内置函数?自带文档ADMINISTION-->SQLREFERENCE-->FUNCTIONS内120.如何执行DB2的脚本文件?DB2-VTFFILENAME121.DB2中象ORACLE的ROWNUM()是?ROW_NUMBER()OVER()122.DB2如何得到错误代码的说明?DB2?SQLCODE123.DB2中的VARCHAR转换为INTEGER的函数为?CAST()124.DB2中的INTEGER转换为VARCHAR的函数为?CHAR()125.DB2中的VARCHAR转换为DATE的函数为?DATE()126.DB2中的DATE转换为VARCHAR的函数为? CHAR()127.DB2中的TRIGGER能否修改?不能,只能删除重建128.WINDOWS下如何知道DB2的端口号?\WINNT\SYSTEM32\DRIVERS\ETC\SERVICES129.DB2如何执行存储过程?可以DB2CALLPROCEDURE_NAME130.如何进入DB2的DOS命令方式?DB2CMD131.如何得到DB2的进程号?DB2LISTAPPLICATIONS132.如何杀DB2的进程?FORCEAPPLICATION(ID)133.A用户安装DB2后,如何用B用户启动DATABASE? 在B用户下的.PROFILE中加上./HOME/DB2INST/SQLLIB/DB2PROFILE134.DB2中类似ORACLE的快照是?SUMMARYTABLEDB2函数135.A VG()返回一组数值的平均值.SELECTA VG(SALARY)FROMBSEMPMS;136.CORR(),CORRELATION()返回一对数值的关系系数.SELECTCORRELATION(SALARY,BONUS)FROMBSEMPMS;137.COUNT()返回一组行或值的个数.SELECTCOUNT(*)FROMBSEMPMS;138.COV AR(),COV ARIANCE()返回一对数值的协方差.SELECTCOV AR(SALARY,BONUS)FROMBSEMPMS;139.MAX()返回一组数值中的最大值.SELECTMAX(SALARY)FROMBSEMPMS;140.MIN()返回一组数值中的最小值.SELECTMIN(SALARY)FROMBSEMPMS;141.STDDEV()返回一组数值的标准偏差.SELECTSTDDEV(SALARY)FROMBSEMPMS;142.SUM()返回一组数据的和.SELECTSUM(SALARY)FROMBSEMPMS;143.V AR(),V ARIANCE()返回一组数值的方差.SELECTV ARIANCE(SALARY)FROMBSEMPMS; 144.ABS(),ABSV AL()返回参数的绝对值.SELECTABS(-3.4)FROMBSEMPMS;145.ACOS()返回参数的反余弦值.SELECTACOS(0.9)FROMBSEMPMS;146.ASCII()返回整数参数最左边的字符的ASCII码. SELECTASCII('R')FROMBSEMPMS;147.ASIN()返回用弧度表示的角度的参数的反正弦函数. SELECTASIN(0.9)FROMBSEMPMS;148.ATAN()返回参数的反正切值,该参数用弧度表示的角度的参数. SELECTATAN(0.9)FROMBSEMPMS;149.ATAN2()返回用弧度表示的角度的X和Y坐标的反正切值. SELECTATAN2(0.5,0.9)FROMBSEMPMS;150.BIGINT()返回整型常量中的数字或字符串的64位整数表示. SELECTBIGINT(EMP_NO)FROMBSEMPMS;151.CEILING()ORCEIL()返回比参数大或等于参数的最小的整数值.SELECTCEILING(3.56)FROMBSEMPMS;SELECTCEIL(4.67)FROMBSEMPMS;152.CHAR()返回日期时间型,字符串,整数,十进制或双精度浮点数的字符串表示.SELECTCHAR(SALARY,',')FROMBSEMPMS;153.CHR()返回具有由参数指定的ASCII码的字符.SELECTCHAR(167)FROMBSEMPMS;154.CONCAT()返回两个字符串的连接.SELECTCONCAT(EMP_NO,EMP_NAM)FROMBSEMPMS;155.YEAR()返回数值的年部分.SELECTYEAR('2003/01/02')FROMBSEMPMS;156.V ARCHAR()返回字符串,日期型,图形串的可变长度的字符串表示.SELECTV ARCHAR(EMP_NAM,50)FROMBSEMPMS;157.UCASE()ORUPPER()返回字符串的大写.SELECTUCASE(EMP_NAM)FROMBSEMPMS;SELECTUPPER(EMP_NO)FROMBSEMPMS;158.TRUNCATE()ORTRUNC()从表达式小数点右边的位置开始截断并返回该数值.SELECTTRUNCATE(345.6789,2)FROMBSEMPMS;159.TIME()返回一个数值中的时间.SELECTTIME('2001-03-19.12.30.123456')FROMBSEMPMS;160.SUBSTR(EXP1,EXP2)返回EXP1串自EXP2处开始的子串.SELECTSUBSTR('CDNJFDJFJD',5)FROMBSEMPMS;SELECTSUBSTR('CDNJFDJFJD',5,2)FROMBSEMPMS;161.SQRT()返回该参数的平方根.SELECTSQRT(36)FROMBSEMPMS;162.SPACE()返回由参数指定的长度,包含空格在内的字符串.SELECTSPACE(10)FROMBSEMPMS;163.SECOND()返回一个数值的秒部分.SELECTSECOND('18:34:32')FROMBSEMPMS;164.RTRIM()删除字符串尾部的空格.SELECTRTRIM('COMMENT')FROMBSEMPMS;165.ROUND(EXP1,EXP2)返回EXP1小数点右边的第EXP2位置处开始的四舍五入值.SELECTROUND(2345.6789,2)FROMBSEMPMS;166.REPLACE(EXP1,EXP2,EXP3)用EXP3替代EXP1中所有的EXP2SELECTCHAR(REPLACE('ROMANDD','NDD','CCB'),10)FROMBSEMPM S167.REPEAT(EXP1,EXP2)返回EXP1重复EXP2次后的字符串.SELECTCHAR(REPEAT('REPEAT',3),21)FROMBSEMPMS;168.REAL()返回一个数值的单精度浮点数表示.SELECTREAL(10)FROMBSEMPMS;169.RAND()返回0和1之间的随机浮点数.SELECTRAND()FROMBSEMPMS;170.POWER(EXP1,EXP2)返回EXP1的EXP2次幂.SELECTPOWER(2,5)FROMBSEMPMS;171.POSSTR(EXP1,EXP2)返回EXP2在EXP1中的位置.SELECT('ABCDEFGH','D')FROMBSEMPMS;172.NULLIF(EXP1,EXP2)如果EXP1=EXP2,则为NULL,否则为EXP1173.NODENUMBER()返回行的分区号.SELECTNODENUMBER(EMP_NO)FROMBSEMPMS;174.MONTH()返回一个数值的月部分.SELECTMONTH('2003/10/20')FROMBSEMPMS;175.MOD(EXP1,EXP2)返回EXP1除以EXP2的余数.SELECTMOD(20,8)FROMBSEMPMS;176.MINUTE()返回一个数值的分钟部分.SELECTMINUTE('18:34:23')FROMBSEMPMS;177.LTRIM()删除字符串前面的空格.SELECTLTRIM('CDDD')FROMBSEMPMS;178.HOUR()返回一个数值的小时部分.SELECTHOUR('18:34:23')FROMBSEMPMS;179.DOUBLE()如果参数是一个数字表达式,返回与其相对应的浮点数,如果参数是字符串表达式,则返回该数的字符串表达式.SELECTDOUBLE('5678')FROMBSEMPMS;180.EXP()返回参数的指数函数.SELECTEXP(2)FROMBSEMPMS;181.FLOAT()返回一个数的浮点表示.SELECTFLOAT(789)FROMBSEMPMS;182.FLOOR()返回小于或等于参数的最大整数.SLECTFLOOR(88.93)FROMBSEMPMS;183.HEX()返回一个表示为字符串的值的16进制表示.SELECTHEX(16)FROMBSEMPMS;当我被上帝造出来时,上帝问我想在人间当一个怎样的人,我不假思索的说,我要做一个伟大的世人皆知的人。
DB2考试范围整理
DB2考试范围整理填空20空,每空2分。
选择30题,每题2分。
出题一定是给定范围中的原句。
填空只在第二章。
填空题填中文或填错字母都无分。
Unit 2. DB2 SQL Workshop2.1 Instruction(命令)Page17 Notes:A relational database is a collection of tables.(一个关系型数据库是一些表的集合)A table is a set of columns and rows. All data is stored in tables.(一个表是一组列和行,所有的数据存储在表中。
)Every table has a name.(每个表都有一个名字)In a well-designed database, each table contains data about a specific subject (entity);for instance, one table contains employee data, another table department data, and a third one data about projects.(在一个设计良好的数据库,每个表包含数据关于某个特定主题(实体);例如,一个表包含员工数据,另一个表包含部门数据和第三个表包含项目数据。
)The database management system manages the data.(数据库管理系统管理数据。
)If someone requires information about an employee, he/she must talk to the data management system in a language which the system understands: SQL – Structured Query Language.(如果有人需要雇员信息,他/她必须用一种语言和数据管理系统交流,这种语言系统能够理解即:SQL -结构化查询语言。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一选择题(每题1.5分,共45分)1) 下面的哪个数据库版本可以访问OS/390 上的DB2 UDB 数据库?a) DB2 Connect Personal Editionb) DB2 Universal Database Workgroup Editionc) DB2 Personal Developer's Editiond) DB2 Universal Developer's Edition2) 下面的哪个工具可以编目一个数据库信息?a) Journal 日志工具b) Alert Center 警告中心c) License Center 许可证中心d) Client Configuration Assistant 客户端配置助手3) 下面的哪个工具可以重组数据回收表中被删除的行所占有的资源?a)reorgb) db2lookc) db2moved) runstats4) USE这个特权的用途是?a) query data in a table.b) load data into a table.c) create tables within a table space.d) create table spaces within a database.5) 如果创建数据库则需要下面的哪两个权限?a) DBADMb) SYSADMc) DBCTRLd) SYSCTRLe) SYSMAINT6) 编目一个远程数据库是指:a) 在PC或者Unix 机器上执行编目,目的是为了识别DB2数据库管理器所在的服务器b) 在PC或者Unix机器上编目,目的是为了让用户和应用程序可以识别DB2数据库c) 从不在DB2中编目,仅当每个节点上的数据库被允许编目时编目,所以自动编目那个节点就可以自动编目数据库Nd) 在PC或者UNIX机器上编目是为了打开在DB2数据库中的目录表,这样当前的用户可以访问这个数据库中的一组可以被访问的数据表。
7) 给出下面的语句CREATE DISTINCT TYPE kph AS INTEGER WITH COMPARISONS CREATE DISTINCT TYPE mph AS INTEGER WITH COMPARISONS CREATE TABLE speed_limits(route_num SMALLINT,canada_sl KPH NOT NULL,us_sl MPH NOT NULL)下面的哪个查询语句是正确的?a) SELECT route_num FROM speed_limits WHERE canada_sl > 80b) SELECT route_num FROM speed_limits WHERE canada_sl > kphc) SELECT route_num FROM speed_limits WHERE canada_sl > us_sld) SELECT route_num FROM speed_limits WHERE canada_sl > kph(80)8) 如果给出一个表,在控制中心中没有生成DDL 选项,可能是下面的哪个原因?a) 这个表示系统对象b) 这个表是统计表c) 这个表被暂停挂起d) 这个表示镜像表.e) 这个表是由其他用户创建的9) 给出下面的两个表COUNTRYID NAME STAFFID CITIES1 Argentina 1 102 Canada 2 203 Cuba 2 104 Germany 1 05 France 7 5STAFFID LASTNAME1 Jones2 Smith下面的哪个语句可以从COUNTRY表中删除与STAFF表ID相同的记录?a) DELETE FROM country WHERE id IN (SELECT id FROM staff)b) DELETE FROM country WHERE id IN (SELECT person FROM staff)c) DELETE FROM country WHERE person IN (SELECT id FROM staff)d) DELETE FROM country WHERE person IN (SELECT person FROM staff)10) 表STOCK定义如下type CHAR (1)status CHAR(1)quantity INTEGERprice DEC (7,2)哪个语句可以设置type字段不是’S’的记录: STATUS为NULL,QUANTITY为0,price为0? (选择最可能的语句)a) UPDATE stock SET status='NULL', quantity=0, price=0 WHERE type <> 'S'b) UPDATE stock SET (status, quantity, price) = (NULL, 0, 0) WHERE type <> 'S'c) UPDATE stock SET (status, quantity, price) = ('NULL', 0, 0) WHERE type <> 'S'd) UPDATE stock SET status = NULL, SET quantity=0, SET price = 0 WHERE type <> 'S'11) 下面哪些内容不能设置autocommit自动提交?a) 嵌入式SQLb) 命令中心c) 命令行处理器d) DB2 调用接口12)下面的哪个语句可以在最终的结果表中去除那些重复的记录?a) SELECT UNIQUE * FROM t1b) SELECT DISTINCT * FROM t1c) SELECT * FROM DISTINCT T1d) SELECT UNIQUE (*) FROM t1e) SELECT DISTINCT (*) FROM t113) 给出下面的表STAFFID LASTNAME1 Jones2 Smith3 null下面的哪个语句可以删除lastname字段为空的记录?a) DELETE FROM staff WHERE lastname IS NULLb) DELETE ALL FROM staff WHERE lastname IS NULLc) DELETE FROM staff WHERE lastname = 'NULL'd) DELETE ALL FROM staff WHERE lastname = 'NULL'14)给出下面表的定义DEPARTMENTdeptno CHAR(3)deptname CHAR(30)mgrno INTEGERadmrdept CHAR(3)EMPLOYEEempno INTEGERfirstname CHAR(30)midinit CHARlastname CHAR(30)workdept CHAR(3)下面的哪个语句可以列出每个雇员的编号以及lastname,以及他们经理的雇员编号和lastname,并且包含没有经理管理的那些员工?(提示使用哪种连接?)a) SELECT e.empno, stname, m.empno, stname FROM employee e LEFT INNERJOIN department INNER JOIN employee m ON mgrno = m.empno ON e.workdept = deptnob) SELECT e.empno, stname, m.empno, stname, FROM employee e LEFT OUTER JOINdepartment INNER JOIN employee m ON mgrno = m.empno ON e.workdept = deptnoc) SELECT e.empno, stname, m.empno, stname FROM employee e RIGHT OUTER JOINdepartment INNER JOIN employee m ON mgrno = m.empno ON e.workdept = deptnod) SELECT e.empno, stname, m.empno, stname FROM employee e RIGHT INNER JOINdepartment INNER JOIN employee m ON mgrno = m.empno ONe.workdept = deptno15) 给出下面的表NAMESName NumberWayne Gretzky 99Jaromir Jagr 68Bobby Orr 4Bobby Hull 23Brett Hull 16Mario Lemieux 66Steve Yzerman 19Claude Lemieux 19Mark Messier 11Mats Sundin 13POINTSName PointsWayne Gretzky 244Jaromir Jagr 168Bobby Orr 129Bobby Hull 93Brett Hull 121Mario Lemieux 189PIMName PIMMats Sundin 14Bobby Orr 12Mark Messier 32Brett Hull 66Mario Lemieux 23Joe Sakic 94下面的哪个语句可以显示玩家的名字,号码,得分,以及PIM信息,并且玩家的名称必须在三张表中都要出现?a) SELECT , names.number, points.points, pim.pim FROM names INNER JOIN pointsON = INNER JOIN pim ON =b) SELECT , names.number, points.points, pim.pim FROM names OUTER JOIN pointsON = OUTER JOIN pim ON =c) SELECT , names.number, points.points, pim.pim FROM names LEFT OUTER JOINpoints ON = LEFT OUTER JOIN pim ON =d) SELECT , names.number, points.points, pim.pim FROM names RIGHT OUTER JOINpoints ON = RIGHT OUTER JOIN pim ON =16) 给出以下的表EMPLOYEEemp_num emp_name dept1 Adams 12 Jones 13 Smith 24 Williams 1DEPTdept_id dept_name1 Planning1 Support给出下面的语句:ALTER TABLE employeeADD FOREIGN KEY (dept) REFERENCES (dept_id)ON DELETE CASCADE在下面的语句中共有多少个工作单元需要处理?DELETE FROM dept WHERE dept_id=1a) 0b) 1c) 2d) 3e) 4f) 617. 根据需要存储姓名和雇员编号,当雇员被解雇时,下面的哪个数据类型不能用于保存雇员解雇日期?a) CLOBb) TIMEc) VARCHARd) TIMESTAMP18) 给出下面的事务"CREATE TABLE t1 (id INTEGER,CONSTRAINT chkid CHECK (id<100))" "INSERT INTO t1 VALUES (100)""COMMIT"事务处理的结果是什么?a) 插入了一个NULL值b) 擦如乐一个100c) 插入数据时,数据库拒绝插入100d) 一个名字叫做chkid的触发器被调用并验证数据19) 如果一张表中的一个或者多个字段使用了Check约束,下面的那个工具必须在Load装载数据之后执行?a) Reorgb) Checkc) Runstatsd) Image Copye) Set Integrity20) 给出下面的语句?CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1='a' WITH CHECK OPTION下满的哪个语句可以将数据插入到数据库中?a) INSERT INTO v1 VALUES (a)b) INSERT INTO v1 VALUES (b)c) INSERT INTO v1 VALUES ('b')d) INSERT INTO v1 VALUES ('a')e) INSERT INTO v1 VALUES ('ab')21) 如果一个应用程序使用了可重复读取的事务隔离级别,在下面哪种情况下可以释放更新锁?a) 关闭访问行的游标.b) 在事务中执行ROLLBACK指令c) 访问当前行的游标移动到下一行d) 通过使用UPDATE语句改变事务I22) Which of the following isolation levels is most likely to acquire a table level lock during an index scan?下面的哪种事务隔离级别要求在索引扫描期间使用表级锁?a) RSb) RRc) CSd) UR24) 下面哪种应用程序释放锁的方式适用于游标稳定性事务隔离级别?a) 访问当前行的游标移动到下一行b) 访问当前行的游标用于更新当前行c) 应用程序删除当前行d) 一个应用程序访问的当前行需要另外的应用程执行更新语句25 ) 给出下面的表STAFFID LASTNAME1 Jones2 Smith当执行SELECT * FROM staff 返回的行是按照哪种顺序输出的?a) 无序b) 主键顺序c) 插入到表中的记录顺序The order that the rows were inserted into the tabled) 先按ID列上的值,然后按LASTNAME列上的值26) 下面的语句将要创建多少个索引?Create table mytab(Col1 int not null primary key,Col2 char(64),Col3 char(32),Col4 int not null,constraint c4 unique (Col4,Col1))a) 0b) 1c) 2d) 3e) 426) 给出下面的表COUNTRYID NAME PERSON CITIES1 Argentina 1 102 Canada 2 203 Cuba 2 104 Germany 1 05 France 7 5STAFFID LASTNAME1 Jones2 Smith下面的语句:INSERT INTO staff SELECT person, 'Greyson' FROM country WHERE person > 1有多少条记录插入到数据库?a) 0b) 1c) 2d) 327) 给出下面表的定义和授予特权的语句?CREATE TABLE table1 (col1 INT, col2 CHAR(40), col3 INT)GRANT INSERT, UPDATE, SELECT, REFERENCES ON TABLE table1 TO USER usera下面的哪个语句可以撤销USERA在COL1和COL2的特权?(注意授予特权的语句)a) REVOKE UPDATE ON TABLE table1 FROM USER userab) REVOKE ALL PRIVILEGES ON TABLE table1 FROM USER userac) REVOKE ALL PRIVILEGES ON TABLE table1 COLUMNS (col1, col2) FROM USERAd) REVOKE REFERENCES ON TABLE table1 COLUMNS (col1, col2) FROM USER usera28) 给出CREATE TABLE t1 (c1 CHAR(4) NOT NULL). 哪个值可以插入到表中?a) 4b) NULLc) ‘abc’d) ‘abcde’29) 下面的哪个设置,不允许被引用的主键字段在子表中还存在,就删除主表中的数据?a) DELETEb) CASCADEc) RESTRICTd) SET NULL30) 给出两个表的定义ORGdeptnumb INTEGERdeptname CHAR(30)manager INTEGERdivision CHAR(30)location CHAR(30)STAFFid INTEGERname CHAR(30)dept INTEGERjob CHAR(30)years CHAR(30)salary DECIMAL(10,2)comm DECIMAL(10,2)下面的哪个语句可以显示每个部门的名称,并且按照字母顺序升序排列,以及部门经理的名称?a) SELECT a.deptname, FROM org a, staff b WHERE a.manager=b.idb) SELECT a.deptname, FROM org a, staff b WHERE b.manager=a.idc) SELECT a.deptname, FROM org a, staff b WHERE a.manager=b.id order BY a.deptname, d) SELECT a.deptname, FROM org a, staff b, WHERE b.manager=a.id GROUP BY a.deptname, 二简答题( 每题3分,共30分)1 简述SQL语言的分类及其作用?DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)2 什么是谓词?举出10个常见的谓词? (提示经常在where中需要用到的符号) in between like exists is contains3 char类型和varchar类型的区别? graphic和vargraphic的区别用于存储固定长度的字符串可变长度的字符串GRAPHIC 用于存储固定长度的双字节字符串4 什么是数据库的实例?怎样查看系统的中的实例?怎样切换实例?怎样查看实例中的数据库?怎样启动实例?怎样连接数据库? 怎样改变语句结束符?实例是数据库管理器的逻辑环境,可以在实例中5 简述DB2中常见的数据库对象?重点阐述表、索引、视图和模式的概念表空间缓冲池表索引序列视图模式别名存储过程触发器表是一组相关数据逻辑安排的行和列索引是有序键值的集合视图是将一个或者多个表生成的虚拟表,是存储在数据库的sql模式,是数据库对象的命名空间,讲对象逻辑分组6 简述COUNT、SUM、AVG、STDDEV、MAX、MIN函数的作用计算区域中满足个定条件的单元格个数给定条件的数据求和求给定条件的数据的平均值计算标准差7 简述DB2种的约束的类别?并分别写出SQL,怎样使用该约束? (提示:表的字段可以简洁)Not null约束主键约束唯一性约束外间约束,检查约束Create table tablename (a int not null,B varchar(20))Pri mary k ey foreign key constaint b check(b between 1 an 100)8 什么是主表和从表?主键所在的表外面所在的表9 什么是CS,RS,US,RR?US如果是读取操作,不产生任何的行级别锁,非读取同CSCS锁住当前处理记录RS 锁定所有符合条件的记录RR 锁住所有相关记录10 什么是分组语句?where和having子句的区别?请举例说明作用对象不同,WHERE子句作用于基本表或视图,从中选择满足条件的记录;HAVING子句作用于组,从中选择满足条件的组。