资源预览内容
第1页 / 共27页
第2页 / 共27页
第3页 / 共27页
第4页 / 共27页
第5页 / 共27页
第6页 / 共27页
第7页 / 共27页
第8页 / 共27页
第9页 / 共27页
第10页 / 共27页
亲,该文档总共27页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
吉林大学DB2实验报告班级: 姓名:学号:姓名学号实验项目3. Create objects实验性质演示性实验 验证性实验 操作性实验 综合性实验实验地点机器编号指导教师实验时间年 月 日 时 分一、实验综述1. 实验目的及要求This exercise is an online lab which creates objects used in a database.At the end of the lab, students should be able to: Create tables Add referential integrity constraints to a table Create indexes Add check constraints to a table Create views Add triggers to a table Create an alias Access System Catalog information about objects Retrieve an XML document2. 实验设备、软件PC,windowsXP Professional,DB29Express-c二、实验过程(实验步骤、记录、数据、分析)Section 1 - Create Tables1. Create your ARTISTS table. The table should have the following characteristics. Table schema of student Table Name of artists Regular data to go in table space dms01 Indexes to go in table space dms02 Long data to go in table space dms03 The column artno should be defined as a primary key Columns defined like the following: ( artno smallint not null, name varchar (50), classification char (1) not null, bio clob (100K) logged compact, picture blob (500k) not logged compact)Show your work below by printing screen.手动创建表空间dms01,dms02,dms03,如下:执行SQL语句结果如下:2. Verify the creation of your ARTISTS table and the table description. Important: Ensure the definition of your table is correct. It could cause unexpected failures in later labs if your definitions are not done correctly.Show your work below by printing screen.3. You will create the remainder of the tables required using a script file called crtables. For Windows, it is located in the C:labfilescf23 directory.Examine the DB2 statements in the file and answer the following questions. In which table space will both the indexes and data for table STOCK be placed? For CONCERTS? For REORDER?4. Execute the crtables script to create the tables.Show your work below by printing screen5. Verify that all tables (ALBUMS, STOCK, CONCERTS, and REORDER) were created successfully.Show your work below by printing screen.6. Information about each column in a table can be found by accessing the SYSCAT.COLUMNS view. Enter an interactive SQL statement to select the columns TABNAME, COLNAME, and TYPENAME from SYSCAT.COLUMNS for all tables with the TABSCHEMA of student, order the data by TABNAME and COLNO, and pipe the output to a file named tabchk.file.Show your sql statements and your work below by printing screen for the last step.7. Check your output against the tabchk.master file. Ensure that there are no differences between your output and the master output or the following labs may not work correctly!Show your work below by printing screen.8. Information about a tables definition to a table space can be found by accessing the SYSCAT.TABLES view. Enter an SQL statement to select the columns TABNAME, TBSPACE, and INDEX_TBSPACE from SYSCAT.TABLES for all tables with the TABSCHEMA of student, order the data by TABNAME, and pipe the output to a file named tbschk.file.Show your sql statements and your work below by printing screen for the last step.9. Check your output against the tbschk.master file. Ensure that there are no differences between your output and the master output, or the following labs may not work correctly!Show your work below by printing screen.10. Grant select privilege on tables that are owned by student to public by executing a script file, grants (an operating system command file) for local administration. Show your work below by printing screen.Section 2 - Create Indexes 1. Create an index called ITEM on the ITEMNO column in STOCK table.Show your work below by printing screen.2. Create a unique index called ITEMNO on the ITEMNO column in ALBUMS table. Show your work below by printing screen.3. Select the information from the catalog tables about your indexes. The columns you should select are the first 18 characters of TABNAME, UNIQUERULE, the first 18 characters of INDNAME, and the first 30 characters of COLNAMES from SYSCAT.INDEXES, where INDSCHEMA is student, order by TABNAME and INDNAME. If UNIQUERULE = U, then only unique values are allowed. If UNIQUERULE = D, then duplicate values are allowed. If UNIQUERULE = P, then it is a Primary key. Show your work and your new indexes below by printing screen.4. Use the select you executed in the previous step and route the output to indchk.file. Check your results against indchk.master. Ensure that there are no differences between your output and the master output, or the following labs may not work correctly!Show your work below by printing screen.Section 3 - Create Views1. Create a view called music that will select title, classification, name from albums, artists where artists.artno
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号