blob: c3853832f87e87137c7abb472a4267b3885d05b7 (
plain)
1
2
3
4
5
6
7
8
|
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score));
INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10);
SELECT COUNT(*) as n, score FROM t1 GROUP BY score;
n score
4 10
2 20
drop table t1;
|