The options can either be specified via the [[Commands#Set|Set]] command or via XQuery. The following operations create an attribute index for all {{Code|id}} and {{Code|name}} attributes:
; Commands
<pre class="brush:xml">
SET ATTRINDEX id,name
CREATE DB factbook http://files.basex.org/xml/factbook.xml'
# Restore default:
SET ATTRINDEX
</pre>
; XQuery
<pre class="brush:xquery">
db:create('factbook', 'http://files.basex.org/xml/factbook.xml', '', map { 'attrinclude': 'id,name' })