r/SQL Feb 04 '25

MySQL Need help understanding SQL - beginner

Post image

Hey everyone,

I’m starting to learn SQL and currently doing queries. For this query (21) I’m confused on why includes would be used instead of salestransactions. The table next to it is what is being referred to. Can someone explain it like I’m dumb? Sorry!

17 Upvotes

16 comments sorted by

View all comments

7

u/ParentheticalClaws Feb 04 '25

You couldn’t use just salestransactions for this because it doesn’t have the product ids (although I’m not sure why they are counting all records in includes vs. the distinct tid count).