Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A camera club lends out equipment and stores each loan in a table Loans. Days is the length of the loan.
LoanID Item Days
N1 Camera 3
N2 Tripod 7
N3 Camera 10
N4 Lamp 2
N5 Tripod 1WHERE Item = 'Tripod' OR Days >= 7?SELECT SUM(Days) FROM Loans WHERE Item = 'Tripod' OR Days >= 7; output?With AND a record passes only if both conditions are true; with OR it passes if at least one is true. A range is Field >= low AND Field <= high; outside a range is Field < low OR Field > high. Each part needs its own field name.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. Tripod loans. N2 and N5.
Step 2. Loans of days or more. N2 () and N3 ().
Step 3. Together. N2, N3 and N5: records. N2 meets both parts, but it is one record.
Step 4. The sum. days.
Answer: (a) records. (b) .
Log in to join the discussion.
Loading…