def post_list_mentions(db, usernick, limit=50):
    """Return a list of posts that mention usernick, ordered by date
    db is a database connection (as returned by COMP249Db())
    return at most limit posts (default 50)

    Returns a list of tuples (id, timestamp, usernick, avatar,  content)
    """
    cursor = db.cursor()
    search_nick = '%@' + usernick + '%'

    sql = """SELECT id, timestamp, usernick, avatar, content
    FROM posts JOIN users
    ON posts.usernick=users.nick
    WHERE content LIKE (?)
    ORDER BY timestamp
    DESC LIMIT (?);"""
    cursor.execute(sql, (search_nick, limit))

    result = []
    for row in cursor:
        result.append(row)
    return result