yes this is a homework question, but I'm giving it honest effort and I'm not asking you to do it for me, just point me in the right direction! :)
So I have a set of questions concerning the SQL IN
subquery, and while I understand what it does I'm having trouble applying it in these situations.
The first question:
1) Use the In subquery technique to list the customer number, customer name and phone for customers who have paid either by visa or mc. Sort
by customer name.
This one I believe I got:
SELECT DISTINCT
tblCust.CustomerNum, CustomerName, Phone
FROM
tblCust
INNER JOIN tblOrd ON
tblCust.CustomerNum=tblOrd.CustomerNum
WHERE
tblOrd.PayMethod IN ("visa", "mc")
ORDER BY CustomerName;
But the next one just makes no sense to me:
2) Use the In subquery technique to list from tblCust the customer number, customer name and state for customers who have a state
description that begins with “co”.
Shouldn't I be using the LIKE operator for this instead of IN?
So far I have:
SELECT
CustomerNum, CustomerName, StateProv
FROM
tblCust
INNER JOIN tblState ON
tblCust.StateProv = tblState.StateProv
WHERE
tblState.StateProvDesc IN
And I don't know what to put after the IN, if I were using LIKE I would say
...StateProvDesc LIKE "co%"
and be done with it, but I don't think that's what my teacher wants.
Finally, the third question:
3) Use the In subquery technique to list from tblCust the customer
name, country for customers who have at least one order in the range
of $90,000-$120,000. Sort by country then customer name.
Shouldn't between be used for a range of numbers?
Thanks for anything you guys can think of!
using microsoft access by the way