1SELECT MAX(<numeric column>) FROM <table>;
2SELECT MAX(<numeric column>) FROM <table> GROUP BY <other column>;
1SELECT MAX(salary) FROM employees;
2SELECT id, MAX(salary) FROM employees GROUP BY id;
3
4SELECT t1.*
5FROM employees t1
6INNER JOIN (
7 SELECT id, max(salary) AS salary FROM employees GROUP BY id
8) t2 ON t1.id = t2.id AND t1.salary = t2.salary;
1SELECT max(MY_COLUMN) FROM my_table;
2SELECT MY_ID, max(MY_COLUMN) FROM my_table GROUP BY ID; -- Max by MY_ID
1● SELECT first-name, MAX(salary)
2FROM department d LEFT OUTER JOIN employee e ON (d.department_id = e.department_id)
3GROUP BY department_id;
1ALTER TABLE dbo.mytable ADD CONSTRAINT CK_HAPPINESS_MAX CHECK (PokemonHappiness <= 10000)
2