Page 102 - SQL
P. 102

In this example, you use the IIF function to return one of two values. If a sales person's year-to-
        date sales are above 200,000, this person will be eligible for a bonus. Values below 200,000 mean
        that employees don't qualify for bonuses.




        SQL includes several mathematical functions that you can

        use to perform calculations on input values and return

        numeric results.




        One example is the SIGN function, which returns a value indicating the sign of an expression. The
        value of -1 indicates a negative expression, the value of +1 indicates a positive expression, and 0
        indicates zero.


         SELECT SIGN(-20) AS 'Sign'



          Sign

          -1



        In the example, the input is a negative number, so the Results pane lists the result -1.



        Another mathematical function is the POWER function. This function provides the value of an
        expression raised to a specified power.


        In the syntax, the float_expression parameter specifies the expression, and the y parameter
        specifies the power to which you want to raise the expression.


         SELECT POWER(50, 3) AS Result


          Result


          125000


        Read Functions (Scalar/Single Row) online: https://riptutorial.com/sql/topic/6898/functions--scalar-
        single-row-




















        https://riptutorial.com/                                                                               84
   97   98   99   100   101   102   103   104   105   106   107