Is MAX, MIN, SUM SQL command standard accross diffrent RDBMS
-
12-12-2019 - |
Pregunta
I only have MySQL installed right now but will these work fine when run in PgSQL, MS SQL, etc.?
SELECT MAX(field) as max_field FROM table
SELECT MIN(field) as max_field FROM table
SELECT SUM(field) as max_field FROM table
Solución
You could check for yourself, but aggregate functions are common across most, if not all, RDBMS:
- H2 aggregate functions
- Oracle aggregate functions
- PostgreSQL aggregate functions
- SQL Server aggregate functions
You get the idea.
Otros consejos
Yes, they work well in every database.
SELECT AVG(field) as max_field FROM table -- Work fine too
All *SQL RDBMSes are designed to be used with the SQL language. ALL of them. That's why they're called *SQL RDBMSes. Aggregate functions are part of standard SQL, and therefore usable wherever SQL is usable.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow