1 / 15
文档名称:

数据库系统基础教程第二章答案.docx

格式:docx   大小:122KB   页数:15页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

数据库系统基础教程第二章答案.docx

上传人:森林书屋 12/7/2022 文件大小:122 KB

下载得到文件列表

数据库系统基础教程第二章答案.docx

相关文档

文档介绍

文档介绍:该【数据库系统基础教程第二章答案 】是由【森林书屋】上传分享,文档一共【15】页,该文档可以免费在线阅读,需要了解更多关于【数据库系统基础教程第二章答案 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。ExerciserelationAccounts,theattributesare:
acctNo,type,balance
ForrelationCustomers,theattributesare:
firstName,lastName,idNo,account
ExerciserelationAccounts,thetuplesare:
(12345,savings,12000),
(23456,checking,1000),
(34567,savings,25)
ForrelationCustomers,thetuplesare:
(Robbie,Banks,901-222,12345),
(Lena,Hand,805-333,12345),
(Lena,Hand,805-333,23456)
ExerciserelationAccountsandthefirsttuple,thecomponentsare:
123456acctNo
savingstype
12000balance
ForrelationCustomersandthefirsttuple,thecomponentsare:
RobbiefirstName
BankslastName
901-222idNo
12345account
ExerciserelationAccounts,arelationschemais:
Accounts(acctNo,type,balance)
ForrelationCustomers,arelationschemais:
Customers(firstName,lastName,idNo,account)
Exerciseexampledatabaseschemais:
Accounts(
acctNo,
type,
balance
)
Customers(
firstName,
lastName,
idNo,
account
)
Exercisesuitabledomainforeachattribute:
acctNoInteger
typeString
balanceInteger
firstNameString
lastNameString
idNoString(becausethereisahyphenwecannotuseInteger)
accountInteger
ExerciseequivalentwaytopresenttheAccountrelation:
acctNo
balance
type
34567
25
savings
23456
1000
checking
12345 12000 savings
AnotherequivalentwaytopresenttheCustomersrelation:
idNo
firstName
lastName
account
805-333
Lena
Hand
23456
805-333
Lena
Hand
12345
901-222
Robbie
Banks
12345
Exerciseofattributesthatarecreatedforprimarilyservingaskeysinarelation:
UniversalProductCode(UPC)usedwidelyinUnitedStatesandCanadatotrackproductsinstores.
SerialNumbersonawidevarietyofproductstoallowthemanufacturertoindividuallytrackeachproduct.
VehicleIdentificationNumbers(VIN),auniqueserialnumberusedbytheautomotiveindustrytoidentifyvehicles.
Exercisecanorderthethreetuplesinanyof3!=,thecolumnscanbeorderedinanyof3!=,thenumberofpresentationsis6*6=36.
Exercisecanorderthethreetuplesinanyof5!=,thecolumnscanbeorderedinanyof4!=,thenumberofpresentationsis120*24=2880
Exercisecanorderthethreetuplesinanyofm!,thecolumnscanbeorderedinanyofn!,thenumberofpresentationsisn!m!
ExerciseTABLEProduct(
maker CHAR(30),
model CHAR(10)PRIMARYKEY,
typeCHAR(15)
);
ExerciseTABLEPC(
modelCHAR(30),
speedDECIMAL(4,2),
ramINTEGER,
hdINTEGER,
priceDECIMAL(7,2)
);
ExerciseTABLELaptop(
modelCHAR(30),
speedDECIMAL(4,2),
ramINTEGER,
hdINTEGER,
screenDECIMAL(3,1),
priceDECIMAL(7,2)
);
ExerciseTABLEPrinter(
modelCHAR(30),
colorBOOLEAN,
typeCHAR(10),
priceDECIMAL(7,2)
);
ExerciseTABLEPrinterDROPcolor;
ExerciseTABLELaptopADDodCHAR(10)DEFAULT‘none’;
ExerciseTABLEClasses(
classCHAR(20),
typeCHAR(5),
countryCHAR(20),
numGunsINTEGER,
boreDECIMAL(3,1),
displacementINTEGER
);
ExerciseTABLEShips(
nameCHAR(30),
classCHAR(20),
launchedINTEGER
);
ExerciseTABLEBattles(
nameCHAR(30),
dateDATE
);
ExerciseTABLEOutcomes(
shipCHAR(30),
battleCHAR(30),
resultCHAR(10)
);
ExerciseTABLEClassesDROPbore;
ExerciseTABLEShipsADDyardCHAR(30);
Exercise
R1
:=speedσ≥(PC)
R2
:=πmodel(R1)
model
1005
1006
1013
Exercise
R1:=
hdσ≥100(Laptop)
R2
:=Product
(R1)
R3
:=πmaker(R2)
maker
E
A
B
F
G
Exercise
R1:=
maker=Bσ
(Product
PC)
R2
:=
maker=Bσ
(Product
Laptop)
R3
:=
maker=Bσ
(Product
Printer)
R4
:=
model,priceπ
(R1)
R5
:=
model,priceπ
(R2)
R6:=
model,priceπ
(R3)
R7
:=R4R5
R6
model
price
1004
649
1005
630
1006
1049
2007
1429
Exercise
R1
:=colorσ=trueANDtype=laser
(Printer)
R2
:=
modelπ(R1)
model
3003
3007
Exercise
R1:=type=laptopσ(Product)
R2:=type=PCσ(Product)
R3:=makerπ(R1)
R4:=makerπ(R2)
R5:=R3–R4
maker
F
G
Exercise
R1
:=
PC1ρ(PC)
R2
:=
PC2ρ(PC)
R3
:=R1
=AND<>R2
R4
:=
hdπ(R3)
hd
250
80
160
Exercise
R1
:=
PC1ρ(PC)
R2
:=
PC2ρ(PC)
R3
:=R1
=AND=AND<R2
R4
:=
,(R3)π
1004
1012
Exercise
R1
:=πmodel(σspeed≥(PC))
πmodel(σspeed
≥(Laptop))
R2
:=
maker,modelπ
(R1
Product)
R3
:=
R3(maker2,model2)ρ
(R2)
R4
:=R2
(maker=maker2ANDmodel<>model2)
R3
R5
:=
makerπ(R4)
maker
B
E
Exercise
R1
:=
model,speedπ
(PC)
R2
:=
model,speedπ
(Laptop)
R3
:=R1
R2
R4
:=
R4(model2,speed2)ρ
(R3)
R5
:=
model,speedπ
(R3
(speed<speed2)R4)
R6
:=R3–R5
R7
:=
makerπ(R6
Product)
maker
B
Exercise
R1
:=
maker,speedπ
(Product
PC)
R2
:=
ρ
(R1)
R2(maker2,speed2)
R3
:=
R3(maker3,speed3)ρ
(R1)
R4
:=R1
(maker=maker2ANDspeed<>speed2)
R2
R5
:=R4
(maker3=makerANDspeed3<>speed2ANDspeed3<>speed)R3
R6
:=
makerπ(R5)
maker
A
D
E
Exercise
R1
:=
π
(Product
PC)
maker,model
R2
:=
R2(maker2,model2)ρ
(R1)
R3
:=
R3(maker3,model3)ρ
(R1)
R4
:=
R4(maker4,model4)ρ
(R1)
R5
:=R1
(maker=maker2ANDmodel<>model2)R2
R6
:=R3
(maker3=makerANDmodel3<>model2ANDmodel3<>model)R5
R7
:=R4
(maker4=makerAND(model4=modelORmodel4=model2ORmodel4=model3))R6
R8
:=makerπ(R7)
maker
A
B
D
E
π
model
σspeed≥
PC
Exercise
π
model,price
σ
maker=B

