语法#
SELECT column-list
FROM table_name
WHERE [conditions]
GROUP BY column1, column2 ... columnN
ORDER BY column1, column2 ... columnN
实例#
SELECT NAME, SUM(SALARY) FROM COMPANY GROUP BY NAME;
INSERT INTO COMPANY VALUES (8, 'Paul', 24, 'Houston', 20000.00 );
INSERT INTO COMPANY VALUES (9, 'James', 44, 'Norway', 5000.00 );
INSERT INTO COMPANY VALUES (10, 'James', 45, 'Texas', 5000.00 );
SELECT NAME, SUM(SALARY) FROM COMPANY GROUP BY NAME ORDER BY NAME DESC;