A retail chain joins daily receipts to a loyalty-profile table on card number. Shoppers who paid without a loyalty card disappear from the sales report, so weekend totals no longer match the register. Which change keeps every receipt and attaches a profile only when a card matches?
Select an answer to reveal the explanation.
Short Explanation
Picture a bouncer working your guest list at the door. An inner join turns away every receipt that lacks a loyalty profile, so those sales vanish from your weekend total. Put receipts on the left of a left join and the profile comes along only when the card is on the list.
Full Explanation
An inner join returns a receipt only when its card number finds a profile row, so shoppers who paid without a loyalty card are removed before the weekend total is computed. The register still recorded those sales; the join is what dropped them. A left join with the receipt table on the left keeps every receipt and fills profile columns only when the card matches, leaving those columns blank otherwise. Switching to an inner join repeats the current loss, because a match-only join is the rule that already removed the unenrolled shoppers. A right join that preserves the profile table keeps members who bought nothing and still discards receipts whose card has no profile. A cross join followed by an equal-card filter multiplies rows and then throws away non-matches, which rebuilds an inner join and loses the same shoppers. Exam caveat: a left join preserves only its left input, so placing profiles on the left would keep member rows and drop cardless receipts again. Operational check: count receipt rows before the join and after it, and confirm that a known cardless ticket appears once with blank profile fields.