title: SQL COUNT NULL values
body: <p>I am trying to find the Playlist(s) with 10 or more tracks that have NULL values in the Composer column. </p>
  
  <p>Here are the tables</p>
  
  <pre><code>CREATE TABLE [Playlist]
  (
  [PlaylistId] INTEGER  NOT NULL,
  [Name] NVARCHAR(120),
  CONSTRAINT [PK_Playlist] PRIMARY KEY  ([PlaylistId])
  );
  
  CREATE TABLE [PlaylistTrack]
  (
  [PlaylistId] INTEGER  NOT NULL,
  [TrackId] INTEGER  NOT NULL,
  CONSTRAINT [PK_PlaylistTrack] PRIMARY KEY  ([PlaylistId], [TrackId]),
  FOREIGN KEY ([PlaylistId]) REFERENCES [Playlist] ([PlaylistId]) 
      ON DELETE NO ACTION ON UPDATE NO ACTION,
  FOREIGN KEY ([TrackId]) REFERENCES [Track] ([TrackId]) 
      ON DELETE NO ACTION ON UPDATE NO ACTION
  );
  
  CREATE TABLE [Track]
  (
  [TrackId] INTEGER  NOT NULL,
  [Name] NVARCHAR(200)  NOT NULL,
  [AlbumId] INTEGER,
  [MediaTypeId] INTEGER  NOT NULL,
  [GenreId] INTEGER,
  [Composer] NVARCHAR(220),
  [Milliseconds] INTEGER  NOT NULL,
  [Bytes] INTEGER,
  [UnitPrice] NUMERIC(10,2)  NOT NULL,
  CONSTRAINT [PK_Track] PRIMARY KEY  ([TrackId]),
  FOREIGN KEY ([AlbumId]) REFERENCES [Album] ([AlbumId]) 
      ON DELETE NO ACTION ON UPDATE NO ACTION,
  FOREIGN KEY ([GenreId]) REFERENCES [Genre] ([GenreId]) 
      ON DELETE NO ACTION ON UPDATE NO ACTION,
  FOREIGN KEY ([MediaTypeId]) REFERENCES [MediaType] ([MediaTypeId]) 
      ON DELETE NO ACTION ON UPDATE NO ACTION
  )
  </code></pre>
  
  <p>Here is what I have so far. I think the query logic is good but is this the correct way to count up null values?</p>
  
  <pre><code>SELECT P.PlaylistId, P.name
  FROM Playlist P
      JOIN PlaylistTrack pt ON p.PlaylistId = pt.PlaylistId
      JOIN Track t ON pt.TrackId = t.TrackId
  GROUP BY p.PlaylistId
  HAVING COUNT(t.Composer IS NULL) &gt;=10;
  </code></pre>