Descrição das diferenças entre a função mínimo e a função MÁXIMO e diferenças entre as funções de campo SQL SELECT MIN e MAX campo do FoxPro

Resumo

Existem diferenças distintas entre as funções min () e Max () e as funções de campo SQL SELECT min () e Max (). As funções de campo SQL SELECT min () e Max () aceitam apenas um argumento, enquanto as funções min () e Max () aceitam vários argumentos.


Os exemplos a seguir demonstram como cada função seria usada em um programa do FoxPro.
SELECT MIN(price) from detail     && This statement will select the record with lowest price
&& in the database.

SELECT MIN(IIF(price < 0,0,price)) FROM detail
&& This statement will select the record with the lowest price
&& as long as it is not less than zero; if it is less than zero,
&& it will return zero (0).

?MIN(54, 39, 40)
&& This statement will return the minimum of the three parameters
&& (39).

?MAX(54, 39, 40)
&& This statement will return the maximum of the three parameters
&& (54).

SELECT MIN(price,0) from detail
&& This statement will cause the error " MISSING ) " to occur.
&& To correct this statement, remove the second argument from
&& the MIN() function, as shown in the first example.

Para o Visual FoxPro 6.0 e versões posteriores, use este código:
open database home(2)+"data\testdata.dbc"SELECT MIN(order_amt) from orders
&& This statement will select the record with lowest price
&& in the database.

SELECT MIN(IIF(order_amt < 0,0,order_amt)) FROM orders
&& This statement will select the record with the lowest price
&& as long as it is not less than zero; if it is less than zero,
&& it will return zero (0).

?MIN(54, 39, 40)
&& This statement will return the minimum of the three parameters
&& (39).

?MAX(54, 39, 40)
&& This statement will return the maximum of the three parameters
&& (54).

SELECT MIN(order_amt,0) from orders
&& This statement will cause the error " MISSING ) " to occur.
&& To correct this statement, remove the second argument from
&& the MIN() function, as shown in the first example.



Propriedades

ID do Artigo: 98362 - Última Revisão: 12 de jan de 2017 - Revisão: 1

Comentários