I was looking through some example query questions are found these two:
Consider the following database structure:
pizza(pid, pname, size)
store(sname, phone, quality)
soldby(pid, sname, price)
1. Find the name of all the stores that sell both veggie and cheese pizza.
2. Find the names of all the stores that do not sell veggie pizza.
Can these be done in single queries?
For question 1, surely it involves going through the entire tables to establish weather both pizzas are sold? You cannot do a WHERE clause because the entire set needs to be evaluated and now just the row?
It looked easy at first, then i thought about it and got stumped! Any ideas?
andy
Consider the following database structure:
pizza(pid, pname, size)
store(sname, phone, quality)
soldby(pid, sname, price)
1. Find the name of all the stores that sell both veggie and cheese pizza.
2. Find the names of all the stores that do not sell veggie pizza.
Can these be done in single queries?
For question 1, surely it involves going through the entire tables to establish weather both pizzas are sold? You cannot do a WHERE clause because the entire set needs to be evaluated and now just the row?
It looked easy at first, then i thought about it and got stumped! Any ideas?
andy