Computer Science/Database

W3Schools SQL | #12 SQL MIN(), MAX() 함수

토마토. 2022. 10. 27. 11:17

SQL MIN() and MAX() Functions

The SQL MIN() and MAX()

  • MIN() function
    • 지정한 칼럼의 가장 작은 value를 리턴한다.
  • MAX() function
    • 지정한 칼럼의 가장 큰 value를 리턴한다.

MIN() Syntax

SELECT MIN(column_name)
FROM table_name
WHERE condition;

MAX() Syntax

SELECT MAX(column_name)
FROM table_name
WHERE condition;

MIN() Example

SELECT MIN(Price) AS SmallestPrice
FROM Products;

MAX() Example

SELECT MAX(Price) AS LargestPrice
FROM Products;