|
The MIN() function returns the smallest value of the selected column.
A MIN()função retorna o menor valor da coluna selecionada.
SELECT MIN(column_name)
FROM table_name
WHERE condition;
|
DB2 Database - Banco de dados DB2:
Below is a selection from the "Product" table in the DB2 database.
Abaixo está uma seleção da tabela "Produto" no banco de dados DB2.
| ProductID | ProductName | Category | Price | QtyOnHand | TotalValue |
| 7001 | Mouse | Accessories | 75.00 | | |
| 7002 | Harddrive | | 65.00 | 20 | 1,300 |
| 7003 | Keyboard | Accessories | 36.00 | 33 | 1,118.00 |
| 7004 | RAM | Components | 23.50 | 16 | 376.00 |
| 7005 | Honda | Bikes | 1,200 | | |
| 7006 | PEN | | 7.45 | 10 | 74.50 |
| 7007 | Cddrive | Accessories | 75.00 | | |
| 7008 | Speaker | Accessories | 75.00 | | |
Example: Min Function - Exemplo: Função Min
The following SQL statement finds the price of the cheapest product in the "Product" table.
A seguinte instrução SQL encontra o preço do produto mais barato na tabela "Produto".
SELECT MIN(Price) AS SmallestPrice
FROM Products;
|
Result - Resultado:
|