I am doing a beginners' SQL tutorial and I started to wonder whether a simple SQL query on this table: http://www.sqlcourse2.com/items_ordered.html could tell the number of items (also 1) which have only been purchased more items at a time, so there is no record which contains the quantity column with a value of 1 AND the item. I am really beginner at this so please try to keep it simple.
Thank you in advance!
Welcome to the fascinating world of SQL.
Well - I'm not giving you the answer, but a hint (after all, it's a training and your own thinking and finding the solution would be the best way for you to learn something new).
The way you formulate your question is somewhat puzzling.
When I combine what you ask with what is possible with SQL, the question that would make sense to me would be that you need to list (or count, I did not understand that very well) the item
s (or the complete rows in the table with matching item
, that was not clear either), that were never sold with a quantity
of 1.
If that's what you need, you will need a subselect to get all distinct item
s that were sold with a quantity
of 1, and select the rows from your base table whose item
value is not in the list you get from the subselect.
Do you need more hints?
Marco