Standard I am not a lawyer; this is not legal advice disclaimer applies.
When you write your posts, you hold the copyright. As such, you have final control over who can publish the material. When you post them on the Stack Exchange network, you grant a non-exclusive perpetual CC-BY-SA license to Stack Exchange. What this means is that anyone can reuse and modify your material's posts so long as (1) they attribute you appropriately, and (2) their work also has a CC-BY-SA license.
However, you are not bound by the CC-BY-SA license, since you are the copyright holder. Therefore, you can continue to use your work in any form you choose, including publishing them in a book.
This, however, does not stop anyone from finding the original posts on Stack Exchange and reusing them from here (following the attribution guidelines), as they have the Creative Commons license you granted when you published the material on Stack Exchange. Any new material, however, would be entirely protected since you have not granted CC-BY-SA on those.