SQL Conversion Functions By: Ms. Rubab [email protected] IBA ITC Sobhodero Managed By Khairpur Campus, IBA Sukkur University By: Ms. Rubab For DIT
SQL | Conversion Function By: Ms. Rubab For DIT
Implicit Data Conversion Implicit Data-Type Conversion : In this type of conversion the data is converted from one type to another implicitly (by itself/automatically). Example: from varchar to number By: Ms. Rubab For DIT
Example of Implicit conversion Query 1: Query 2: SELECT Fees FROM `students` WHERE fees > 2000 ‘Here 2000 is in number form’ Query 2: SELECT Fees FROM `students` WHERE fees > '2000’ ‘Here 2000 is in text/string form’ The output of both queries will be same because SQL automatically converts the text to number By: Ms. Rubab For DIT
Explicit Datatype conversion By: Ms. Rubab For DIT
Explicit Conversion TO_CHAR Function : TO_CHAR function is used to typecast a numeric or date input to character type with a format model (optional). SYNTAX : TO_CHAR(number1, [format], [ nls_parameter ]) By: Ms. Rubab For DIT