• As your default is 0 (not null) this must be in the accounts table.

    Example:

    Accounts PK values {0,1,2,3,4...}

    Customer (Account FK) values {1,2,3,2,3,2,1,2,3,4...}

    When you delete the values from Accounts this attempts to change the Customers to

    Accounts PK values {} [empty set]

    Customer (Account FK) values {0,0,0,0,0,0,0,0,0...} which is invalid due to the PK-FK constraint

    If you were to change the Customer (Account FK) to set NULL rather than set DEFAULT then it would work, assuming that the FK allows NULLs.

    Probably best to delete the rows from FK to PK and not rely upon the set default or set null.

    The customers are deleted by the second DELETE statement.

    Fitz