Can I publish a book and source code in the book under different licenses?
<p>Can I publish a book and the source code in the book under two different licenses?<br>
Eg. Publish a book under the GNU FDL license, but license the source code examples in this book under the Apache license?</p>

<p>As long as you own the copyright to the works, you can even publish the <a href="http://www.linuxinsider.com/story/38172.html">source code itself under two different licenses</a>, which can be radically different. For example, <a href="https://www.mysql.com/about/legal/licensing/foss-exception/#3">MySQL</a> is licensed under both a commercial and an open-source license. </p>

<p>Given that you can publish a single piece of work as multiple licenses, it is your choice which one you wish to grant to the book or the code, as long as you own the copyright. </p>

copyright licensing