Exercise 2.2.1a
For relation Accounts, the attributes are:
Exercise 2.2.1b
For relation Accounts, the tuples are:
(12345, savings, 12000),
Exercise 2.2.1c
For relation Accounts and the first tuple, the components are:
123456 acctNo
Exercise 2.2.1d
For relation Accounts, a relation schema is:
Exercise 2.2.1e
An example database schema is:
Accounts (
)
Exercise 2.2.1f
A suitable domain for each attribute:
acctNo Integer
Exercise 2.2.1g
Another equivalent way to present the Account relation:
acctNo
balance
type
34567
25
savings
23456
1000
checking
12345
12000
savings
Another equivalent way to present the Customers relation:
idNo
firstName
lastName
account
805-333
Lena
Hand
23456
Exercise 2.2.2
Examples of attributes that are created for primarily serving as keys in a relation:
Exercise 2.2.3a
Exercise 2.2.3b
Exercise 2.2.3c
Exercise 2.3.1a
CREATE TABLE Product (
);
Exercise 2.3.1b
CREATE TABLE PC (
805-333
Lena
Hand
12345
901-222
Robbie
Banks
12345
);
Exercise 2.3.1c
CREATE TABLE Laptop (
);
Exercise 2.3.1d
CREATE TABLE Printer (
);
Exercise 2.3.1e
ALTER TABLE Printer DROP color;
Exercise 2.3.1f
Exercise 2.3.2a
CREATE TABLE Classes (
);
Exercise 2.3.2b
CREATE TABLE Ships (
);
Exercise 2.3.2c
);
Exercise 2.3.2d
CREATE TABLE Outcomes (
);
Exercise 2.3.2e
ALTER TABLE Classes DROP bore;
Exercise 2.3.2f
Exercise 2.4.1a
R1 := σspeed ≥ 3.00 (PC)
Exercise 2.4.1b
R1 := σhd ≥ 100 (Laptop)
Exercise 2.4.1c
R1 := σmaker=B (Product PC)
R2 := σmaker=B (Product Laptop)
R3 := σmaker=B (Product Printer)
649
630
1049
1429
Exercise 2.4.1d
R1 := σcolor = true AND type = laser (Printer)
model
3003
3007
Exercise 2.4.1e
R1 := σtype=laptop (Product)
F
G
Exercise 2.4.1f
maker
E
A
B
F
G
R1 := ρPC1(PC)
R2 := ρPC2(PC)
Exercise 2.4.1g
R1 := ρPC1(PC)
R2 := ρPC2(PC)
Exercise 2.4.1h
R1 := πmodel(σspeed ≥ 2.80(PC)) πmodel(σspeed ≥ 2.80(Laptop))
R2 := πmaker,model(R1 Product)
Exercise 2.4.1i
R1 := πmodel,speed(PC)
R2 := πmodel,speed(Laptop)
R3 := R1 R2
Exercise 2.4.1j
R1 := πmaker,speed(Product PC)
R2 := ρR2(maker2,speed2)(R1)
Exercise 2.4.1k
R1 := πmaker,model(Product PC)
R2 := ρR2(maker2,model2)(R1)
R3 := ρR3(maker3,model3)(R1)
R4 := ρR4(maker4,model4)(R1)
Exercise 2.4.2a
πmodel
Exercise 2.4.2b
πmaker
Exercise 2.4.2c
πmodel,price
πmodel,price
πmodel,price
Exercise 2.4.2d
πmodel
Exercise 2.4.2e
πmaker
πmaker
Exercise 2.4.2f
πhd
Exercise 2.4.2g
πPC1.model,PC2.model
Exercise 2.4.2h
(maker = maker2 AND model <> model2)
πmaker
Exercise 2.4.2i
Product
πmaker
Exercise 2.4.2j
(maker3 = maker AND speed3 <> speed2 AND speed3 <> speed)
πmaker
Exercise 2.4.2k