较为高效的SQL:

          DELETE FROM 
        B
      WHERE NOT EXISTS(
          SELECT 1
          FROM
            A
          WHERE
            B.id=A.id
      )