Professional Documents
Culture Documents
Ex1:
a. R := π(Name, SellPrice) (σ(SuplierName = ”Samsung” && type = ”television” )
(Product ⋈ Supplier))
b. R := π(SuplierName, Address) (σ(type = ”television” ) (Product ⋈
Supplier))
c. R := π(FullName) (σ(BirthDate ≥ 01/01/1983 && BirthDate ≤ 31/12/1983)
(Employee))
d. R := π(Name, Type) (σ(SellDate = 23/05/2018) ((InvoiceLine ⋈
Invoice) ⋈ Product))
e. R := π(FullName) (σ(Gender = “female” && Type = “television”)
((InvoiceLine ⋈ Invoice) ⋈ Product) ⋈ Employee))
f. R1 := π(SupplierName, Address) (σ(Type = “television” (Product ⋈
Supplier))
R2 := π(SupplierName, Address) (σ(Type = “mobile” ) (Product ⋈
Supplier))
R := R1 ⋂ R2
g. R := π(Name, Price) (σ(FullName = “Nguyễn Văn A” && SellDate ≥ 1/4/2018 &&
SellDate ≤ 30/4/2018) (((InvoiceLine ⋈ Invoice) ⋈ Product) ⋈
Employee))
h. R := π(Name, Price) (σ(Type = “mobile” && Supplier = “Samsung” && SellDate ≥
1/4/2018 && SellDate ≤ 30/4/2018) ((InvoiceLine ⋈ Invoice) ⋈
Product))
i. R1 : = ρ(Product)
R2 : = ρ(Product)
R3 := σR1(R1 ⋈ϴ R2)
ϴ = R1.SellPrice < R2.SellPrice
R := R1 – R3
j. R := π(amount = Quantity*SellPrice) (σ(SellDate = 30/4/2018)
e. σ(Quantity) ≤ 0 (InvoiceLine) = ∅
f. (π(InvoceID) (Invoice) – π(InvoiceID) (InvoiceLine) = ∅)
&& (π(ProductCode) (InvoiceLine) – π(ProductCode) (Invoice)
=∅)
g. σ(PurchasePrice < 500000 && SellPrice > 9000000) (Product) = ∅
h. σ(SellPrice > 2*PurchasePrice) (Product) = ∅
i. σ(Gender <> “Nam” && Gender <> “Nữ”) (Employee) = ∅
j. R1 := ρ(Product)
R2 := ρ(R1)
σ(R1.PurchasePrice = R2.PurchasePrice && |R1.SellPrice – R2.SellPrice| >