You can select tables and attributes for your query from an available database schema.
Click the Query icon in the Properties window.
Click the Database Lookup icon.
Select the tables and attributes you want to use in the query and click OK.