sql get lowest value code example
Example 1: how to find lowest in sql
SELECT first_name, last_name, salary, job_id
FROM employees
WHERE salary = (SELECT MIN(salary) FROM employees);
Example 2: sql select second max
Both options you find max as a subset and then exclude from main select
sql> SELECT MAX( col ) FROM table
WHERE col < ( SELECT MAX( col ) FROM table);
sql> SELECT MAX(col) FROM table
WHERE col NOT IN (SELECT MAX(col) FROM table);