Skip to main content

RA: delete loans under 1000

Short answer

Subtract loans with amt < 1000 from Loan using assignment: Loan ← Loan - σ amt < 1000 (Loan).

Consider the relational schema: Acc (a_no, b_name, bal) Branch (b_name, b_city, assets) Customer (c_name, c_street, c_city) Loan (l_no, b_name, amt) Depositor (c_name, a_no) Borrower (c_name, l_no) Delete all loans less than $1000 in amount. (Write a relational algebra expression.)

Relational algebra symbols used: σ select, π project, ⋈ natural join, ∪ union, ∩ intersection, − difference, ρ rename, 𝒢 aggregate.

In relational algebra, deletion is written as an assignment: the relation is replaced by itself minus the tuples to delete.

Relational algebra expression

Loan ← Loan − σ amt < 1000 (Loan)

Explanation

  1. σ amt < 1000 (Loan) selects every loan below $1000.
  2. Subtracting these tuples from Loan removes them, and the remaining loans (amt ≥ 1000) are assigned back to Loan.
  3. The schema (l_no, b_name, amt) is unchanged.

If Borrower still refers to a deleted loan, those tuples should also be removed to keep referential integrity. This step must run before the Loan deletion above, because it needs the old Loan tuples to find the small loans:

Borrower ← Borrower − π c_name, l_no ( Borrower ⋈ σ amt < 1000 (Loan) )

Equivalent SQL

DELETE FROM Loan WHERE amt < 1000;

✓ Answer checked by Claude Opus 5.5 (high effort)

All Database Management System chapter 3 questions →