What is the result of this SQL query?
Posted
by Martin
on Stack Overflow
See other posts from Stack Overflow
or by Martin
Published on 2010-05-07T11:49:05Z
Indexed on
2010/05/07
11:58 UTC
Read the original article
Hit count: 167
I'm working on a mock exam paper at the moment, however I have no set of correct answers and I'm not sure what the correct answer of this SQL query is.
Given a table:
foo, bar
a , 1
b , 3
a , 2
c , 1
and the query:
SELECT foo, sum(bar)
FROM table
GROUP BY foo
The two ways I can see this going are either:
a 3
a 3
b 3
c 1
or
a 3
b 3
c 1
Thanks.
© Stack Overflow or respective owner