TIL: =QUERY function on Google Spreadsheets

I’ve found Google Spreadsheets has =QUERY function which accepts SQL-like query and can produce grouped results. This is especially useful form summary tabes For example having following data on the spreadsheet:

A 10
B 5
A 5
C 1

Function =QUERY(A1:B4,"select A, sum(B) group by A") will produce:

A 15
B 5
C 1