πmaker
σhd≥100 Product
Laptop
πmodel,price πmodel,price
σ
σmaker=B
maker=B
Printer Product Laptop Product PC Product
πmodel
σ
color=trueANDtype=laser


πmaker πmaker
σtype=PC σtype=laptop
Printer Product Product
πhd
(=<>)
ρ ρ
PC2 PC1
PC PC
,
(==<)
ρPC2 ρPC1
PC PC
π
maker
(maker=maker2ANDmodel<>model2)
ρR3(maker2,model2)
π
maker,model
Product
πmodel πmodel
σspeed≥ σspeed≥
PC Laptop
πmaker
– Product
πmodel,speed
(speed<speed2)
ρR4(model2,speed2)
πmodel,speed πmodel,speed
PC Laptop
πmaker
(maker3=makerANDspeed3<>speed2ANDspeed3<>speed)
(maker=maker2ANDspeed<>speed2)
ρR2(maker2,speed2) ρR3(maker3,speed3)
πmaker,speed
Product PC
πmaker
(maker4=makerAND(model4=modelORmodel4=model2ORmodel4=model3))
(maker3=makerANDmodel3<>model2ANDmodel3<>model)
(maker=maker2ANDmodel<>model2)
ρ ρ ρ
R2(maker2,model2) R3(maker3,model3) R4(maker4,model4)
πmaker,model
Product PC
R1:=σbore≥
(Classes)
R2:=class,countryπ(R1)
class

country
Iowa
NorthCarolina
Yamato

USA
USA
Japan
Exercise

R1:=

launchedσ<1921

(Ships)
R2:=

nameπ(R1)
name
Haruna
Hiei
Kirishima
Kongo
Ramillies
Renown
Repulse
Resolution