0

I am very new to SQL and am currently tasked with writing various basic SQL queries. At the moment I am stuck on what seems to be a fairly simple problem. I have a table of movies, each of which has a category and a stock count (the amount of DVDs available). I must get the total amount of movies where the stock count is not 0.

For example, I have 10 movies, 3 are horror, 5 are suspense, and 2 are romance. I would like to go through and get a table like:

videos   category
3        horror
5        suspense
2        romance

Here is an image of my current setup:

Current Setup

Mitchnoff
  • 495
  • 2
  • 7

1 Answers1

2

Try this

    Select category, count (distinct title ) as total_titles
    from video_recordings where 
    stock_count ! =0
   group by category 
Himanshu
  • 3,830
  • 2
  • 10
  • 29