title: Database design naming: should use "id" or "table_name" + "id"?
body: <p>So, for each table there is a id, generally it is int(11) Auto inc, not null.</p>
  
  <p>When I was in school I mainly named it as id,</p>
  
  <p>However, when I encounter the more complex database design , I found if I use "id", I have to do more in the Select Query</p>
  
  <p>For example, there is a table "customer", "customer_group"</p>
  
  <p>So I simply get the customer and his customer_group info like this:</p>
  
  <pre><code>SELECT *
  FROM customer
  JOIN customer_group 
      ON customer.group_id = customer_group.id
  </code></pre>
  
  <p>Notice that there will be two id return, if I would like differentiate them, I need to do:</p>
  
  <pre><code>SELECT customer.id AS cid
      ,customer_group_id AS cgid
      ,customer.NAME
      ,.......
  FROM customer
  JOIN customer_group 
      ON customer.group_id = customer_group.id
  </code></pre>
  
  <p>That makes the work very tedious and the query is long. So, I wonder what is the practice in naming the id, should I use table_name + "id" to name it? Thanks </p>