A distributor stores its sales representatives and their sales in two tables.
SALESREP
RepID
Name
Region
R1
Diaz
East
R2
Okafor
West
R3
Nguyen
R4
Brandt
North
SALE
SaleID
Amount (CAD)
S1
1200
S2
450
S3
900
S4
(blank)
300
S5
780
Sale S4 was a walk-in sale not credited to any rep, so its RepID is blank (null). An analyst runs an inner join of SALESREP and SALE on SALESREP.RepID = SALE.RepID.
Which statement describes the result?
4 rows: Brandt has no matching sale and S4 has no matching rep, so neither appears.
3 rows: each rep can match at most once, so Diaz appears in only one row.
5 rows: every sale appears once, and only Brandt is missing because Brandt has no sales.
20 rows: each of the 4 reps is paired with each of the 5 sales.
6 rows: every sale appears once, plus one row for Brandt with blank sale columns.
Unlock full course notes by signing up
Keys in an enrolment linking table
A college stores its records in three tables:
STUDENT(StudentID, Name, Program)
COURSE(CourseCode, Title, Credits)
Applying two membership filters
A recreation centre tests two alternative filters on its membership table. Apply each rule independently to every member, and enter keep or omit in each answer cell.
Rule P keeps a row when Age is at least 18 AND Fee paid is Yes.
Rule Q keeps a row when Age is at least 18 OR Fee paid is Yes. Here, OR includes rows that satisfy both conditions.
Planning a three-table query for a marketing list
A fitness chain records its data in three tables:
MEMBER(MemberID, Name, HomeClubID, JoinDate)
CLUB(ClubID, City)
Following successive inventory changes
A stationery shop performs two operations on the inventory table below. Each operation completes before the next begins, and no other changes occur.
UPDATE: Increase Units by 3 for every row whose Category is Pen AND whose Status is Active.
DELETE: Remove every row whose Status is Clearance OR whose Units value is 0.