Using Statistical functions

4D - Documentation   Français   English   German   Japanese   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next

version 11


Sometimes it can be useful to get statistical information about certain values. SQL includes many aggregate functions like MIN, MAX, AVERAGE, SUM and so on. Using aggregate functions, we would like to get information about the number of tickets sold each year. The result will be sorted by year.

To do this, we must total all the tickets sold for each movie and then sort the result by year.

The initial query in 4D code would be:

Using SQL code, the above query becomes:

Using generic SQL commands, the above query becomes:

Using the SQL EXECUTE IMMEDIATE command, the query above becomes:

To test all the above examples, launch the "4D SQL Code Samples" database and go to the main window. You can then choose the query mode and press the Using Aggregate functions button.


4D - Documentation   Français   English   German   Japanese   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next