State & City Management

States

IdState NameRemove

Add State


Cities

IdCity NameState NameIs CapitalInfoRemove

Add City


Find City Details


Business requirement — Database Operation 12

Prevent accidental removal of a state that is referenced by City records.

  1. Before deleting a state, count its related cities.
  2. If the count is greater than zero, do not delete.
  3. Show a clear message explaining that its cities must be removed first.
  4. Allow deletion when no city references the state.