数据库系统基础教程第二章答案解析

上传人:cn****1 文档编号:508434292 上传时间:2022-10-05 格式:DOC 页数:21 大小:1.27MB
返回 下载 相关 举报
数据库系统基础教程第二章答案解析_第1页
第1页 / 共21页
数据库系统基础教程第二章答案解析_第2页
第2页 / 共21页
数据库系统基础教程第二章答案解析_第3页
第3页 / 共21页
数据库系统基础教程第二章答案解析_第4页
第4页 / 共21页
数据库系统基础教程第二章答案解析_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《数据库系统基础教程第二章答案解析》由会员分享,可在线阅读,更多相关《数据库系统基础教程第二章答案解析(21页珍藏版)》请在金锄头文库上搜索。

1、ExerciseFor relation Accounts, the attributes are:acctNo, type, balanceFor relation Customers, the attributes are:firstName, lastName, idNo, accountExerciseFor relation Accounts, the tuples are:(12345, savings, 12000),(23456, checking, 1000),(34567, savings, 25)For relation Customers, the tuples are

2、:(Robbie, Banks, 901-222, 12345),(Lena, Hand, 805-333, 12345),(Lena, Hand, 805-333, 23456)ExerciseFor relation Accounts and the first tuple, the components are:123456 acctNosavings type12000 balanceFor relation Customers and the first tuple, the components are:Robbie firstNameBanks lastName901-222 i

3、dNo12345 accountExerciseFor relation Accounts, a relation schema is:Accounts(acctNo, type, balance)For relation Customers, a relation schema is:Customers(firstName, lastName, idNo, account)ExerciseAn example database schema is:Accounts (acctNo,type,balance)Customers (firstName,lastName,idNo,account)

4、ExerciseA suitable domain for each attribute:acctNo Integertype Stringbalance IntegerfirstName StringlastName StringidNo String (because there is a hyphen we cannot use Integer)account IntegerExerciseAnother equivalent way to present the Account relation:acctNobalancetype3456725savings234561000check

5、ing1234512000savingsAnother equivalent way to present the Customers relation:idNofirstNamelastNameaccount805-333LenaHand23456805-333LenaHand12345901-222RobbieBanks12345Examples of attributes that are created for primarily serving as keys in a relation:Universal Product Code (UPC) used widely in Unit

6、ed States and Canada to track products in stores.Serial Numbers on a wide variety of products to allow the manufacturer to individually track each product.Vehicle Identification Numbers (VIN), a unique serial number used by the automotive industry to identify vehicles.We can order the three tuples i

7、n any of 3! = 6 ways. Also, the columns can be ordered in any of 3! = 6 ways. Thus, the number of presentations is 6*6 = 36.We can order the three tuples in any of 5! = 120 ways. Also, the columns can be ordered in any of 4! = 24 ways. Thus, the number of presentations is 120*24 = 2880We can order t

8、he three tuples in any of m! ways. Also, the columns can be ordered in any of n! ways. Thus, the number of presentations is n!m!CREATE TABLE Product (makerCHAR(30),modelCHAR(10) PRIMARY KEY,type CHAR(15);CREATE TABLE PC (model CHAR(30),speed DECIMAL(4,2),ram INTEGER,hd INTEGER,price DECIMAL(7,2);CRE

9、ATE TABLE Laptop (model CHAR(30),speed DECIMAL(4,2),ram INTEGER,hd INTEGER,screen DECIMAL(3,1),price DECIMAL(7,2);CREATE TABLE Printer (model CHAR(30),color BOOLEAN,type CHAR (10),price DECIMAL(7,2);ALTER TABLE Printer DROP color;ALTER TABLE Laptop ADD od CHAR (10) DEFAULT none;CREATE TABLE Classes

10、(class CHAR(20),type CHAR(5),country CHAR(20),numGuns INTEGER,bore DECIMAL(3,1),displacement INTEGER);CREATE TABLE Ships (name CHAR(30),class CHAR(20),launched INTEGER);CREATE TABLE Battles (name CHAR(30),date DATE);CREATE TABLE Outcomes (ship CHAR(30),battle CHAR(30),result CHAR(10);ALTER TABLE Cla

11、sses DROP bore;ALTER TABLE Ships ADD yard CHAR(30);R1 := speed 3.00 (PC)R2 := model(R1)model100510061013R1 := hd 100 (Laptop)R2 := Product (R1)R3 := maker (R2)makerEABFGR1 := maker=B (Product PC)R2 := maker=B (Product Laptop)R3 := maker=B (Product Printer)R4 := model,price (R1)R5 := model,price (R2)

12、R6: = model,price (R3)R7 := R4 R5 R6modelprice100464910056301006104920071429R1 := color = true AND type = laser (Printer)R2 := model (R1)model30033007R1 := type=laptop (Product)R2 := type=PC(Product)R3 := maker(R1)R4 := maker(R2)R5 := R3 R4makerFGR1 := PC1(PC)R2 := PC2(PC)R3 := R1 (PC1.hd = PC2.hd A

13、ND PC1.model PC2.model) R2R4 := hd(R3)hd25080160R1 := PC1(PC)R2 := PC2(PC)R3 := R1 (PC1.speed = PC2.speed AND PC1.ram = PC2.ram AND PC1.model PC2.model) R2R4 := PC1.model,PC2.model(R3)PC1.modelPC2.model10041012R1 := model(speed 2.80(PC) model(speed 2.80(Laptop)R2 := maker,model(R1 Product)R3 := R3(maker2,model2)(R2)R4 := R2 (maker = maker2 AND model model2) R3R5 := maker(R4)makerBER1 := model,speed(PC)R2 := model,speed(Laptop)R3 := R1 R2R4 := R4(model2,speed2)(R3)R5 := model,sp

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 习题/试题

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号