MySQL Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
Feedback
 





MySQL Type Conversion


Tutorials Mysql

Topic

What is meant by Type Conversion?


Explanation


MySQL Type Conversion :

    Type conversion takes place when operators are used with different types of operands in an expression. Some conversions are done implicitly and some need explicit conversions.

    In MySQL the numbers are converted to strings and sometimes strings to numbers depending upon the condition.

    Let us consider an example for converting a string to an integer.

mysql> Select 1+'11';
 --> 12
    Here the string '11' is converted to a number and the result of the expression is also a number.

    Lets see another example for converting an integer to a string.
mysql> select concat(1, ' HIOX');
 --> '1 HIOX'
    We can convert or casting a number to a string explicitly. Here we use CAST() or CONCAT() function.

mysql> select 12, cast(12 as char);
 --> 12, '12'
mysql> select 12, concat(12);
 --> 12, '12'
    The above examples shows how to use MySQL Type Conversion.



A Note

MySQL is the most popular open source Relational database Management system (RDBMS). Being a open source anyone can use and change the software for their needs. Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this MySQL tutorial. This is a copyright content.


Other Links

web hosting