title: How to Write Optimal SQL Queries
body: <p>I've searched around stackoverflow but everybody asks to optimize queries they've already done.</p>
  
  <p>I want to know, the basic stuff on what to do, what to avoid when creating a query.</p>
  
  <p>For example, It's a known fact that Writing <code>SELECT * FROM</code> is a thing to avoid, given that The sql engine has to make an "invisible" query to know what columns should be shown.</p>
  
  <p>Also know that <code>between @min_number AND @max_number</code> works better than <code>Id &gt;= @min_number AND Id &lt;= @max_number</code> but I don't recall why. It can be because between is a sentence controlled at a lower level by the engine, and creates the iterations to show the regs somehow "handled". But I just don't know for sure.</p>
  
  <p>Could someone validate those and make a list of the most common <em>what to do, what to avoid</em> ?</p>