Page 98 - SQL
P. 98

expressions. This type of function returns a single numeric value.
            6.  Metadata functions retrieve information about a specified database, such as its name and
              database objects.
            7.  Security functions provide information that you can use to manage the security of a
              database, such as information about database users and roles.
            8.  String functions perform operations on string values and return either numeric or string
              values.


        Using string functions, you can, for example, combine data, extract a substring, compare strings,
        or convert a string to all uppercase or lowercase characters.

            9.  System functions perform operations and return information about values, objects, and
              settings for the current SQL instance
          10.  System statistical functions provide various statistics about the current SQL instance – for
              example, so that you can monitor the system's current performance levels.


        Examples



        Character modifications


        Character modifying functions include converting characters to upper or lower case characters,
        converting numbers to formatted numbers, performing character manipulation, etc.


        The lower(char) function converts the given character parameter to be lower-cased characters.


         SELECT customer_id, lower(customer_last_name) FROM customer;


        would return the customer's last name changed from "SMITH" to "smith".


        Date And Time


        In SQL, you use date and time data types to store calendar information. These data types include
        the time, date, smalldatetime, datetime, datetime2, and datetimeoffset. Each data type has a
        specific format.



          Data type        Format

          time             hh:mm:ss[.nnnnnnn]


          date             YYYY-MM-DD


          smalldatetime    YYYY-MM-DD hh:mm:ss

          datetime         YYYY-MM-DD hh:mm:ss[.nnn]


          datetime2        YYYY-MM-DD hh:mm:ss[.nnnnnnn]

          datetimeoffset   YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+/-]hh:mm


        https://riptutorial.com/                                                                               80
   93   94   95   96   97   98   99   100   101   102   103