Hello, this probably isnt the best place to ask but I can't find a more
suitable sql newsgroup so I hope y'all dont mind too much.
I have 2 tables; Cellar and Colour
CELLAR contains the wine name, its year and the no.of bottles.
Wine Year Bottles
Chardonnay 87 4
Fume Blanc 87 2
Pinot Noir 82 3
Zinfandel 84 9
COLOUR contains wine name and it's colour
Wine Colour
Chardonnay White
Fume Blanc White
Pinot NoirRed
Zinfandel Rose
This is from a past exam paper btw
One of the questions was:
Write the sql to count how many white wines there are in the table cellar.
The solution that the lecturers included is:
SELECT count(wine)
FROM cellar
WHERE colour='White'
Now i havent' been able to try out this sql yet but to me that looks wrong.
My solution would be:
SELECT count(wine)
FROM cellar
WHERE cellar.wine = colour.wine and colour.colour='White'
Can anyone tell me which one is correct, and if mine isn't correct then why
isn't it?
Thanks