Can I create my own query in wordpress with traditional methods?

With some assistance from @JacobPeattie I modified the code to the recommended get_tags() function. Now in the functions.php I have the following code.

// Get al the tags with published post
function get_all_tags(){
    $posttags = get_tags('');
    if ($posttags) {
        foreach($posttags as $tag) {
            echo '<li><a href="#">'.$tag->name.'</a></li>'; 
        }
    }
}

In the single.php file, I call this with the following code.

<?php $tagsAll = get_all_tags(); echo $tagsAll; ?>