title: Why isn't this simple SQL query working? select *, count(*) from table
body: <p>I'm trying to learn SQL and am following along with an exercise, but I am hung up on why this simple SQL statement will not work.</p>
  <p><code>select *, count(*) from bricks</code></p>
  <p>What the instructor is trying to do is return all the rows of a table named bricks.  We also want to append a new column to the right side of the table that simply returns the total count of all bricks in each record.  So there are 6 bricks total in the table, so each row should have a column at the end that just reads 6.</p>
  <p>The way that the instructor did it is by doing this:</p>
  <p><code>select b.*, (select count(*) from bricks) total_bricks_in_table from bricks b;</code></p>
  <p>The first query is my attempt at it and I don't see why it doesn't work seeing as running</p>
  <p><code>select * from bricks</code></p>
  <p>and</p>
  <p><code>select count(*) from bricks</code></p>
  <p>Each work on their own, but not when combined.  I've tried adding a group by statement to the end of my attempt but no matter which column I group by I still get errors.  What exactly is wrong with my original attempt?</p>