Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 46 - Modular_V2.0_SQL_Flipbook
P. 46

    S.No.         Function                      Purpose                          Functionality
                                                   Returns the argument in
                                                                                        Select LOWER ("Mrs Gandhi");
                      3      LOWER( )/LCASE ( )    lowercase of the string supplied
                                                                                        Output: mrs gandhi
                                                   as input

                                                   Converts the string to the           SELECT UPPER ( 'Large')
                      4      UPPER( )/UCASE( )
                                                   uppercase                            Output: LARGE

                  Numeric Functions

                  The numeric functions are those functions that accept numeric values and after performing the required
                  operation, return numeric values. Some useful numeric functions are being discussed below:

                   S.No.         Function                        Purpose                            Functionality
                                                  Returns the remainder of one expression  SELECT MOD ( 15 , 2) "
                      1    MOD ( )
                                                  that is divided by another expression     Output: 1
                                                  Returns  the value of one expression  SELECT POWER ( 2 , 4 ) "
                      2    POWER ( ) / POW( )
                                                  raised to the power of another expression Output: 16
                                                                                            SELECT SIGN ( - 15)
                                                  This function returns  sign of  a  given  Output: -1
                      3    SIGN( )
                                                  number                                    It returns  -1 for  negative
                                                                                            and 1 for positive
                                                  Returns the non-negative square root  SELECT SQRT ( 49 )
                      4    SQRT(  )
                                                  of numeric expression.                    Output: -7

                                                  Returns numeric exp1 truncated  to        SELECT TRUNCATE (16.23,1)
                      5    TRUNCATE( )            exp2 decimal places. If exp2 is 0, then   Output: -16.2
                                                  the result will have no decimal point

                  Date and Time Functions

                  Date functions operate on values of the DATE data type. Normally its output depends on system
                  data settings.

                    S.No.     Function               Purpose                              Functionality

                                           Returns the current date of    SELECT CURDATE( );
                      1.    CURDATE ( )
                                           the system                     Output is current date of the system
                                           Extracts the date part of a
                      2     DATE ( )       date or complete date  from  SELECT DATE('2022-10-17 11:25:30');
                                           the expression
                                           The  month  from  the  date
                      3     MONTH ( )                                     SELECT MONTH(' 2022-02-02 ');
                                           passed
                                           Returns the year out of the
                      4     YEAR ( )                                      SELECT YEAR(' 2022-05-011');
                                           date
                                           Returns the exact  time at
                      5     NOW ( )        which the function executes  SELECT NOW ( );
                                           as per system clock

                    44
                          Touchpad MODULAR (Ver. 2.0)

| 41 42 43 44 45 46 47 48 49 50 51 |