Renaming and Line Up Your Columns

Renaming columns is a very useful feature. If you just leave the column, in the SELECT section, as is, that will be the column name.

In this query, the third column is rename “Activity Owner” which makes more sense in the Activities table instead of either “Task Owner Name”, “Call Owner”, or “Meeting Owner”.

You’ll also note that you can hard-code in values to new columns you create. To specify whether a record is from the Calls, Meetings, or Tasks table, in each sub-query, we hard-code in ‘Task’, ‘Meeting’, or ‘Call’ as the activity type. In any reports we then build, we can then filter by the Activity Type.

In terms of syntax, surround “column names” with double quotes if there are any special characters or spaces in the name. If not, you can write it as it with no quotes. Use ‘single quotes’ for hard-coded values and renaming.