Select the facts, measures and define the aggregation functions.
apply_select_fact(db, sq)
db
A star_database object.
star_database
sq
A star_query object.
star_query