import re


def add_select(query: str) -> str:
    """If the query doesn't start with SELECT or WITH, add it."""
    # Note: doesn't work if there are comments in the beginning of the query
    if re.match(r"\s*(SELECT|WITH)\b", query, re.I):
        return query
    else:
        return "SELECT " + query