def create_queries(query_names):
    """Create a dictionary of queries to be run"""
    queries = []
    # Create a query to select the 3 most popular articles of all time
    queries.append("""
        SELECT r.title, COUNT(l.path)::TEXT || ' views' AS popular_articles
        FROM articles AS r
        INNER JOIN log AS l
        ON r.slug = RIGHT(l.path,LENGTH(r.slug))
        GROUP BY r.title
        ORDER BY COUNT(l.path) DESC
        LIMIT 3;
        """)

    # Create a query to select the most popular authors of all time
    queries.append("""
        SELECT a.name, count(l.path) || ' views' AS calls
        FROM log AS l
        INNER JOIN
        (SELECT a.name AS name, art.title AS title, art.slug AS slug
        FROM authors AS a
        INNER JOIN articles AS art
        ON art.author = a.id
        ) AS a
        ON a.slug = RIGHT(l.path,LENGTH(a.slug))
        GROUP BY a.name
        ORDER BY calls DESC
        LIMIT 5;
        """)

    # Create a query to select days where more than 1% of
    # server requests resulted in errors
    queries.append("""
        SELECT de.day, ROUND((num_errors::NUMERIC / requests::NUMERIC * 100),1)
        AS perc_error
        FROM log
        INNER JOIN daily_errors as de
        ON TO_CHAR(DATE_TRUNC('day', log.time),'FMMonth, DD, YYYY') = de.day
        INNER JOIN daily_requests AS dr
        ON de.day = dr.day
        WHERE (num_errors::NUMERIC / requests::NUMERIC * 100) > 1
        GROUP BY de.day, perc_error
        ORDER BY de.day;
        """)

    query_dict = dict(zip(query_names, queries))
    return query_dict